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_SALESORDER_CHANGE problem

Former Member
0 Likes
1,984

hi guris i woul like to know how can i fill the conditions data for invoicing.

actually i do it in this way but it doesn work

order_header_inx-updateflag = 'U'.

call function 'BAPI_SALESORDER_CHANGE'

exporting

salesdocument = salesdocument

order_header_inx = order_header_inx

simulation = p_test

tables

return = return

conditions_in = conditions_in

conditions_inx = conditions_inx.

and then

call function 'BAPI_TRANSACTION_COMMIT'

exporting

wait = 'X'

importing

return = returncommit.

what is the problem? thanks

20 REPLIES 20
Read only

Former Member
0 Likes
1,912

"how can i fill the conditions data for invoicing" ???

You are using a Sales Order change BAPI... this is not invoicing BAPI.

What is your goal?

Read only

0 Likes
1,912

Obviously - these conditions can go to the invoice - but need to know your business req(s).

Read only

0 Likes
1,912

i have troubles when i try to make an invoice with tx vf04, because this transaction takes the old conditions and it doesn take the new conditions created by the 'BAPI_SALESORDER_CHANGE

that is my trouble pal , and the requirement is the next

for example i have one group, this group has 3 customers

and each customer has orders so if the 3 customers are part of the same group i need to calculate the sales order volum of the group

group1

cust1

5

1 = 7

1

cust2

2

1 = 3

cust3

3 = 3

337= 13

in the tx vk13 the conditions are: for material 60 from 1 to 7 = 5% from 8 to 14 =18% etc

so when i make the invoice the discount for the group should be

15% for each customer . Actually i dont get this result the result i get is for the first customer 5% for the second 5% and for the third one 5%

any idea ? thanks

Edited by: Alejandro RS on Aug 5, 2008 5:28 PM

Edited by: Alejandro RS on Aug 5, 2008 5:29 PM

Read only

0 Likes
1,912

Can you manually change the conditions in VA02 and do they save and post correctly to an invoice?

Also - does the BAPI return any errors?

Read only

0 Likes
1,912

no i cant manually change the conditions it should be automatic and the bapi executes without errors but i dont know which is the problem, i dont know why the bapi doesn update the conditions

Read only

0 Likes
1,912

BAPIs simply repeat human interaction.

If you can not manually produce this order situation, then take to process-oriented person to test if it works in VA02.

Read only

0 Likes
1,912

they use transaction va03 and it works fine

Read only

0 Likes
1,912

???

VA03 is a Display transaction. You can not change an order's conditions in VA03. You must use VA02.

Read only

0 Likes
1,912

I check the va02 and it works fine but i still have the problem

Read only

0 Likes
1,912

That is great news.

Now, in this statement -

call function 'BAPI_SALESORDER_CHANGE'

exporting

salesdocument = salesdocument

order_header_inx = order_header_inx

simulation = p_test

tables

return = return

conditions_in = conditions_in

conditions_inx = conditions_inx.

What are the values in p_test and the 2 int condition tables?

Read only

0 Likes
1,912

p_test is initial (blank)

and

table conditions_in

has the values

000010

009

01

zpl etc

conditions_inx

has

000010 |009 |01 |ZPL |U |X | |

etc

is there any problem ?

Read only

0 Likes
1,912

A,

That looks good from a data perspective.

Add this to your BAPI call:

data: lv_logic type BAPISDLS.

lv_logic-pricing = 'B'.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = v_ordnr

ORDER_HEADER_IN = wa_ORDER_HEADER_IN

order_header_inx = wa_soheaderx

LOGIC_SWITCH = LV_LOGIC "<--- carry out new pricing TABLES

return = v_return

,,,,,,

Edited by: John Jakabcsin on Aug 5, 2008 2:50 PM

Read only

0 Likes
1,912

excuse me but i dont understand the las thing you have wrote ,

do i have to fill this structure or only lv_logic-pricing = 'B'.?

Read only

0 Likes
1,912

You must declare a structure if the TYPE cited.

Then set the PRCING field in that Struct to 'B'.

Then pass the STRUCT (in this case, LV_LOGIC) to the BAPI.

Read only

0 Likes
1,912

i did it but agani when i make the invoice it takes the old ones conditions values and not the new ones

Read only

0 Likes
1,912

i did it but the problem continue when i make the invoice tru the vf04 tx it takes the old conditions values and it doesn take the new ones

Read only

0 Likes
1,912

Ignore the invoice for now. Are the new pricing values visible in VA02 / VA03 in the Conditions screen?

Read only

0 Likes
1,912

no the changes are not visibles

Read only

0 Likes
1,912

>

> lv_logic-pricing = 'B'.

John, it looks like Alejandro is trying to add a manual condition. Wouldn't 'C' (= keep the manual ones and redetermine the others) be more appropriate in this case?

Alejandro, it's still not clear if BAPI returns any errors - did you check the RETURN table? Although I personally had an issue with this BAPI when it did not carry the update and didn't return any errors either...

Also you might want to read the note 593246 (BAPI SD as of Rel.4.70: New functions for pricing), it contains an example of how the fields should be filled in. It also suggests to use LOGIC_SWITCH-COND_HANDLE = 'X'.

Read only

0 Likes
1,912

nope the table return is empty the bapi retun no errors

Edited by: Alejandro RS on Aug 5, 2008 11:37 PM