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

How to create Alternative BoM using CSAP_MAT_BOM_MAINTAIN function module

srikanth_d4
Participant
0 Likes
4,016

Hi,

I am using FM:CSAP_MAT_BOM_MAINTAIN to create alt BoM, i could not able to create an alt BoM using this fm its giving error msg as:

T ID NUM MESSAGE E 29 037 BOM already exists for ZPRD-HEAD1 5001 4

I am passing:

I_MATERIAL=ZPRD-HEAD1

I_PLANT = 5001

I_BOM_USAGE = 1

I_ALTERNATIVE= 4

I_VALID_FROM = 10/27/2017

I_STKO = 2 EA 00

FL_COMMIT_AND_WAIT = X

I_FL_CAD I_FL_BOM_CREATE =X

I_FL_NEW_ITEM = X

I_FL_DEFAULT_VALUES = X

TABLES

T_STPO passing 3 components

please help me to get it resolved.

Regards,

Srikanth

3 REPLIES 3
Read only

SimoneMilesi
Active Contributor
2,214

i had some problems into using that FM to create an alternative too.

i switched to the old CS_BI_BOM_CREATE_BATCH_INPUT1: maybe not the best solution, but it works pretty fine and fast.

Read only

David_mT
Explorer
0 Likes
1,819

The FM CSAP_MAT_BOM_MAINTAIN will never create alternative BOM (except 01) because there is a flag inside flg_no_alt_create always X

This flag is not in the parameter of the fonction but fixed to X

  call function 'CS_DI_HEADER_OBJECT_CHECK'
    exporting
      ecsin                    csin
      flg_foreign_key          kreuz
      flg_ale                  flg_ale
      flg_api                  kreuz
      flg_cad                  fl_cad
      flg_no_cad_rules         flg_no_cad_rules
      flg_no_standard_val      strg-locvl
      flg_item_single_read     flg_item_single_read
      flg_no_change_doc        fl_no_change_doc
      flg_no_alt_create        kreuz

 

Should be great if SAP let us the control of this flag as a parameter..

Read only

David_mT
Explorer
0 Likes
1,765

I have found, checked and coded a solution with the following function : BAPI_MATERIAL_BOM_GROUP_CREATE(already existing in ECC SAP Version)

 

It can create BOM with several alternatives !

It is working well !!  

  CALL FUNCTION 'BAPI_MATERIAL_BOM_GROUP_CREATE'
    EXPORTING
      testrun           lv_bapiflag
      all_error         'X'
    TABLES
      bomgroup          it_bomgroup
      variants          it_variants
      items             it_items
      materialrelations it_matrel
      itemassignments   it_itemas
      return            it_return.