on 01-20-2006 11:20 AM
Hi Abapers,
I need to do multilevel bom explosion and find its corresponding stock. Is their any pgm which satisfied both the ctn.
Iam getting fm for bom explosion only.
Or atleast
To get the bom components in a single internal table
Pls help.
Thanks,
Regards
Priya
Hi again,
1. try this code (just copy paste in new program)
it will also give the STOCK.
2.
REPORT yppr_mat_avail .
*----
*29.11.2004 Amit M - Prashant - Created
*Modification Log
*30.11.2004 Amit M - Prashant - Multilevel
*30.11.2004 Amit M - Prashant - Col- Mat. Type
*----
*----
DATA
*----
TYPE-POOLS : slis.
DATA : stbd LIKE TABLE OF csxdoc ,
stbe LIKE TABLE OF csxequi ,
stbk LIKE TABLE OF csxkla ,
stbm LIKE TABLE OF csxmat ,
stbp LIKE TABLE OF csxgen ,
stbt LIKE TABLE OF csxtpl .
*----- For Alv
DATA : repid TYPE sy-repid.
DATA : fc TYPE slis_t_fieldcat_alv.
DATA : BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
level_text(15) type c,
STUFE like csxgen-stufe,
maktx LIKE makt-maktx,
mtart like mara-mtart,
menge LIKE csxgen-menge,
mnglg LIKE csxgen-menge,
labst LIKE mard-labst,
umlme LIKE mard-umlme,
insme LIKE mard-insme,
diff LIKE csxgen-menge,
END OF itab.
*----
SELECTION SCREEN
*----
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : matnr LIKE mard-matnr OBLIGATORY,
werks LIKE mard-werks OBLIGATORY,
bmeng LIKE stko-bmeng DEFAULT 1.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : diffall RADIOBUTTON GROUP g1.
SELECTION-SCREEN COMMENT 4(30) text-003 .
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : diffneg RADIOBUTTON GROUP g1.
SELECTION-SCREEN COMMENT 4(30) text-004 .
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b2.
*----
INIT
*----
INITIALIZATION.
*----- for dev. testing purpose only
matnr = '4000037'.
werks = '1007'.
bmeng = 1.
*----
END OF SELECTION
*----
END-OF-SELECTION.
CALL FUNCTION 'CS_BOM_EXPLOSION'
EXPORTING
capid = 'PP01'
emeng = bmeng
datuv = sy-datum
mtnrv = matnr
stlan = '1'
werks = werks
mehrs = 'X'
IMPORTING
TOPEQUI =
TOPMAT =
TOPTPL =
DSTST =
TABLES
stbd = stbd
stbe = stbe
stbk = stbk
stbm = stbm
stbp = stbp
stbt = stbt
EXCEPTIONS
alt_not_found = 1
call_invalid = 2
missing_authorization = 3
no_bom_found = 4
no_plant_data = 5
no_suitable_bom_found = 6
object_not_found = 7
conversion_error = 8
OTHERS = 9
.
*----
Check If Successful
IF sy-subrc = 4.
MESSAGE i999(ym02) WITH 'NO BOM FOUND'.
LEAVE LIST-PROCESSING.
ENDIF.
IF sy-subrc = 5.
MESSAGE i999(ym02) WITH 'NO PLANT DATA'.
LEAVE LIST-PROCESSING.
ENDIF.
IF sy-subrc <> 0.
MESSAGE i999(ym02) WITH 'CANNOT EXPLODE BOM WITH THESE PARAMETERS'.
LEAVE LIST-PROCESSING.
ENDIF.
*----
PUT DATA
*----
CLEAR itab.
REFRESH itab.
DATA : stbp_wa LIKE LINE OF stbp.
LOOP AT stbp INTO stbp_wa.
itab-matnr = stbp_wa-objnr.
itab-menge = stbp_wa-menge.
itab-mnglg = stbp_wa-mnglg.
itab-stufe = STBP_WA-STUFE.
*------- Get Other Fields
SELECT SINGLE SUM( labst ) SUM( umlme ) SUM( insme )
INTO (itab-labst , itab-umlme , itab-insme)
FROM mard
WHERE matnr = stbp_wa-objnr
AND werks = werks.
SELECT SINGLE maktx
FROM makt
INTO itab-maktx
WHERE matnr = itab-matnr.
SELECT SINGLE mtart
FROM mara
INTO itab-mtart
WHERE matnr = itab-matnr.
*------- Compute Values
itab-diff = ( itab-labst + itab-umlme + itab-insme ) - itab-mnglg .
*----- Append With Conditions
IF diffall = 'X'.
APPEND itab.
ENDIF.
IF diffneg = 'X' AND itab-diff < 0.
APPEND itab.
ENDIF.
ENDLOOP.
*----
SHOW IN ALV
*----
repid = sy-repid.
break mamit.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = repid
i_internal_tabname = 'ITAB'
i_inclname = repid
CHANGING
ct_fieldcat = fc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
*----
Column Names
PERFORM fc_setcol USING 'LEVEL_TEXT' 'Expl. Level'.
PERFORM fc_setcol USING 'MNGLG' 'Req. Qty'.
PERFORM fc_setcol USING 'MENGE' 'Base Qty'.
PERFORM fc_setcol USING 'DIFF' 'Availability'.
*----
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = repid
it_fieldcat = fc
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
*----
*
*----
*----
FORM FC_SETCOL
*----
FORM fc_setcol USING myfieldname myfieldtext .
DATA : fc_h TYPE slis_fieldcat_alv.
LOOP AT fc INTO fc_h WHERE fieldname = myfieldname.
fc_h-seltext_l = myfieldtext.
fc_h-ddictxt = 'L'.
MODIFY fc FROM fc_h.
ENDLOOP.
ENDFORM. "fc_setcol
regards,
amit m.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hai Vijay,
Thanks for the help.
Can u send me coding of "zpdi0022_bom_and_bomitem_class"
include file. It will be helpful for me. What u have used in the ztest program sample coding.
Regards
Nagarajan M
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi nagarajan,
1. CS_BOM_EXPLOSION
In this FM,
MEHRS = 'X' (for multi-level)
(eg is below)
CALL FUNCTION 'CS_BOM_EXPLOSION'
EXPORTING
capid = 'PP01'
emeng = bmeng
datuv = sy-datum
mtnrv = matnr
stlan = '1'
werks = werks
mehrs = 'X'
IMPORTING
TOPEQUI =
TOPMAT =
TOPTPL =
DSTST =
TABLES
stbd = stbd
stbe = stbe
stbk = stbk
stbm = stbm
stbp = stbp
stbt = stbt
EXCEPTIONS
alt_not_found = 1
call_invalid = 2
missing_authorization = 3
no_bom_found = 4
no_plant_data = 5
no_suitable_bom_found = 6
object_not_found = 7
conversion_error = 8
OTHERS = 9
2. For Stock use MARD Table
SELECT SINGLE SUM( labst ) SUM( umlme ) SUM( insme )
INTO (itab-labst , itab-umlme , itab-insme)
FROM mard
WHERE matnr = stbp_wa-objnr
AND werks = werks.
regards,
amit m.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try using CS_BOM_EXPL_MAT_V2 functional module
in this their are many paremeters which you can set for multilevel explosion.
like MEHRS is for multi level explosion upto last level
MDMPS is also for multi level explosion for phantom only.
BREMS is limited multi level explosion.
jst explore this function module and am sure it will help.
cheers
kamesh bathla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
6 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.