0

Which BAPI should I use in MRP3 view of MM02 transaction to create a configurable variant for a finished good material in SAP?

enter image description here

4

1 回答 1

1

You should use MATERIAL_SAVE_CONFIGURATION FM like this:

  1. Get configuration object for the given plant

    CALL FUNCTION 'CUXM_GET_CONFIGURATION'
      EXPORTING
        instance = ls_marc-cuobj
        werks    = ls_marc-werks
      TABLES
        t_e1cucfg = ic_e1cucfg
        t_e1cuins = ic_e1cuins
        t_e1cuval = ic_e1cuval
        t_e1cucom = ic_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'.
    lt_e1cucfg-CONSISTENT = '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-CONSISTENT    = 'T'.
    lt_e1cuins-OBJECT_GUID  = 'C_GLTP'.
    APPEND lt_e1cuins.
    
    gv_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.
    
  2. 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
           E1CUCOM = i_e1cucom
           e1cucfg_w = ic_e1cucfg
           e1cuins_w = ic_e1cuins
           e1cuval_w = i_e1cuval
           e1cucom_w = ic_e1cucom
    
于 2016-12-18T14:47:07.810 回答