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_member328919
Participant
0 Likes
8,409

Hi All,

I would like create mass contract SD. For that I use BAPI_CONTRACT_CREATEFROMDATA (I tested also with function SD_SALESDOCUMENT_CREATE).

I don't have problem to create contract without configurator but when I try to create contract with configurator, I have the following error:

V1854 : Internal error in communication between configuration ans sales doc. GET_CONFIG_MODE

I already use this BAPI(s) for other customers and update material nomenclature but with this new customer I feel that something is blocking me... After days of debug, It seems that the instance can not be find or determined....

I tried also to applicate the OSS note by launching programs : RIBCHECKIBIN and RCU_CHECK_CONFIGURATION ==> But nothing change ....

Moreover, I don't have problem to create manually a contract by VA41.

I fill the field PO_ITM_NO of my item with the value of posnr...

The content of my configurator internal tables ....

My material :

Waiting your help, thanks a lot

Best Regards,

1 ACCEPTED SOLUTION
Read only

former_member328919
Participant
0 Likes
7,445

Solved !

Thanks for your help

18 REPLIES 18
Read only

Nawanandana
Active Contributor
0 Likes
7,445

Hi,

Configuration object is stored in VBAP-CUOBJ (if its item condition VBRP-CUOBJ). plz check exists for the defined value. I mean check already existing document.

Other issue may be the material must be a material variant and the configuration must be incomplete or inconsistent during the entry.

Check this SAP Note

1612913 - Errors in Variant Configuration Call

Read only

former_member328919
Participant
0 Likes
7,445

Hi Nawanandana,

1. Thanks for your answer

2. I am in creation mode so impossible to check vbap-cuobj value because my error stop the contract creation

3. As you can see in my screenshots of my material, the characterstics are stored in configuration 300 (Variants)

4. As explained, I already launch the program RIBCHECKIBIN but no overlapping found

Read only

0 Likes
7,445

Hi Walid,

Change CONFIG_ID value to '000010' in below internal tables and execute the BAPI.

LT_CFGS_REF

LT_CFGS_INST

LT_CFGS_VALUE

Regards,

Mukhtar

Read only

former_member328919
Participant
0 Likes
7,445

Hi Mukhtar,

I tried to change CONFIG_ID values in tables that you give and I still have the same error ...

I also tried to fill CONFIG_ID in the table LT_ITEMS_IN but same error also....

Regards

Read only

0 Likes
7,445

Hi,

Have you tried creating contract using VA41 for the same combination of customer and material.

Read only

former_member328919
Participant
0 Likes
7,445

Yes, no problem to create contract via VA41 and I can update configurator without problem.

Read only

0 Likes
7,445

Hi,

What are the possible values of characteristic 'ZMRO_HEADER_FBH',check in 'Values' tab in CT04.

Goto CT04 and check if 'Entry required' is flagged in 'basic data' tab of characteristic 'ZMRO_HEADER_FBH',if yes then you will not be able to create contract with a blank value.

Regards,

Mukhtar

Read only

0 Likes
7,445

hi,

I checked and "Entry required" is not ticked

Moreover, the possible values of this characteristic are Y and N

Regards,

Walid

Read only

former_member328919
Participant
0 Likes
7,445

I don't know what added information can I give you...to help me

Read only

0 Likes
7,445

Hi Walid,

Can you share contents of internal table CONTRACT_ITEMS_IN .

P.S : Add comment below, Please do not add an answer

Read only

0 Likes
7,445

Hi Mukhtar,

All other fields are empty

Read only

0 Likes
7,445

Hi,

I tried replicating in my system, but i successfully updated configuration and created contract.

May be you can try adding leading zeros in MATNR ,but i'm not sure if it works.

Regards,

Mukhtar

Read only

0 Likes
7,445

Hi Mukhtar,

I Applied 'CONVERSION_EXIT_MATN1_INPUT' to my material .... and still have same problem.....

What is strange is that I can create manually the contract

Regards,
Walid

Read only

0 Likes
7,445

Hi,

Here is debug values, in error moment :

Read only

former_member328919
Participant
0 Likes
7,445

Help me please !

Read only

former_member328919
Participant
0 Likes
7,446

Solved !

Thanks for your help

Read only

0 Likes
7,445

Hi,

Please share solution.

Read only

0 Likes
7,445

Hi Mukhtar,

1. Thanks a lot for your help

2.

REPORT ztest.

DATA: ls_header_in TYPE bapisdhd1,
l_contract_nb TYPE bapivbeln-vbeln,
lt_return TYPE TABLE OF bapiret2,
lt_items_in TYPE TABLE OF bapisditm,
ls_items_in TYPE bapisditm,
lt_partners TYPE TABLE OF bapiparnr,
ls_partners TYPE bapiparnr,
lt_cfgs_ref TYPE TABLE OF bapicucfg,
ls_cfgs_ref TYPE bapicucfg,
lt_cfgs_inst TYPE TABLE OF bapicuins,
ls_cfgs_inst TYPE bapicuins,
lt_cfgs_value TYPE TABLE OF bapicuval,
ls_cfgs_value TYPE bapicuval.

ls_header_in-doc_type = 'XXXX'.
ls_header_in-sales_org = 'XXXX'.
ls_header_in-distr_chan = 'XX'.
ls_header_in-division = 'XX'.

ls_partners-partn_role = 'AG'.
ls_partners-partn_numb = 'XXXXXXXXXX'.
APPEND ls_partners TO lt_partners.

ls_items_in-itm_number = '000010'.
ls_items_in-config_id = '000001'.
ls_items_in-material = material.
ls_items_in-po_itm_no = '000010'.
ls_items_in-item_categ = Item cat.
ls_items_in-division = 'XX'.
APPEND ls_items_in TO lt_items_in.

ls_cfgs_ref-posex = '000010'.
ls_cfgs_ref-config_id = '000001'.
ls_cfgs_ref-root_id = '00000001'.
ls_cfgs_ref-sce = '1'.
ls_cfgs_ref-complete = 'T'.
ls_cfgs_ref-consistent = 'T'.
ls_cfgs_ref-cbase_id_type = 'G'.
APPEND ls_cfgs_ref TO lt_cfgs_ref.

ls_cfgs_inst-obj_key = material.
ls_cfgs_inst-config_id = '000001'.
ls_cfgs_inst-inst_id = '00000001'.
ls_cfgs_inst-obj_type = 'MARA'.
ls_cfgs_inst-class_type = '300'.
ls_cfgs_inst-complete = 'T'.
ls_cfgs_inst-consistent = 'T'.
ls_cfgs_inst-object_guid = material.
ls_cfgs_inst-persist_id_type = 'G'.
APPEND ls_cfgs_inst TO lt_cfgs_inst.

ls_cfgs_value-config_id = '000001'.
ls_cfgs_value-inst_id = '00000001'.
ls_cfgs_value-charc = characteristic.
ls_cfgs_value-value = 'Y'.
APPEND ls_cfgs_value TO lt_cfgs_value.

CALL FUNCTION 'CUXC_INIT'.

CALL FUNCTION 'BAPI_CONTRACT_CREATEFROMDATA'
EXPORTING
* SALESDOCUMENTIN =
contract_header_in = ls_header_in
* CONTRACT_HEADER_INX =
* SENDER =
* BINARY_RELATIONSHIPTYPE = ' '
* INT_NUMBER_ASSIGNMENT = ' '
* BEHAVE_WHEN_ERROR = ' '
* LOGIC_SWITCH =
* TESTRUN =
* CONVERT = ' '
IMPORTING
salesdocument = l_contract_nb
TABLES
return = lt_return
contract_items_in = lt_items_in
* CONTRACT_ITEMS_INX =
contract_partners = lt_partners
* CONTRACT_CONDITIONS_IN =
* CONTRACT_CONDITIONS_INX =
contract_cfgs_ref = lt_cfgs_ref
contract_cfgs_inst = lt_cfgs_inst
* CONTRACT_CFGS_PART_OF =
contract_cfgs_value = lt_cfgs_value
* CONTRACT_CFGS_BLOB =
* CONTRACT_CFGS_VK =
* CONTRACT_CFGS_REFINST =
* CONTRACT_DATA_IN =
* CONTRACT_DATA_INX =
* CONTRACT_TEXT =
* CONTRACT_KEYS =
* EXTENSIONIN =
* PARTNERADDRESSES =
.

COMMIT WORK AND WAIT .