Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

CSAP_MAT_BOM_READ Call

former_member457420
Participant
0 Kudos

Hi all,

Have a query regarding the "CSAP_MAT_BOM_READ" call

CALL FUNCTION 'CSAP_MAT_BOM_READ'

EXPORTING

material = wa_mast-matnr(For Example : 123456)

plant = wa_mast-werks

bom_usage = wa_mast-stlan

alternative = wa_mast-stlal

valid_from = v_fdate

valid_to = v_tdate

TABLES

t_stpo = itab1

t_stko = itab2

EXCEPTIONS

error = 1

OTHERS = 2.

For Example if I pass meaterial number '123456' into the above FM as input parameter.

Does stko-BOM_NO give me 123456(The root BOM).if not which is the field to get the root meaterial number.

Does stpo-COMPONENT give me the child meaterial Number.What does stpo-BOM_NO give me.

if the above is not true,which is the stpo field which give me the child meaterial number.

Does t_stko abd t_stpo have to be passed with itab parameters.

Is that also so to understand that in stko itab there will be only 1 entry corresponding to the root BOM and

stpo itab conatins as many rows or entries as there are child componenets from the root BOM.

Thanks

P

9 REPLIES 9

Former Member
0 Kudos

Hi,

You will get the BOM number in T_STPO-BOM_NO

and in T_STPO- COMPONENT you will get the child bom number.

you have to pass data in MATERIAL,PLANT and BOM_USAGE in import tab to get all the details.

Hope it helps.

Regards

Hiren K.Chitalia

0 Kudos

Would be nice if some one could clear the following points as well...

[1]

>>You will get the BOM number in T_STPO-BOM_NO

>>and in T_STPO- COMPONENT you will get the child bom number.

Is root BOM and component BOM numbers - the root and child meaterial numbers in a BOM.

I want to get the root meaterial number and child meaterial number from these tables.How do I get it?

[2]

>>you have to pass data in MATERIAL,PLANT and BOM_USAGE in import tab to get all the details.

In the functions call under "TABLES"

TABLES

t_stpo = itab1

t_stko = itab2

we have these 2 structures.

When calling the function,Do I have to call pass these structures as well.

[3]

Is that also so to understand that in stko itab there will be only 1 entry corresponding to the root BOM and

stpo itab conatins as many rows or entries as there are child componenets from the root BOM.

0 Kudos

[3]

Is that also so to understand that in stko itab there will be only 1 entry corresponding to the root BOM and

stpo itab conatins as many rows or entries as there are child componenets from the root BOM.

STKO - Depending on number of Unit of measure you will get the number of records

STPO - You will get number of child entries

[1]

You will get the BOM number in T_STPO-BOM_NO

and in T_STPO- COMPONENT you will get the child bom number.

Is root BOM and component BOM numbers - the root and child meaterial numbers in a BOM.

I want to get the root meaterial number and child meaterial number from these tables.How do I get it?

BOM_NO is the identifier it is not same as material number.

[2]

you have to pass data in MATERIAL,PLANT and BOM_USAGE in import tab to get all the details.

In the functions call under "TABLES"

TABLES

t_stpo = itab1

t_stko = itab2

we have these 2 structures.

When calling the function,Do I have to call pass these structures as well.

In order to get the output you will have to pass this three things MATERIAL,PLANT and BOM_USAGE and you will get the output in tables t_stpo and t_stko. You dont have to pass any

data to it the Function module will return you the result in this tables.

Hope it answers your probles.

Regards

Hiren K.Chitalia

0 Kudos

Hiren,sorry for bothering you...

But from these tables How will I get the root and child meaterial numbers.

ie:The root bom meaterial and the child metarial number.....

Okay,the root meaterial number is the one which iam passing to this function as input parameter.

But from stok table,I want to get the child meaterial number.Because I want to check if a meaterial exists or not in this root BOM

OR IS this function a wrong one..

Edited by: pazzuzu on Feb 5, 2010 5:39 PM

0 Kudos

Hi,

Please check the write up for this function module

http://help.sap.com/saphelp_40b/helpdata/ru/92/58b507417011d189ec0000e81ddfac/content.htm

Will send you the working code with details that you require.

Regards,

Hiren K.Chitalia

0 Kudos

Thanks a lot man.....You made my day:)

0 Kudos

Hi,

Here is the code

T_STPO and T_STKO are empty currently data will get filled once the function modules gets executed

CALL FUNCTION 'CSAP_MAT_BOM_READ'

EXPORTING

MATERIAL = IT_MAST-MATNR -> material number

PLANT = IT_DATA-WERKS -> Plant

BOM_USAGE = '1' -> production bom

ALTERNATIVE = '01' -> Alternative BOM

  • VALID_FROM =

  • VALID_TO =

  • CHANGE_NO =

  • REVISION_LEVEL =

  • FL_DOC_LINKS =

  • FL_DMU_TMX =

  • IMPORTING

  • FL_WARNING =

TABLES

T_STPO = T_STPO -> BOM items (Contains multiple lines)

T_STKO = T_STKO -> BOM headers (contains single line)

  • T_DEP_DATA =

  • T_DEP_DESCR =

  • T_DEP_ORDER =

  • T_DEP_SOURCE =

  • T_DEP_DOC =

  • T_DOC_LINK =

  • T_DMU_TMX =

  • T_LTX_LINE =

  • T_STPU =

EXCEPTIONS

ERROR = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LOOP AT T_STPO.

CLEAR IT_MAST1.

MOVE IT_MAST-STLNR TO IT_MAST1-STLNR. -> BOM

MOVE IT_MAST-MATNR TO IT_MAST1-MATNR. -> Material Number

IT_MAST1-IDNRK = T_STPO-COMPONENT . -> Plant

CLEAR QTY.

QTY = T_STPO-COMP_QTY. -> Component Quantity

IT_MAST1-MENGE = QTY.

MOVE T_STPO-COMP_UNIT TO IT_MAST1-MEINS. - > Component unit of measure

READ TABLE T_STKO INDEX 1.

IF SY-SUBRC = 0.

IT_MAST1-BASE_QUAN = T_STKO-BASE_QUAN. -> Base quantity

ENDIF.

APPEND IT_MAST1.

CLEAR IT_MAST1.

ENDLOOP.

Hope this solves your query on what fileds contain which data.

If u need more details please let me know.

Regards

Hiren K.Chitalia

0 Kudos

Hi,

Did u tried the code that i have posted.

Is your problem solved ???

Regards

Hiren K.Chitalia

Edited by: Hiren Chitalia on Feb 8, 2010 1:22 PM

0 Kudos

Tried it.It Worked!!!!

Thanks a lot hiran........