Code: Alles auswählen.
INCLUDE <icon>.
TYPES: BEGIN OF l_ordertab,
locid TYPE /sapapo/locid,
matid TYPE /sapapo/matid,
matnr TYPE /sapapo/v_matloc-matnr,
locno TYPE /sapapo/v_matloc-locno,
orderid TYPE /SAPAPO/ORDERID,
cat TYPE /SAPAPO/ATPCAT,
locfr TYPE /SAPAPO/LOCID,
locto TYPE /SAPAPO/LOCID,
END OF l_ordertab.
*TYPES: BEGIN OF l_eorder,
** locid TYPE /sapapo/locid,
** matid TYPE /sapapo/matid,
* matnr TYPE /sapapo/v_matloc-matnr,
* locno TYPE /sapapo/v_matloc-locno,
* orderid TYPE /SAPAPO/ORDERID,
* cat TYPE /SAPAPO/ATPCAT,
* locfr TYPE /SAPAPO/LOCID,
* locto TYPE /SAPAPO/LOCID,
* END OF l_eorder.
TYPES: BEGIN OF l_version,
version_id TYPE /SAPAPO/VRSIOID,
END OF l_version.
* Tabellen
DATA: lt_matloc TYPE /sapapo/v_matloc OCCURS 0,
wa_matloc TYPE /sapapo/v_matloc,
lt_eorder TYPE /SAPAPO/MSDP_ORDER_DETAIL_TAB,
wa_eorder TYPE /SAPAPO/MSDP_ORDER_DETAIL_TAB,
lt_version TYPE /SAPAPO/VERSKEY,
wa_version TYPE l_version.
* Variablen
DATA: locno TYPE /SAPAPO/loc-locno,
matnr TYPE /SAPAPO/matnr,
datefr TYPE /SAPAPO/SNPTSTMP,
dateto TYPE /SAPAPO/SNPTSTMP.
DATA: lt_ordertab TYPE STANDARD TABLE OF l_ordertab,
wa_ordertab TYPE l_ordertab.
DATA: i TYPE l_ordertab,
itab TYPE l_ordertab,
y TYPE l_version,
ytab TYPE version.
* Lokation
SELECTION-SCREEN BEGIN OF BLOCK loc WITH FRAME TITLE text-002.
SELECT-OPTIONS s_locno FOR locno.
SELECT-OPTIONS s_matno FOR matnr.
PARAMETERS: s_datefr LIKE datefr.
PARAMETERS: s_dateto LIKE dateto.
SELECTION-SCREEN END OF BLOCK loc.
START-OF-SELECTION.
SELECT * FROM /SAPAPO/V_MATLOC INTO CORRESPONDING FIELDS OF TABLE lt_matloc WHERE locno in s_locno AND matnr in s_matno.
LOOP AT lt_matloc into wa_matloc.
CALL FUNCTION 'Z_SNP_LC_READ_ORDER'
EXPORTING
I_MATID = wa_matloc-matid
I_LOCID = wa_matloc-locid
I_TSTFROM = datefr
I_TSTTO = dateto
* I_CATGR = 'EP'
I_VERSIO = wa_version-version_id
I_CAT = 'EP'
* I_DET = ''
IMPORTING
E_ORDER_TAB = lt_eorder
* E_ORDKEYS_TAB =
* E_ORDERMAP_TAB =
* EXCEPTIONS
* ORDER_NOT_FOUND = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT lt_eorder into wa_eorder.
move wa_eorder-cat to wa_ordertab-cat.
move wa_eorder-locfr to wa_ordertab-locfr.
move wa_eorder-locto to wa_ordertab-locto.
move wa_matloc-matnr to wa_ordertab-matnr.
move wa_matloc-locno to wa_ordertab-locno.
APPEND wa_ordertab TO lt_ordertab.
Write:/ wa_eorder-cat.
ENDLOOP.
ENDLOOP.
Code: Alles auswählen.
DATA:
lt_eorder TYPE /SAPAPO/MSDP_ORDER_DETAIL_TAB,
wa_eorder LIKE LINE OF lt_eorder.