Skip to Content
0
Former Member
Feb 16, 2007 at 09:20 AM

how to fetch the components operation and workcenter. pp report

247 Views

Hi experts,

this report is for pp module ,routing details,in our program

only give the ouput of the header materials operation and workcenter

but not get into components.

before we clariy if the materilas is e or x -


check the plpo operation and crhd workcter

or else

if the material is f -


get the vendor details---- i ll not using this onle

before we need to adopt it only e or x only

TABLES : MAST,MARC,CRHD,PLPO.

TYPES : BEGIN OF IT_FINAL,

POSNR LIKE STPOX-POSNR,

IDNRK LIKE STPOX-IDNRK,

OJTXP LIKE STPOX-OJTXP,

MENGE LIKE STPOX-MENGE,

MEINS LIKE STPOX-MEINS,

VORNR LIKE PLPO-VORNR,

ARBID LIKE PLPO-ARBID,

OBJTY LIKE PLPO-OBJTY,

LTXA1 LIKE PLPO-LTXA1,

VGE01 LIKE PLPO-VGE01,

VGW01 LIKE PLPO-VGW01,

VGW02 LIKE PLPO-VGW02,

ARBPL LIKE CRHD-ARBPL,

  • LIFNR LIKE EINA-LIFNR,

  • INFNR LIKE EINA-INFNR,

END OF IT_FINAL.

DATA : BEGIN OF CRHD_IDEL OCCURS 1000,

OBJID LIKE CRHD-OBJID,

ARBPL LIKE CRHD-ARBPL,

END OF CRHD_IDEL.

DATA: BEGIN OF ISTPO OCCURS 1000.

INCLUDE STRUCTURE STPOX.

DATA: END OF ISTPO.

DATA: BEGIN OF MATCAT OCCURS 1000.

INCLUDE STRUCTURE CSCMAT.

DATA: END OF MATCAT.

DATA : BEGIN OF ITAB OCCURS 0,

MATNR LIKE MAST-MATNR,

WERKS LIKE MAST-WERKS,

END OF ITAB.

SELECT-OPTIONS : P_MATNR FOR MAST-MATNR.

PARAMETERS : P_WERKS TYPE MAST-WERKS.

DATA : IT_FINAL_IDEL TYPE STANDARD TABLE OF IT_FINAL

WITH HEADER LINE INITIAL SIZE 100 WITH DEFAULT KEY.

DATA : IT_CRHD_IDEL LIKE CRHD OCCURS 100 WITH HEADER LINE.

DATA: IT_STB LIKE ISTPO OCCURS 0 WITH HEADER LINE.

DATA : IT_MAPL_IDEL LIKE MAPL OCCURS 100 WITH HEADER LINE.

DATA :IT_ITAB_IDEL LIKE MARC OCCURS 100 WITH HEADER LINE.

DATA : IT_PLPO_IDEL LIKE PLPO OCCURS 100 WITH HEADER LINE.

SELECT MATNR WERKS FROM MAST INTO TABLE ITAB

WHERE MATNR IN P_MATNR AND WERKS = P_WERKS.

START-OF-SELECTION.

CLEAR ISTPO. REFRESH ISTPO.

LOOP AT ITAB.

CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'

EXPORTING

CAPID = 'PP01'

MEHRS = 'X'

MMAPS = ' '

MDMPS = ' '

  • BREMS = 'X'

  • DISMM = ' '

  • LIFNR = ' '

  • WEBAZ = ' '

DATUV = SY-DATUM

MTNRV = ITAB-MATNR

WERKS = P_WERKS

EMENG = '1'

STKKZ = ' '

FBSTP = ' '

FTREL = ' '

IMPORTING

TOPMAT = W_TOPMAT

  • DSTST = DSTST

TABLES

STB = ISTPO

MATCAT = 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

OTHERS = 8.

WRITE: / W_TOPMAT-MATNR UNDER TEXT-H00 COLOR COL_HEADING,

W_TOPMAT-MAKTX UNDER TEXT-H01 COLOR COL_HEADING.

SELECT MATNR WERKS OBJID BESKZ FROM MARC INTO CORRESPONDING FIELDS OF TABLE IT_ITAB_IDEL

WHERE MATNR = ITAB-MATNR AND BESKZ = 'X' OR BESKZ = 'E' OR BESKZ = 'F'.

SELECT MATNR WERKS PLNTY PLNNR LIFNR FROM MAPL INTO CORRESPONDING FIELDS OF TABLE IT_MAPL_IDEL

WHERE MATNR = ITAB-MATNR AND

WERKS = 'IN01' .

SELECT PLNTY PLNNR VORNR ARBID OBJTY LTXA1 VGE01 VGW01 VGW02 PLIFZ FROM PLPO INTO CORRESPONDING FIELDS OF TABLE IT_PLPO_IDEL

FOR ALL ENTRIES IN IT_MAPL_IDEL

WHERE PLNTY = IT_MAPL_IDEL-PLNTY AND

PLNNR = IT_MAPL_IDEL-PLNNR AND

WERKS = 'IN01' AND ARBID <> 0.

LOOP AT ISTPO.

IT_FINAL_IDEL-POSNR = ISTPO-POSNR.

IT_FINAL_IDEL-IDNRK = ISTPO-IDNRK.

IT_FINAL_IDEL-OJTXP = ISTPO-OJTXP.

IT_FINAL_IDEL-MENGE = ISTPO-MENGE.

IT_FINAL_IDEL-MEINS = ISTPO-MEINS.

LOOP AT IT_PLPO_IDEL.

IT_FINAL_IDEL-VORNR = IT_PLPO_IDEL-VORNR.

IT_FINAL_IDEL-ARBID = IT_PLPO_IDEL-ARBID.

IT_FINAL_IDEL-OBJTY = IT_PLPO_IDEL-OBJTY.

IT_FINAL_IDEL-LTXA1 = IT_PLPO_IDEL-LTXA1.

IT_FINAL_IDEL-VGE01 = IT_PLPO_IDEL-VGE01.

IT_FINAL_IDEL-VGW01 = IT_PLPO_IDEL-VGW01.

IT_FINAL_IDEL-VGW02 = IT_PLPO_IDEL-VGW02.

ENDLOOP.

READ TABLE IT_CRHD_IDEL WITH KEY OBJID = IT_PLPO_IDEL-ARBID.

IT_FINAL_IDEL-ARBPL = IT_CRHD_IDEL-ARBPL.

APPEND IT_FINAL_IDEL.

CLEAR : IT_FINAL_IDEL,IT_PLPO_IDEL,IT_CRHD_IDEL,ISTPO.

ENDLOOP.

WRITE :/6 W_TOPMAT-MATNR, 25 W_TOPMAT-MAKTX.

LOOP AT IT_FINAL_IDEL.

WRITE :/ IT_FINAL_IDEL-POSNR,

IT_FINAL_IDEL-IDNRK,

IT_FINAL_IDEL-OJTXP,

IT_FINAL_IDEL-MENGE,

IT_FINAL_IDEL-MEINS,

IT_FINAL_IDEL-VORNR,

IT_FINAL_IDEL-ARBID,

IT_FINAL_IDEL-OBJTY,

IT_FINAL_IDEL-LTXA1,

IT_FINAL_IDEL-VGE01,

IT_FINAL_IDEL-VGW01,

IT_FINAL_IDEL-VGW02,

IT_FINAL_IDEL-ARBPL.

ENDLOOP.

REFRESH IT_FINAL_IDEL.

SKIP.

ENDLOOP.

regards

ds