Application Development and Automation 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: 
Read only

Recursive function call 'CABM_READ_BOM'

Former Member
0 Likes
1,044

Hi,

I need to do a recursive call to 'CABM_READ_BOM' using different matnr each time. Data will be stored in i_exp_bom_head and i_exp_bom_item. Since this is a recursive call to the same routine and iterations depend on the level of BOM how can I keep track of the internal tables returned by its level?

FORM READ_BOM using p_matnr.

CALL FUNCTION 'CABM_READ_BOM'

EXPORTING

i_matnr = p_matnr

i_werks = i_bom_select-werks

i_vbeln = i_bom_select-vbeln

i_vbpos = i_bom_select-posnr

i_stlal = i_bom_select-stlal

i_stlan = i_bom_select-stlan

i_datuv = i_bom_select-erdat

TABLES

exp_bom_data = i_exp_bom_head

exp_itm_data = i_exp_bom_item

EXCEPTIONS

no_record_found = 1

OTHERS = 2.

LOOP AT i_exp_bom_item WHERE postp = 'N'.

PERFORM READ_BOM using i_exp_bom_item-idnrk.

ENDLOOP.

ENDFORM.

Points will be awarded.

Thanks!

3 REPLIES 3
Read only

Former Member
0 Likes
790

Hi,

Why dont you try FM: PM_HIERARCHY_CALL_BOM_MARA?

I dont know if this would satisfy your requirement.

Regards

Subramanian

Read only

0 Likes
790

Hi Subramanian,

Thank you for your prompt reply.

I'm trying to create master BOM and sub BOM depending on how many levels it is.

IF i_exp_bom_item-POSTP = 'N' then I call the function module again to create sub BOM. I will call the function module recursively until i_exp_bom_item-POSTP <> 'N'. That will be the lowest level.

Message was edited by:

Alex Nguyen

Read only

0 Likes
790

Hi Alex,

Pls share the solution for your problem.

I am also facing the same problem.

Thanks,

SAtendra