DATA : capid LIKE tc04-capid,
datuv LIKE stko-datuv,
emeng LIKE stko-bmeng,
mehrs LIKE csdata-xfeld,
mtnrv LIKE mara-matnr,
stlal LIKE stko-stlal,
stpst LIKE stpox-stufe,
werks LIKE marc-werks.
DATA : istb LIKE stpox OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF ibod OCCURS 0,
stufe LIKE stpox-stufe,
idnrk LIKE stpox-idnrk,
bismt LIKE mara-bismt,
ojtxp LIKE stpox-ojtxp,
menge LIKE stpox-menge,
meins LIKE stpox-meins,
mnglg LIKE stpox-mnglg,
meins1 LIKE stpox-meins,
*lgort LIKE mard-lgort,
*labst LIKE mard-labst,
*insme LIKE mard-insme,
*umlme LIKE mard-umlme,
wesbs LIKE ekbe-wesbs,
dispo LIKE marc-dispo,
dsnam LIKE t024d-dsnam,
END OF ibod.
DATA : BEGIN OF imara OCCURS 0,
matnr LIKE mara-matnr,
bismt LIKE mara-bismt,
meins LIKE mara-meins,
END OF imara.
DATA: BEGIN OF idis OCCURS 0,
matnr LIKE marc-matnr,
dispo LIKE marc-dispo,
dsnam LIKE t024d-dsnam,
END OF idis.
DATA: BEGIN OF xtab2 OCCURS 10,
werks LIKE ekpo-werks,
matnr LIKE ekpo-matnr,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
wesbs LIKE ekbe-wesbs,
wesb2 LIKE ekbe-wesbs,
meinh LIKE ekpo-meins,
END OF xtab2.
DATA : total LIKE ekbe-wesbs.
*data: begin of i_werks occurs 0,
- werks like marc-werks,
- end of i_werks.
RANGES : i_werks FOR marc-werks.
DATA : BEGIN OF imard OCCURS 0,
matnr LIKE mard-matnr,
werks LIKE mard-werks,
lgort LIKE mard-lgort,
labst LIKE mard-labst,
insme LIKE mard-insme,
umlme LIKE mard-umlme,
END OF imard.
DATA : labst LIKE mard-labst,
insme LIKE mard-insme,
umlme LIKE mard-umlme.
SELECTION-SCREEN BEGIN OF BLOCK v1 WITH FRAME TITLE text-001.
PARAMETERS : p_werks LIKE marc-werks OBLIGATORY ,
p_mtnrv LIKE mara-matnr OBLIGATORY ,
p_stlal LIKE stko-stlal OBLIGATORY,
p_emeng LIKE stko-bmeng OBLIGATORY,
p_stpst LIKE stpox-stufe.
SELECTION-SCREEN END OF BLOCK v1.
capid = 'PP01'.
datuv = sy-datum.
emeng = p_emeng.
mehrs = 'X'.
mtnrv = p_mtnrv.
stlal = p_stlal.
stpst = p_stpst.
werks = p_werks.
i_werks-low = werks.
i_werks-sign = 'I'.
i_werks-option = 'EQ'.
APPEND i_werks.
CLEAR i_werks.
*skip.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
- FTREL = ' '
- ALEKZ = ' '
- ALTVO = ' '
- AUFSW = ' '
- AUMGB = ' '
- AUMNG = 0
- AUSKZ = ' '
- AMIND = ' '
- BAGRP = ' '
- BEIKZ = ' '
- BESSL = ' '
- BGIXO = ' '
- BREMS = ' '
- CHLST = ' '
- COSPR = ' '
- CUOBJ = 000000000000000
- CUOVS = 0
- CUOLS = ' '
- DELNL = ' '
- DRLDT = ' '
- EHNDL = ' '
- ERSKZ = ' '
- ERSSL = ' '
- FBSTP = ' '
- KNFBA = ' '
- KSBVO = ' '
- MBWLS = ' '
- MKTLS = 'X'
- MDMPS = ' '
- MKMAT = ' '
- MMAPS = ' '
- SALWW = ' '
- SPLWW = ' '
- MMORY = ' '
- NLINK = ' '
- POSTP = ' '
- RNDKZ = ' '
- RVREL = ' '
- SANFR = ' '
- SANIN = ' '
- SANKA = ' '
- SANKO = ' '
- SANVS = ' '
- SCHGT = ' '
- STKKZ = ' '
- STLAN = ' '
- SVWVO = 'X'
- NORVL = ' '
- MDNOT = ' '
- PANOT = ' '
- QVERW = ' '
- VERID = ' '
- VRSVO = 'X'
- IMPORTING
- TOPMAT =
- DSTST =
stb = istb
- MATCAT =
- EXCEPTIONS
- ALT_NOT_FOUND = 1
- CALL_INVALID = 2
- MATERIAL_NOT_FOUND = 3
- MISSING_AUTHORIZATION = 4
- NO_BOM_FOUND = 5
- NO_PLANT_DATA = 6
- NO_SUITABLE_BOM_FOUND = 7
- CONVERSION_ERROR = 8
- OTHERS = 9
IF sy-subrc 0.
- MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
- WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
LOOP AT istb.
IF istb-postp = 'L'.
ibod-stufe = istb-stufe.
ibod-idnrk = istb-idnrk.
ibod-ojtxp = istb-ojtxp.
ibod-menge = istb-menge.
ibod-meins = istb-meins.
ibod-mnglg = istb-mnglg.
APPEND ibod.
CLEAR ibod.
ENDIF.
ENDLOOP.
SELECT matnr bismt meins INTO TABLE imara FROM mara FOR ALL ENTRIES IN ibod
WHERE matnr = ibod-idnrk.
SELECT a~matnr a~dispo b~dsnam INTO TABLE idis FROM marc AS a INNER JOIN t024d AS b
ON a~dispo = b~dispo FOR ALL ENTRIES IN ibod WHERE matnr = ibod-idnrk.
SELECT matnr werks lgort labst insme umlme INTO TABLE imard FROM mard
FOR ALL ENTRIES IN ibod WHERE matnr = ibod-idnrk AND werks EQ p_werks
.
LOOP AT ibod.
READ TABLE imara WITH KEY matnr = ibod-idnrk.
IF sy-subrc EQ 0.
ibod-bismt = imara-bismt.
ibod-meins1 = imara-meins.
ENDIF.
READ TABLE idis WITH KEY matnr = ibod-idnrk.
IF sy-subrc EQ 0.
ibod-dispo = idis-dispo.
ibod-dsnam = idis-dsnam.
ENDIF.
CALL FUNCTION 'MB_SELECT_GR_BLOCKED_STOCK'
EXPORTING
- X_KZVBR = ' '
x_meins = ibod-meins
- X_KZWSO = ' '
- X_NOVBR = ' '
xtab2 = xtab2
xwerks = i_werks
.
LOOP AT xtab2.
total = total + xtab2-wesbs.
ENDLOOP.
ibod-wesbs = total.
CLEAR xtab2[].
MODIFY ibod.
CLEAR : ibod,imara,idis,total,xtab2.
ENDLOOP.
CLEAR imard.
LOOP AT ibod.
WRITE :/03 sy-tabix LEFT-JUSTIFIED,12 ibod-stufe LEFT-JUSTIFIED,
18 ibod-idnrk LEFT-JUSTIFIED,37 ibod-bismt LEFT-JUSTIFIED ,57 ibod-ojtxp ,
99 ibod-menge LEFT-JUSTIFIED ,118 ibod-meins, 123 ibod-mnglg LEFT-JUSTIFIED,
142 ibod-meins1, 149 ibod-dispo, 157 ibod-dsnam.
WRITE :/10 sy-uline(90) .
WRITE :/10 '|',11 'Stg Loc',18 '|', 19 'Unres Use Stk',37 '|',39 'QAI Stk ',58 '|', 59 'Trans Loc Stk',
78 '|',79 'GR Blck Stk' , 99 '|'.
WRITE :/10 sy-uline(90) .
LOOP AT imard WHERE matnr EQ ibod-idnrk.
IF imard-labst GT 0 OR imard-insme GT 0 OR imard-umlme GT 0.
WRITE :/10 '|', 11 imard-lgort,18 '|', 19 imard-labst LEFT-JUSTIFIED ,37 '|',
39 imard-insme LEFT-JUSTIFIED,58 '|', 59 imard-umlme LEFT-JUSTIFIED,78 '|', 99 '|'.
ENDIF.
labst = labst + imard-labst.
insme = insme + imard-insme.
umlme = umlme + imard-umlme.
ENDLOOP.
WRITE :/10 sy-uline(90) .
WRITE :/10 '|', 11 'Total',18 '|', 19 labst LEFT-JUSTIFIED ,37 '|',39 insme LEFT-JUSTIFIED,
58 '|', 59 umlme LEFT-JUSTIFIED,78 '|',79 ibod-wesbs LEFT-JUSTIFIED, 99 '|'.
CLEAR: labst,insme,umlme,ibod-wesbs.
WRITE :/10 sy-uline(90) .
ENDLOOP.
ULINE.
TOP-OF-PAGE.
Select single maktx from makt into makt-maktx where matnr eq p_mtnrv.
WRITE :/40 'Bill Of Material - Stock Position'.
WRITE :/40 '*********************************'.
WRITE:/.
WRITE:/01 'Product Code : ', mtnrv,30 '(',makt-maktx,')', 'Plant : ',werks, 100 'Alternative BOM : ',stlal,125 'Req Qty : ',
emeng,160 'Level : ' , stpst.
ULINE.
WRITE:/ '|', 'Sl.No',9 '|',11 'Level','|', 23 'Item Code',36 '|',41 'Old Code',56 '|' ,
70 'Description',98 '|',104 'BOM Qty ',117 '|', 118 'UOM', 122 '|', 127 'Need Qty', 140 '|',
141 'UOM' ,146 '|',147 'MRP Code' ,156 '|', 160 'MRP Con Name',175 '|'.
*write:/ '|', 'No',6 '|'.
RELATED POST
ELIMINATION OF DUPLICATE ENTRIES IN INTERNAL TABLE SAMPLE CODE
EVENTS IN LISTs syntax for sap abap
EVENTS IN LISTS PART TWO syntax for sap abap
EVENTS ON SELECTION SCREEN PART ONE syntax for sap abap
EVENTS ON SELECTION SCREEN PART TWO syntax for sap abap
AUTHORITY CHECK syntax for sap abap
No comments:
Post a Comment