‎2008 Aug 05 3:29 PM
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
‎2008 Aug 05 3:45 PM
"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?
‎2008 Aug 05 3:46 PM
Obviously - these conditions can go to the invoice - but need to know your business req(s).
‎2008 Aug 05 4:27 PM
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
‎2008 Aug 05 4:32 PM
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?
‎2008 Aug 05 4:38 PM
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
‎2008 Aug 05 4:41 PM
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.
‎2008 Aug 05 4:44 PM
‎2008 Aug 05 4:46 PM
???
VA03 is a Display transaction. You can not change an order's conditions in VA03. You must use VA02.
‎2008 Aug 05 7:02 PM
I check the va02 and it works fine but i still have the problem
‎2008 Aug 05 7:17 PM
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?
‎2008 Aug 05 7:38 PM
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 ?
‎2008 Aug 05 8:50 PM
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
‎2008 Aug 05 9:14 PM
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'.?
‎2008 Aug 05 9:16 PM
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.
‎2008 Aug 05 9:37 PM
i did it but agani when i make the invoice it takes the old ones conditions values and not the new ones
‎2008 Aug 05 9:39 PM
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
‎2008 Aug 05 9:39 PM
Ignore the invoice for now. Are the new pricing values visible in VA02 / VA03 in the Conditions screen?
‎2008 Aug 05 10:01 PM
‎2008 Aug 05 10:29 PM
>
> 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'.
‎2008 Aug 05 10:37 PM
nope the table return is empty the bapi retun no errors
Edited by: Alejandro RS on Aug 5, 2008 11:37 PM