Code: Alles auswählen.
METHOD get_archiv.
DATA it_arch TYPE STANDARD TABLE OF zarixmm2.
DATA it_ekko TYPE STANDARD TABLE OF ekko.
DATA it_ekpo TYPE STANDARD TABLE OF ekpo.
DATA it_eket TYPE STANDARD TABLE OF eket.
DATA it_ekkn TYPE STANDARD TABLE OF ekkn.
DATA itab_arch TYPE STANDARD TABLE OF t_ausgabe.
DATA wa_arch LIKE LINE OF itab_arch.
SELECT ebeln FROM zarixmm2
INTO CORRESPONDING FIELDS OF TABLE it_arch
WHERE bsart IN pa_bsart
AND lifnr IN pa_lnum
AND matnr IN pa_mat
AND aedat IN pa_time.
IF it_arch IS NOT INITIAL.
DELETE ADJACENT DUPLICATES FROM it_arch.
LOOP AT it_arch INTO DATA(wa_itab).
CALL FUNCTION '/PBS/SELECT_INTO_TABLE'
EXPORTING
archiv = 'CMM'
option = 'A'
tabname = 'EKET'
schl1_name = 'EBELN'
schl1_von = wa_itab-ebeln
schl1_bis = wa_itab-ebeln
TABLES
I_Tabelle = it_eket
EXCEPTIONS
eof
OTHERS.
CALL FUNCTION '/PBS/SELECT_INTO_TABLE'
EXPORTING
archiv = 'CMM'
option = 'A'
tabname = 'EKPO'
schl1_name = 'EBELN'
schl1_von = wa_itab-ebeln
schl1_bis = wa_itab-ebeln
TABLES
I_Tabelle = it_ekpo
EXCEPTIONS
eof
OTHERS.
CALL FUNCTION '/PBS/SELECT_INTO_TABLE'
EXPORTING
archiv = 'CMM'
option = 'A'
tabname = 'EKKO'
schl1_name = 'EBELN'
schl1_von = wa_itab-ebeln
schl1_bis = wa_itab-ebeln
TABLES
I_Tabelle = it_ekko
EXCEPTIONS
eof
OTHERS.
CALL FUNCTION '/PBS/SELECT_INTO_TABLE'
EXPORTING
archiv = 'CMM'
option = 'A'
tabname = 'EKKN'
schl1_name = 'EBELN'
schl1_von = wa_itab-ebeln
schl1_bis = wa_itab-ebeln
TABLES
I_Tabelle = it_ekkn
EXCEPTIONS
eof
OTHERS.
LOOP AT it_eket ASSIGNING FIELD-SYMBOL(<fs_eket>).
wa_arch-ebeln = <fs_eket>-ebeln.
wa_arch-ebelp = <fs_eket>-ebelp.
wa_arch-etenr = <fs_eket>-etenr.
wa_arch-eindt = <fs_eket>-eindt.
LOOP AT it_ekpo ASSIGNING FIELD-SYMBOL(<fs_ekpo>) WHERE ebeln EQ <fs_eket>-ebeln AND ebelp EQ <fs_eket>-ebelp.
wa_arch-labnr = <fs_ekpo>-labnr.
wa_arch-kunnr = <fs_ekpo>-kunnr.
wa_arch-matnr = <fs_ekpo>-matnr.
wa_arch-txz01 = <fs_ekpo>-txz01.
wa_arch-menge = <fs_ekpo>-menge.
wa_arch-meins = <fs_ekpo>-meins.
LOOP AT it_ekko ASSIGNING FIELD-SYMBOL(<fs_ekko>) WHERE ebeln EQ <fs_eket>-ebeln.
wa_arch-aedat = <fs_ekko>-aedat.
wa_arch-inco1 = <fs_ekko>-inco1.
wa_arch-inco2 = <fs_ekko>-inco2.
wa_arch-lifnr = <fs_ekko>-lifnr.
ENDLOOP.
LOOP AT it_ekkn ASSIGNING FIELD-SYMBOL(<fs_ekkn>) WHERE ebeln EQ <fs_eket>-ebeln AND ebelp EQ <fs_eket>-ebelp.
wa_arch-vbeln = <fs_ekkn>-vbeln.
wa_arch-vbelp = <fs_ekkn>-vbelp.
ENDLOOP.
ENDLOOP.
APPEND wa_arch TO itab_out.
ENDLOOP.
ENDLOOP.
ENDIF.
ENDMETHOD.
Code: Alles auswählen.
LOOP AT it_eket ASSIGNING FIELD-SYMBOL(<fs_eket>).
wa_arch-ebeln = <fs_eket>-ebeln.
wa_arch-ebelp = <fs_eket>-ebelp.
wa_arch-etenr = <fs_eket>-etenr.
wa_arch-eindt = <fs_eket>-eindt.
LOOP AT it_ekpo ASSIGNING FIELD-SYMBOL(<fs_ekpo>) WHERE ebeln EQ <fs_eket>-ebeln AND ebelp EQ <fs_eket>-ebelp.
wa_arch-labnr = <fs_ekpo>-labnr.
wa_arch-kunnr = <fs_ekpo>-kunnr.
wa_arch-matnr = <fs_ekpo>-matnr.
wa_arch-txz01 = <fs_ekpo>-txz01.
wa_arch-menge = <fs_ekpo>-menge.
wa_arch-meins = <fs_ekpo>-meins.
ENDLOOP.
LOOP AT it_ekko ASSIGNING FIELD-SYMBOL(<fs_ekko>) WHERE ebeln EQ <fs_eket>-ebeln.
wa_arch-aedat = <fs_ekko>-aedat.
wa_arch-inco1 = <fs_ekko>-inco1.
wa_arch-inco2 = <fs_ekko>-inco2.
wa_arch-lifnr = <fs_ekko>-lifnr.
ENDLOOP.
LOOP AT it_ekkn ASSIGNING FIELD-SYMBOL(<fs_ekkn>) WHERE ebeln EQ <fs_eket>-ebeln AND ebelp EQ <fs_eket>-ebelp.
wa_arch-vbeln = <fs_ekkn>-vbeln.
wa_arch-vbelp = <fs_ekkn>-vbelp.
ENDLOOP.
APPEND wa_arch TO itab_out.
ENDLOOP.
ENDLOOP.