Which BAPI should I use in MRP3
view of MM02
transaction to create a configurable variant for a finished good material in SAP?
You should use MATERIAL_SAVE_CONFIGURATION
FM like this:
Get configuration object for the given plant
CALL FUNCTION 'CUXM_GET_CONFIGURATION'
EXPORTING
instance = ls_marc-cuobj
werks = ls_marc-werks
TABLES
t_e1cucfg = lt_e1cucfg
t_e1cuins = lt_e1cuins
t_e1cuval = lt_e1cuval
t_e1cucom = lt_e1cucom
Alternatively, you can fill parameters manually
lt_e1cucfg-POSEX = '4000'.
lt_e1cucfg-CONFIG_ID = '000001'.
lt_e1cucfg-ROOT_ID = '00000001'.
lt_e1cucfg-COMPLETE = 'T'.
APPEND lt_e1cucfg.
lt_e1cuins-INST_ID = '00000001'.
lt_e1cuins-OBJ_TYPE = 'MARA'.
lt_e1cuins-CLASS_TYPE = '300'.
lt_e1cuins-OBJ_KEY = 'C_GLTP'.
lt_e1cuins-QUANTITY = '1000'.
lt_e1cuins-QUANTITY_UNIT = 'KG'.
lt_e1cuins-COMPLETE = 'T'.
lt_e1cuins-OBJECT_GUID = 'C_GLTP'.
APPEND lt_e1cuins.
lt_e1cuval-matnr = '000000000004002322'.
lt_e1cuval-inst_id = '00000001'.
lt_e1cuval-valcode = '1'.
lt_e1cuval-charc = 'SHOT_PEENING_Y_N'.
lt_e1cuval-value = 'N'.
APPEND lt_e1cuval.
lt_e1cuval-charc = 'BENDING_Y_N'.
lt_e1cuval-value = 'N'.
APPEND lt_e1cuval.
lt_e1cuval-charc = 'LENGTH_MIN_DISCRIMINATING_MM'.
lt_e1cuval-value = '5000'.
APPEND lt_e1cuval.
lt_e1cuval-charc = 'LENGTH_MAX_DISCRIMINATING_MM'.
lt_e1cuval-value = '7000'.
APPEND lt_e1cuval.
Use returned values as input parameters for the MATERIAL_SAVE_CONFIGURATION
CALL FUNCTION 'MATERIAL_SAVE_CONFIGURATION'
EXPORTING
material = ls_marc-matnr
conf_matl = ls_mara-satnr
plant = ls_marc-werks
conf_matl_plant = ls_mara-satnr
TABLES
e1cucfg = i_e1cucfg
e1cuins = i_e1cuins
e1cuval = i_e1cuval
e1ucom = i_e1cucom
e1cucfg_w = ic_e1cucfg
e1cuins_w = ic_e1cuins
e1cuval_w = i_e1cuval
e1cucom_w = ic_e1cucom.