2006 Nov 24 7:58 AM
HI all,
while creating BOM with subitem by 'BAPI_MATERIAL_BOM_GROUP_CREATE' ,
bom is creating in sap but only one sub-item is taking for each item.& that to one & same subitem is repetating for each item.
plz suggest, where i am doing mistake?
my upload file structure is like
FINISHED GOOD: BAPIBOMFG1
ITEM ITEM CATEGORY PART NUM QTY LOCATION
0010 L BAPIBOMRW1 2 c1,c2
0020 L BAPIBOMRW2 5 B1,B2,B3,B4,B5
0030 L BAPIBOMRW3 3 q1,q2,q3
0040 L BAPIBOMRW4 6 x1,x2,x3,x4,x5,x6,x7
now BOM is creating but for each item(10 0r 20 0r 30), c1 is stored as the location.
& the quantity for each item is comming as 1 in CS03 after cration of BOM.
but i am passing different quantities to item table of that BAPI?
can u plz suggest why i am getting this type of result?
Regards
pabitra
2006 Nov 24 9:31 AM
please check if u have cleared the work areas used for the subitems after each iteration in the loop.
HI all,
while creating BOM with subitem by 'BAPI_MATERIAL_BOM_GROUP_CREATE' ,
bom is creating in sap but only one sub-item is taking for each item.& that to one & same subitem is repetating for each item.
plz suggest, where i am doing mistake?
my upload file structure is like
FINISHED GOOD: BAPIBOMFG1
ITEM ITEM CATEGORY PART NUM QTY LOCATION
0010 L BAPIBOMRW1 2 c1,c2
0020 L BAPIBOMRW2 5 B1,B2,B3,B4,B5
0030 L BAPIBOMRW3 3 q1,q2,q3
0040 L BAPIBOMRW4 6 x1,x2,x3,x4,x5,x6,x7
now BOM is creating but for each item(10 0r 20 0r 30), c1 is stored as the location.
& the quantity for each item is comming as 1 in CS03 after cration of BOM.
but i am passing different quantities to item table of that BAPI?
can u plz suggest why i am getting this type of result?
Regards
pabitra
2006 Nov 24 9:31 AM
please check if u have cleared the work areas used for the subitems after each iteration in the loop.
2006 Nov 27 3:25 AM
Hi arun,
Thanks for ur help.i cleared the work area after each iteration of sub-items but it is still having the same problem.i am giving my coding below.plz suggest if i am doing any mistake.
Regards
pabi
REPORT ZTEST_CHIN message-id 01.
This code will create a material BoM for the material
MAINMATERIAL with the components COMPON1 and COMPON2.
Data Declaration
DATA:
it_bomgroup LIKE bapi1080_bgr_c OCCURS 0 WITH HEADER LINE,
it_variants LIKE bapi1080_bom_c OCCURS 0 WITH HEADER LINE,
it_items LIKE bapi1080_itm_c OCCURS 0 WITH HEADER LINE,
it_matrel LIKE bapi1080_mbm_c OCCURS 0 WITH HEADER LINE,
it_itemas LIKE bapi1080_rel_itm_bom_c OCCURS 0 WITH HEADER LINE,
it_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
it_subitems LIKE bapi1080_sui_c OCCURS 0 WITH HEADER LINE,
it_subitemas LIKE BAPI1080_REL_SUI_ITM_C OCCURS 0 WITH HEADER LINE.
Fill the data
Material BoM Group Header Data
CLEAR it_bomgroup.
it_bomgroup-bom_group_identification = 'BAPI_SMP_COL1'.
it_bomgroup-object_type = 'BGR'.
it_bomgroup-object_id = 'SIMPLE1'.
it_bomgroup-bom_usage = '1'. " YOU COULD CHANGE THE BOM USAGE TO YOUR
it_bomgroup-ltxt_lang = sy-langu.
it_bomgroup-technical_type = ' '.
it_bomgroup-bom_text = 'Simple BoM - FM'.
APPEND it_bomgroup.
Header Details of the different variants
CLEAR it_variants.
it_variants-bom_group_identification = 'BAPI_SMP_COL1'.
it_variants-object_type = 'BOM'.
it_variants-object_id = 'SIMPLE1'.
it_variants-alternative_bom = '01'.
it_variants-bom_status = '01'.
it_variants-base_qty = '1.000'.
it_variants-valid_from_date = sy-datum.
it_variants-function = 'NEW'.
APPEND it_variants.
Details of the materials of the different variants
CLEAR it_matrel.
it_matrel-bom_group_identification = 'BAPI_SMP_COL1'.
it_matrel-material = 'BAPIBOMFG1'.
it_matrel-bom_usage = '1'.
it_matrel-alternative_bom = '01'.
APPEND it_matrel.
Linking subitems to the corresponding variants
CLEAR it_subitemas.
it_subitemas-bom_group_identification = 'BAPI_SMP_COL1'.
it_subitemas-sub_object_type = 'SUI'.
it_subitemas-sub_object_id = 'SIM1'.
it_subitemas-super_object_type = 'ITM'.
it_subitemas-super_object_id = 'SIMPLE1'.
APPEND it_subitemas.
Linking items to the corresponding variants
CLEAR it_itemas.
it_itemas-bom_group_identification = 'BAPI_SMP_COL1'.
it_itemas-sub_object_type = 'ITM'.
it_itemas-sub_object_id = 'SIMPLE1'.
it_itemas-super_object_type = 'BOM'.
it_itemas-super_object_id = 'SIMPLE1'.
it_itemas-valid_from_date = sy-datum.
it_itemas-function = 'NEW'.
APPEND it_itemas.
Details of the items of the variants
CLEAR it_items.
it_items-bom_group_identification = 'BAPI_SMP_COL1'.
it_items-object_type = 'ITM'.
it_items-object_id = 'SIMPLE1'.
it_items-item_no = '0010'.
it_items-item_cat = 'L'.
it_items-component = 'BAPIBOMRW1'.
it_items-comp_qty = '2'.
it_items-valid_from_date = sy-datum.
APPEND it_items.
CLEAR it_subitems.
it_subitems-bom_group_identification = 'BAPI_SMP_COL1'.
it_subitems-object_type = 'SUI'.
it_subitems-object_id = 'SIM1'.
it_subitems-subitem_no = '0001'.
it_subitems-INSTALLATION_POINT = 'ab1'.
it_subitems-subitem_qty = '1'.
APPEND it_subitems.
CALL FUNCTION 'BAPI_MATERIAL_BOM_GROUP_CREATE'
EXPORTING
all_error = 'X'
TABLES
bomgroup = it_bomgroup
variants = it_variants
items = it_items
materialrelations = it_matrel
itemassignments = it_itemas
subitems = it_subitems
subitemassignments = it_subitemas
return = it_return.
CLEAR it_subitems.
it_subitems-bom_group_identification = 'BAPI_SMP_COL1'.
it_subitems-object_type = 'SUI'.
it_subitems-object_id = 'SIM1'.
it_subitems-subitem_no = '0002'.
it_subitems-INSTALLATION_POINT = 'ab2'.
it_subitems-subitem_qty = '1'.
APPEND it_subitems.
CALL FUNCTION 'BAPI_MATERIAL_BOM_GROUP_CREATE'
EXPORTING
all_error = 'X'
TABLES
bomgroup = it_bomgroup
variants = it_variants
items = it_items
materialrelations = it_matrel
itemassignments = it_itemas
subitems = it_subitems
subitemassignments = it_subitemas
return = it_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
LOOP AT it_return.
WRITE:/ it_return-type, it_return-id, it_return-number,
it_return-message.
ENDLOOP.
2006 Nov 27 10:55 AM
hi
good
go through this link and use accordingly.
http://sap.ittoolbox.com/code/archives.asp?d=2270&a=s&i=10
thanks
mrutyun^