cancel
Showing results for 
Search instead for 
Did you mean: 

GTM function module BAPI_TRADINGCONTRACT_CREATE

torben_bk
Participant
0 Kudos

I copy trading contracts (SAP GTM) using function module BAPI_TRADINGCONTRACT_CREATE. First I use function module BAPI_TRADINGCONTRACT_CHANGE to read the contract I want to copy and then I create the new trading contract with function module BAPI_TRADINGCONTRACT_CREATE.

On the trading contract I have sales conditions marked as delivery costs (KNTYP = B). For these conditions the vendor field is displayed when double-clicking on the condition.

The problem is when creating trading contract with BAPI_TRADINGCONTRACT_CREATE I can't update the value in the vendor field.

Please help.

/Torben

Accepted Solutions (1)

Accepted Solutions (1)

peter_langner
Active Contributor
0 Kudos

Torben,

have you tried to fill CONDITIONITEMDATAIN-VENDOR_NO?


Peter

torben_bk
Participant
0 Kudos

Hi Peter,

It is a header condition and I currently uses CUSTOMERCONDIN. I get an error 147 "No change list exist....." when trying to use the table.

/Torben

peter_langner
Active Contributor
0 Kudos

Hi Torben,

Which is the message class the number refers to?

I recommend that you use FM WB2_CONTRACT_CREATE_FROM_DATA . You are more flexible with this one.

Peter

torben_bk
Participant
0 Kudos

Hi Peter,

The message class is W_CB.

I have tried FM WB2_CONTRACT_CREATE_FROM_DATA. I have filled the table T_KOMTCKOEC and T_KOMTCKOC but I'm not able to create header sales conditions. I fill the table with item 0 but I think this goes wrong in FM WB2_CURR_CONV_KOND_CREATE. Here the item number from wbhi is used when reading T_KOMTCKO.

/Torben

peter_langner
Active Contributor
0 Kudos

Hi Torben,

did you manage to solve your problem? If not try the following tables of FM WB2_CONTRACT_CREATE_FROM_DATA: ct_cond_change and ct_cond_key.

To address the header conditions please use '000000' as item-key instead of '0'.

Peter

torben_bk
Participant
0 Kudos

Hi Peter,

I tried the two tables you mentioned. These tables relates to expence conditions handled as expenses on the contract. In my case it is normal sales conditions on the contract header. I try to use table t_komtckoec but I haven't succeed yet.

Torben

peter_langner
Active Contributor
0 Kudos

Hi Torben,

could you please send me your program, where you tried to use the bapi? It's more easy for me to help you, if know better, what you did. In general using the bapi should work.

Peter

torben_bk
Participant
0 Kudos

Hi Peter,

I just succeeded in getting the sales condition updated on the contract using FM wb2_pricing_post. I will then create the contract using FM bapi_tradingcontract_create and afterwards insert the conditions using FM wb2_pricing_post.

Thanks for your ideas and responses. I wish you a Merry Christmas.

Torben

Former Member
0 Kudos

Would it be possible for you to share the detail on how you invoked wb2_pricing_post?  It would help to know how you input the conditions.

Thanks and regards

torben_bk
Participant
0 Kudos

Hi Kevin,

First I use FM BAPI_TRADINGCONTRACT_CREATE and BAPI_TRANSACTION_COMMIT to create the contract. Then I read the conditions on the original contract using table WBHK and KONV. I insert these conditions in structure VKOMV with UPDKZ = I. I fill structure KOMWBHK from the new contract with fields TKONN, KNUMV_SD, PRICING_TYPE, UPDKZ = U and KONV_CHANGE = X.

Hope this can help you.

Torben

Former Member
0 Kudos

Thank you, Torben!  This helps a lot.

Answers (0)