[ABAP] IDoc: Basistyp lesen

TYPES: ty_it_pt_syntax TYPE STANDARD TABLE OF edi_iapi02 WITH DEFAULT KEY.
TYPES: ty_it_pt_extensions TYPE STANDARD TABLE OF edi_iapi04 WITH DEFAULT KEY.

* Segmenttyp
PARAMETERS: p_ityp TYPE edbas-idoctyp.

DATA(lv_pe_attributes) = VALUE edi_iapi01( ).
DATA(it_pt_syntax) = VALUE ty_it_pt_syntax( ).
DATA(it_pt_pre_syntax) = VALUE ty_it_pt_syntax( ).
DATA(it_pt_extensions) = VALUE ty_it_pt_extensions( ).

CALL FUNCTION 'IDOCTYPE_READ'
  EXPORTING
    pi_idoctyp       = p_ityp
  IMPORTING
    pe_attributes    = lv_pe_attributes
  TABLES
    pt_syntax        = it_pt_syntax
    pt_pre_syntax    = it_pt_pre_syntax
    pt_extensions    = it_pt_extensions
  EXCEPTIONS
    object_not_found = 1
    db_error         = 2
    no_authority     = 3
    OTHERS           = 4.

IF sy-subrc = 0.
  cl_demo_output=>write( lv_pe_attributes ).
  cl_demo_output=>write( it_pt_syntax ).
  cl_demo_output=>write( it_pt_pre_syntax ).
  cl_demo_output=>write( it_pt_extensions ).
  cl_demo_output=>display( ).
ENDIF.