*&---------------------------------------------------------------------*
*& Report ZVVF_MMRO_BOM_LISTING *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
*----------------------------------------------------------------------*
* Report gives the BOM listing for the selected items
* Standard BOM report CS03 and CS13 does not have the features for
* range of items
*----------------------------------------------------------------------*
REPORT ZVVF_MMRO_BOM_LISTING
NO STANDARD PAGE HEADING
LINE-SIZE 106
LINE-COUNT 65(0).
TABLES : stpo, stko, mast, makt.
DATA : BEGIN OF i_mast OCCURS 0,
matnr LIKE mast-matnr,
werks LIKE mast-werks,
stlan LIKE mast-stlan,
stlnr LIKE stko-stlnr,
stlal LIKE mast-stlal,
END OF i_mast.
DATA : BEGIN OF i_stko OCCURS 0,
stlty LIKE stko-stlty,
stlnr LIKE stko-stlnr,
stlal LIKE stko-stlal,
stkoz LIKE stko-stkoz,
datuv LIKE stko-datuv,
bmeng like stko-bmeng,
bmein like stko-bmein,
END OF i_stko.
DATA : BEGIN OF i_stpo OCCURS 0,
stlty LIKE stko-stlty,
stlnr LIKE stko-stlnr,
stlal LIKE stko-stlal,
stkoz LIKE stko-stkoz,
idnrk LIKE stpo-idnrk,
meins LIKE stpo-meins,
menge LIKE stpo-menge,
AUSCH like stpo-ausch,
AVOAU like stpo-AVOAU,
END OF i_stpo.
*-- Select options
SELECT-OPTIONS : s_matnr FOR mast-matnr.
PARAMETER: p_werks LIKE t001w-werks,
p_stlan LIKE mast-stlan DEFAULT '1',
p_stlal LIKE mast-stlal DEFAULT '01',
p_stlty LIKE stko-stlty DEFAULT 'M'.
START-OF-SELECTION.
*-- BOM references are maintained in MAST is the table in wh
SELECT * FROM mast
INTO CORRESPONDING FIELDS
OF TABLE i_mast
WHERE matnr IN s_matnr
AND werks = p_werks
AND stlan = p_stlan
AND stlal = p_stlal.
IF sy-subrc NE 0.
MESSAGE i000(zfi) WITH 'Invalid Selection.. No records retrieved'.
CHECK sy-subrc EQ 0.
ENDIF.
DATA: v_maktx LIKE makt-maktx,
v_name1 LIKE t001w-name1.
LOOP AT i_mast.
SELECT * FROM stko
INTO CORRESPONDING FIELDS
OF TABLE i_stko
WHERE stlty = p_stlty
AND stlnr = i_mast-stlnr
AND stlal = i_mast-stlal.
CHECK sy-subrc EQ 0.
SELECT * FROM stpo
INTO CORRESPONDING FIELDS
OF TABLE i_stpo
WHERE stlty = p_stlty
AND stlnr = i_mast-stlnr.
CHECK sy-subrc EQ 0.
LOOP AT i_stko.
CLEAR : v_maktx.
SELECT SINGLE maktx
INTO (v_maktx)
FROM makt
WHERE matnr = i_mast-matnr.
CLEAR: v_name1.
SELECT SINGLE name1
INTO (v_name1)
FROM t001w
WHERE werks = i_mast-werks.
WRITE : / 'Material :' , i_mast-matnr , ' ', v_maktx.
WRITE : / 'Plant :' , i_mast-werks , ' ', v_name1.
write : / 'Base Qty :' , i_stko-bmeng, ' ', i_stko-bmein.
WRITE : / 'Valid from : ' , i_stko-datuv.
ULINE.
LOOP AT i_stpo WHERE stlty = i_stko-stlty
AND stlnr = i_stko-stlnr.
CLEAR : v_maktx.
SELECT SINGLE maktx
INTO (v_maktx)
FROM makt
WHERE matnr = i_stpo-idnrk.
WRITE :/1 sy-vline,
2 i_stpo-idnrk,
21 sy-vline,
22 v_maktx(30),
52 sy-vline,
53 i_stpo-meins,
58 sy-vline,
59 i_stpo-menge,
76 sy-vline,
77 i_stpo-ausch,
91 sy-vline,
92 i_stpo-AVOAU,
106 sy-vline.
ENDLOOP.
ULINE.
skip 2.
ENDLOOP.
endloop.
END-OF-SELECTION.
top-of-page.
write :/ 'Date : ' , sy-datum.
write :/ 'Time : ' , sy-uzeit.
uline.
write :/1 sy-vline,
2 'Material',
21 sy-vline,
22 'Description',
52 sy-vline,
53 'UOM',
58 sy-vline,
59 'Quantity',
76 sy-vline,
77 'Comp Scrap%',
91 sy-vline,
92 'Oper Scrap%',
106 sy-vline.
uline.
No comments:
Post a Comment