Documente Academic
Documente Profesional
Documente Cultură
"Material
"Plant
"Storage Location
"Material Type
"Batch number
"Maintenance Status
avoid
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
*------Event initialization--------------------------------------------*
INITIALIZATION.
v_prog = sy-repid.
v_date = sy-datum.
v_time = sy-uzeit.
ENDFORM.
" GET_MARC
*&---------------------------------------------------------------------*
*&
Form GET_MARD
*&---------------------------------------------------------------------*
*
Select data from MARD table
*----------------------------------------------------------------------*
FORM get_mard .
IF it_marc IS NOT INITIAL. "Prerequisite of FOR ALL ENTRIES IN
SELECT matnr werks lgort pstat
FROM mard INTO TABLE it_mard
FOR ALL ENTRIES IN it_marc
WHERE matnr = it_marc-matnr
AND werks = it_marc-werks.
IF sy-subrc = 0.
SORT it_mard BY matnr.
ELSE.
MESSAGE 'Storage Location doesn''t exist' TYPE 'I'.
ENDIF.
ENDIF.
ENDFORM.
" GET_MARD
*&---------------------------------------------------------------------*
*&
Form GET_OUTPUT
*&---------------------------------------------------------------------*
*
Preparing the output table by using Loop
*----------------------------------------------------------------------*
FORM get_output .
IF it_mara IS NOT INITIAL.
LOOP AT it_mara INTO wa_mara.
wa_out-matnr = wa_mara-matnr.
wa_out-mtart = wa_mara-mtart.
LOOP AT it_marc INTO wa_marc
WHERE matnr = wa_mara-matnr.
wa_out-werks = wa_marc-werks.
wa_out-xchar = wa_marc-xchar.
LOOP AT it_mard INTO wa_mard
WHERE matnr = wa_marc-matnr
AND werks = wa_marc-werks.
wa_out-lgort = wa_mard-lgort.
wa_out-pstat = wa_mard-pstat.
APPEND wa_out TO it_out.
CLEAR: wa_out, wa_mara, wa_marc, wa_mard.
ENDLOOP.
ENDLOOP.
ENDLOOP.
ENDIF.
ENDFORM.
" GET_OUTPUT
*&---------------------------------------------------------------------*
*&
Form DISPLAY
*&---------------------------------------------------------------------*
*
Displaying the classical output by using WRITE statement
*----------------------------------------------------------------------*
FORM display .
wa_out-matnr,
wa_out-werks,
wa_out-lgort,
wa_out-mtart,
wa_out-xchar,
wa_out-pstat.
IF wa_out-matnr IS INITIAL.
AT END OF matnr. "Control break statement
SKIP.
ENDAT.
ENDIF.
AT LAST. "Control break statement
ULINE.
WRITE: / c_end.
ENDAT.
ENDLOOP.
ENDIF.
ENDFORM.
" DISPLAY
*&---------------------------------------------------------------------*
*&
Form TOP_OF_PAGE
*&---------------------------------------------------------------------*
*
Top of page of Classical output
*----------------------------------------------------------------------*
FORM top_of_page .
WRITE: / v_prog,
/ v_date DD/MM/YYYY,
/ v_time.
ULINE.
ENDFORM.
" TOP_OF_PAGE