Application Development 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: 

Duplicate condition records with BAPI_SALESORDER_CREATEFROMDAT2

Former Member
0 Kudos

Hi guys,

I'm creating a sales order with function module BAPI_SALESORDER_CREATEFROMDAT2.

The problem I'm having is that I want to change one of the rates on a percentage based condition type when I create the sales order.

I pass the data in the parameter ORDER_CONDITIONS_IN and set the COND_UPDAT field to 'X'. When the sales order gets created though, two condition records are created for this condition type. One is created with the determined rate (from pricing) and another one with the rate that I passed to the BAPI.

I am aware that there is a ORDER_CONDITIONS_INX parameter in 4.7 (and an UPDATEFLAG field) however we are on version 4.6c here and that parameter is not available.

Has anybody managed to do something similar in version 4.6C?

Many thanks

Fuad

1 ACCEPTED SOLUTION

Former Member
0 Kudos

<i>you don't have to pass the bapisdls at all. Just don't pass the bapisdls. make sure that you're passing kschl, kbetr kmein kwert in the conditions_in parameter to the bapi. That should do it.</i>

Hi Vijay,

I copied your answer here that you posted in a new thread so that others can have a background to the problem.

15 REPLIES 15

Former Member
0 Kudos

I believe you follow this pattern for condions in your FM. If so it should work properly. It's not need for COND_UPDAT,I believe.

* header condition

bapicond-itm_number = '000000'.
bapicond-cond_type = 'CON1'.
bapicond-cond_value = zval1.

APPEND bapicond.

*condition is for any position 

bapicond-itm_number = cont_pos_item.
bapicond-cond_type = 'CON2'.
bapicond-cond_value = zval1.
bapicond-currency = curr.

APPEND bapicond.

I believe this is helpful for you.

rgds,

Thomas.

0 Kudos

Hi Thomas,

This is the pattern that I am following and it creates manually entered conditions okay.

However when I pass a condition record with a rate to the BAPI, and if this condition type (and rate) is automatically determined from pricing, then it creates two condition records when the sales order gets created

Former Member
0 Kudos

Hi,

Try this....

update the BAPISDLS structure(Logical Switch) with the following and pass to BAPI.

BAPISDLS-PRICING = 'C'.

if 'C' doesnt work, try all the options, to know all the options go to the value range of domain KNPRS.

Sreedhar

0 Kudos

Hi,

It doesn't mean its creating duplicate condition records.

Condition records are the ones that you're maintaining in pricing using VK11/VK12. What you're facing is duplicate entries present in sales order conditions tab, one entry determined from the condition record in pricing, and another entry which you've passed in your BAPI. Try passing F in your bapisdls pricing structure.

Else, you'll need to do a slight change in configuration. The condition type setting maintain 'B' for manual entries, saying - manual entry has priority. I think that should solve your problem. Award points if these things help.

Regards,

Vijay

0 Kudos

Vijay hi,

I have changed the configuration for the condition type to "Manual entry has priority". However the BAPI does not allow me to use pricing type "F" for the logic switch.

It returns the error "F is not allowed for LOGIC_SWITCH-PRICING".

Could this be part of the problem?

0 Kudos

since you've maintained manual entries. don't pass the logic switch at all. just pass the condition type parameters in the conditions_in table. That should be it.

0 Kudos

you don't have to pass the bapisdls at all since u've done manual entry has priority in the condition type.

Former Member
0 Kudos

Hi Fuad,

I think there can be two ways.

1. Create SAles order as you are creating without pasing any value for this condition type. and then change this condition value ( which is being determined automatically) by using BAPI_SALESORDER_CHANGE wher you can use Update flag as 'X' In parameter CONDITIONS_INX of this BAPI.

<b>OR</b>

2. If you want to happen this chage at the time of sales order creation, then I think , this particual condition type should be "manual" and not "Automatic" One.

Hope this helps.

Regds,

Akshay Bhagwat

Note: Pls mark helpful answers.

0 Kudos

Hi,

The LOGIC_SWITCH doesn't seem to work, the only ones it allows me to use are "B" and "C" and neither of these have fixed the problem.

Akshay, I'm hoping I can avoid having to call the change BAPI again to update the rate on the condition type. I will have a look at the possibility of changing the condition type to manual first.

Thanks to all for your input so far.

Regards

Fuad

Former Member
0 Kudos

<i>you don't have to pass the bapisdls at all. Just don't pass the bapisdls. make sure that you're passing kschl, kbetr kmein kwert in the conditions_in parameter to the bapi. That should do it.</i>

Hi Vijay,

I copied your answer here that you posted in a new thread so that others can have a background to the problem.

0 Kudos

Ok. Jus let me know if this worked.

Regards,

Vijay

0 Kudos

Hi Vijay,

Apologies for only replying now, but just to let you and others know, I managed to fix my problem by using pricing type "G" with parameter LOGIC_SWITCH.

Thank you

Regards

Fuad

Former Member
0 Kudos

I still having the duplicate problem, Allready tried with the Logic Switch (All pricing values 'A' to'K').

If I set a 'G' in Logic_Switch-pricing, some conditions still duplicating with amount 0(Zero).

Former Member
0 Kudos

Hello,

I am not sure if the problem is still alive.

I faced the same problem and found some useful information in oss notes, by which I found the solution.

Please check notes 574088, 593246 + related notes

Rgds,

Viktor Bojtos

Hungary

former_member182888
Participant
0 Kudos

I have faced this Same issue lately ..

and the Solution was:

the SD Consultant Changed the Type of the Condition type to Manual Pricing instead of Automatic Pricing