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

Multilevel BOM explosion

Former Member
0 Likes
3,509

Hello experts,

I am at present using FM 'CS_BOM_EXPLOSION' but its for single level BOM explosion now requirement is for muti level BOM explosion for this I had used FM 'CS_BOM_EXPL_MAT_V2'.

But I need to display components or items in my report which I am getting in field OBJNR of STBP table returned through FM 'CS_BOM_EXPLOSION'.

The problem is if I am using FM 'CS_BOM_EXPL_MAT_V2' then I am getting component description in field OJTXP but I need object number(OBJNR).

So, Is there any way that I can achieve muti-level BOM through FM 'CS_BOM_EXPLOSION' or How should I get OBJNR

by using FM 'CS_BOM_EXPL_MAT_V2'.

Please help.

1 ACCEPTED SOLUTION
Read only

roberto_vacca2
Active Contributor
0 Likes
2,253

Hi...

Did you try to create a custom recursive function to read BOM? You should pass matnr, level, plant and status as actual parameters.. When you reach the deepest level you set status to false and recursevely come back.. This is the best way I think to reach your target... If you want I can pass you some code...

Hope to help

9 REPLIES 9
Read only

roberto_vacca2
Active Contributor
0 Likes
2,254

Hi...

Did you try to create a custom recursive function to read BOM? You should pass matnr, level, plant and status as actual parameters.. When you reach the deepest level you set status to false and recursevely come back.. This is the best way I think to reach your target... If you want I can pass you some code...

Hope to help

Read only

0 Likes
2,253

Thanks for the earliest reply, I will appreciate If you Share some code...

Regards,

Shubh

Read only

roberto_vacca2
Active Contributor
0 Likes
2,253

Hi...

I can send you this code but you have to adapt it to your needs...

Your form should have this kind of declaration ... fdeep in first launch is 0 ...


form explode_bom using value(fdeep)
                       value(fmatnr)
                       value(fplant)
                       value(fqtbase)  "optional
                    changing fstatus.

Inside your form you have to do all kinds of control you need , to bypass for example types of BOM you don't need or kind of materials you don't want...

You have to keep local_status for local form memory status and

work_status to pass to your sub form call...

like this...



   local_status = ctrue.

  work_status = ctrue.

  w_deep = fdeep + 1.

  perform read_diba tables it_mast   "It will contain data for further exploding
                           using fmatnr
                           changing no_diba   "No diba exception
                                          prs_altern "Alternative BOM if you want to check it
                                         w_tdiba.   "BOM Type


if no_diba eq 'X'.

fstatus = cfalse.
EXIT.
ELSE.


* DO what you want

* Read BOM positions and data
  perform read_bom tables it_mast
                          it_stko
                          it_stpo.


 loop at it_stpo.

      perform explode_bom using w_deep
                                it_stpo-idnrk
                                fplant
                                tmp_qtbase
                       changing work_status.

if work_status eq cfalse.
  local_status = cfalse.
endif.


endloop.

  if local_status eq ctrue.
    fstatus = ctrue.
  else.

    fstatus = cfalse.
  endif.


ENDIF.

I hope this can help somehow...

Read only

0 Likes
2,253

Thanx This is helpfull for me.

But Still I have one doubt,

As in FM 'CS_BOM_EXPLOSION' there is export parameter VBELN (sales order no.) which i am passing in my FM.

But now I want to use FM 'CS_BOM_EXPL_MAT_V2' . In this function module I didn't found any sales order no. field so how should I design Logic according to sales order no. ??

Read only

roberto_vacca2
Active Contributor
0 Likes
2,253

Sales order have materials in positions...you have to study BOMs from material, not from sales order..

CS_BOM_EXPL_MAT_V2 is for material and CS_BOM_EXPLOSION is a general BOM explosion

You have to create a list of material of your sale order and study your BOM from this point... for every sale order you explode recoursevely its positions....

try this...

Read only

sjeevan
Active Contributor
0 Likes
2,253

Why don't you make a copy of standard program RCS12001?

Read only

Former Member
0 Likes
2,253

Solved.

used the FM 'CS_BOM_EXPL_KND_V1' for multi level BOM

Read only

Former Member
0 Likes
2,253

actually you can use CS_BOM_EXPLOSION as well for multilevel explosion. just make sure you set Parameter MEHRS = 'X' and BREMS = space.

Read only

Former Member
0 Likes
2,253

@florian:

You are right FM 'CS_BOM_EXPLOSION' is working as multilevel BOM explosion after setting the fields MEHRS = 'X' and BREMS = ' ' .

Thank you for suggestion.

Edited by: shubh_ag on Sep 22, 2011 3:08 PM