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

BAPI_CONTRACT_CREATEFROMDATA - Item Configuration

Former Member
0 Likes
1,168

Hi All,

I've a problem with the bapi BAPI_CONTRACT_CREATEFROMDATA. I try to pass item configuration data for multiple items, but when I check the created contract, the configuration is not set up correctly. The values in the configuration for item >= 20 are taken from the confuguration of item 10. In the contract_cfgs_value table the values are set correctly for the items >= 20. I also fill the tables contract_cfgs_ref, contract_cfgs_inst, contract_cfgs_refinst.

I've tried several options with different values for config_id, posex and inst_id fields in the cfg* tables, but nothing seems to work.

Thanks for your quick response!!

3 REPLIES 3
Read only

Former Member
0 Likes
817

Below is some code for filling values for the create sales order bapi. I am assuming it is similar for the contract bapi. My guess is that you are missing the root_id and maybe the inst_id.


LOOP AT epordc ASSIGNING <epordc> WHERE itemno = <epordd>-itemno.
  IF first_time IS INITIAL.
*   ORDER_CFGS_REF
    bapicucfg-posex      = <epordd>-itemno.
    bapicucfg-config_id  = <epordd>-itemno.
    bapicucfg-root_id    = <epordd>-itemno.
    APPEND bapicucfg.

*   ORDER_CFGS_REFINST
    bapicuref-posex     = <epordd>-itemno.
    bapicuref-config_id = <epordd>-itemno.
    bapicuref-inst_id   = <epordd>-itemno.
    APPEND bapicuref.

*   ORDER_CFGS_INST
    bapicuins-config_id  = <epordd>-itemno.
    bapicuins-inst_id    = <epordd>-itemno.
    bapicuins-obj_type   = 'MARA'.
    bapicuins-class_type = '300'.
    bapicuins-obj_key    = matnr_int.
    APPEND bapicuins.

    first_time = 'X'.
  ENDIF.

* ORDER_CFGS_VALUE
  bapicuval-config_id = <epordd>-itemno.
  bapicuval-inst_id   = <epordd>-itemno.
  bapicuval-charc     = <epordc>-charname.
  bapicuval-value     = <epordc>-charval.
  APPEND bapicuval.
ENDLOOP.

Brian

Read only

0 Likes
817

Thanks Brian,

It was a good push in the right direction. I had filled the root_id & inst_id, but not all with the same values. Plus I had tried passing on several tables to the bapi.

It now seems to work, but have to check with different options.

Ciao,

Sander

Read only

Former Member
0 Likes
817

Hi All,

Can I know what type of Data that we need to pass for Configuration data like what is the OBJ_key and the rest of the values. Because I am passing all the values just like the way it has explained here and I am not able to see the data for the configuration.

Thanks

Hima