Skip to Content
0

Conditions are not removed from KONV after BAPI execution

Dec 18, 2017 at 02:29 PM

101

avatar image
Former Member

Hi everyone

I'm trying to use the FM BAPI_SALESORDER_CHANGE to remove items from a sales order and insert a new one. But after BAPI execution the conditions values in the header become wrong. I've checked the KONV table and the conditions from the removed items still there.

Someone here had a problem like that? How can I use this BAPI to update the conditions after removing items?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Veselina Peykova
Dec 18, 2017 at 08:11 PM
1

I am not entirely convinced that the linked thread is a suitable match for this specific case.

The archived thread is about modifying condition values in existing order items, while here the OP is deleting order items.

From what I read in 366265 - How should I fill the BAPI parameters?, p.3 a) for deleting items you just need to pass information in BAPISDITM, BAPISDITMX, BAPISDH1X and the order number, there is no mention that you have to delete conditions in the bapi on top of that (and even when you modify items you might not be able to delete all conditions).

When I followed the steps for deleting items from this note, the KONV entries were removed after bapi_transaction_commit.

Former Member , as a part of the troubleshooting try this:

1. starting point order with items 10, 20.

2. delete via bapi item 20 and commit.

3. check the outcome.

4. add item 20 via bapi and commit.

5. check the outcome in konv.

---

Then make another test:

1. starting point order with items 10, 20.

2. delete via bapi item 20, add via bapi item 30. commit.

3. check the outcome in konv.

Edit: the reason why I suggested these tests is because making simple examples (without complicating the case with additional pricing modification in condition handling) are easier to troubleshoot especially if your pricing procedure is complex. After you ensure that these two tests are successful, you will only need to investigate what you pass in conditions (if you made any adjustments there via the bapi).

Show 5 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Veselina, thank you for your answer.

Before I open this thread I tried to run the BAPI for inclusion and exclusion separately, but I'd got the same problem with conditions.

I'm currently filling BAPI parameters as the example below (I'm trying to remove items 10, 30 and 50):

SALESDOCUMENT = <NUMBER OF DOCUMENT>

ORDER_HEADER_INX

LOGIC_SWITCH

ORDER_ITEM_IN

ORDER_ITEM_INX

Best Regards,

Hevanderson

0

I populated the parameters like you except that I did it for just one item - 000030 (which should not make much difference).

I performed no additional changes to pricing via the bapi (other than repricing with C) and after bapi_transaction_commit the konv entries for this item are not present in se16.

Is there anything else that you set as parameters in the bapi?

If yes, I can try to reproduce it in a sandbox.

My test was done with item categories TAN and TANN - no BOM explosion, no VC - the simplest possible case.

If you did not pass any other parameters and if you use item categories similar to mine - this does not seem like a normal behavior at all.

Would you check if you encounter the same problem via VA02? If it happens there as well you will know at least that this is not related to your program.

If this does not happen in VA02 and in bapi_salesdocument_change (this is just for testing, I do not suggest to use this bapi in your program), but only in bapi_salesorder_change I would consider it unlikely to be caused by own developments and would think about contacting the official SAP support.

For what is worth, I made the test in a EHP4 system with relatively simple pricing, standard document type and item categories and almost no custom logic in SD exits.

1
Former Member
Former Member

I tried to do the deletion via VA02 and the behavior seems to be the correct. I put a break-point into the program MV45AFZZ in the subroutine USEREXIT_SAVE_DOCUMENT_PREPARE and checked out the itab XKOMV[] it reflect the data to be saved in KONV table. When i run via VA02, the items 10, 30 and 50 wasn't there. When I run via BAPI the items was kept into the itab.

0

Sorry, I did not see your comment earlier, because you responded to your own content and not to my reply (we do not get notifications in this case).

When you referred to run via BAPI - did you mean BAPI_SALESORDER_CHANGE (the one that you plan to use in your program) or BAPI_SALESDOCUMENT_CHANGE (which I suggested to try out for test purposes)? If you meant the second one - I would think that a possible reason could be some custom logic that is not executed when you edit the order via BAPI. To be fair, I have no idea what that could be, but other than comparing the behavior in debug between VA02 and BAPI execution, I do not really know what to suggest...

0

Please add all your further updates under Comment and not under Answer, as you only share additional informations asked by the members to help you and not answering. By the way, your above post has been converted by me from Answer to Comment.

0
Michelle Crapo Dec 18, 2017 at 04:57 PM
1

Hi!

Well this was a question I had not too long ago. The quickest was to get to the answer is to try google. The following is what I used just now: sap bapi change sales order condition

The answers are a little hard to understand and it took me a bit.

Basically: You have to pull all the values from KONV and pass them to the BAPI. For example make sure the step number and condition counter are filled.

Take a look at this link the last answer in the thread:
https://archive.sap.com/discussions/message/4221547#4221547

Best of luck,

Michelle

Share
10 |10000 characters needed characters left characters exceeded