Urgent

Question:
Hello all,
i want to pull out the data of BOM TABLES using the matnr from MARA
up on checking some conditions at mara.
i could n't get the connection between mara and stko (BOM ) tables
can any one help on this issue. ( i used the function mod cs_bom_expl_mat_v2 apart from this i need some other feilds which are not given by this funct mod )
thanx in advance .
sr.
Answer:
Hi,
check the follwing subroutine. It might help you a bit.
Note: Change the subroutine and values which are indicated in BOLD as you required.
FORM BOM_EXPLODE_DETAIL
USING MATNR LIKE PBIM-MATNR.
*Material to BOM Link
SELECT * FROM MAST INTO CORRESPONDING FIELDS OF IMAST WHERE
MATNR = MATNR AND
WERKS = '1000' AND
STLAL EQ '01'. " ALTERNATIVE BOM
*BOM Header
SELECT SINGLE * FROM STKO INTO
CORRESPONDING FIELDS OF ISTKO WHERE
STLNR = IMAST-STLNR AND " BOM NUMBER
STLAL = IMAST-STLAL AND " ALTERNATIVE BOM
STLTY = 'M'. " BOM category - MATERIAL BOM
*BOMs - Item Selection
SELECT * FROM STAS INTO
CORRESPONDING FIELDS OF ISTAS WHERE
STLNR = IMAST-STLNR AND " BOM NUMBER
STLAL = IMAST-STLAL AND " ALTERNATIVE BOM
STLTY = 'M'. " BOM category - MATERIAL BOM
*BOM item
SELECT SINGLE IDNRK MENGE MEINS AUSCH FROM STPO
INTO CORRESPONDING FIELDS OF ISTPO WHERE
STLNR = IMAST-STLNR AND " BOM NUMBER
STLKN = ISTAS-STLKN AND " BOM item node number
STLTY = 'M'.
Put data into internal table ITAB
APPEND ITAB.
CLEAR ITAB.
ENDSELECT.
ENDSELECT.
ENDFORM.
Cheers
DSC
Answer:
Hi,
forgot to paste the crucial code for internal table declarations and recusrions.
Note: this is a pseudo code which doesn't follow coding standards. change it as needed.
DATA IMAST LIKE MAST OCCURS 0 WITH HEADER LINE.
DATA ISTAS LIKE STAS OCCURS 0 WITH HEADER LINE.
DATA ISTKO LIKE STKO OCCURS 0 WITH HEADER LINE.
DATA ISTPO LIKE STPO OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF ITAB OCCURS 0 ,
MATNR LIKE PBIM-MATNR,
IDNRK LIKE STPO-IDNRK,
END OF ITAB.
* BOM Explosion
PERFORM BOM_EXPLODE_DETAIL USING MATNR.
LOOP AT ITAB.
* BOM Explosion RECURSION
PERFORM BOM_EXPLODE_DETAIL USING IDNRK.
ENDLOOP.
replace "Put data into internal table ITAB" by the following two lines of code
ITAB-MATNR = MATNR.
ITAB-IDNRK = ISTPO-IDNRK.
Cheers
DSC
Answer:
Hi,
as u needed before putting data into internal table
SELECT the required data FROM MARA WHERE
MATNR = ISTPO-IDNRK.
and check for the conditions as needed using IF control stmt.
Cheers
DSC

More Articles:

LSMW?
Debugging from system to another?
Using Join for three tables - problems?
ale edi idocs?
Relation between T-code and program?
'VRM_SET_VALUES' is KILLING me!!!!?