Skip to Content
-1

Sales order confirmation output not to be triggered if all the line items are unconfirmed with 0 qty

Mar 20, 2017 at 02:37 PM

318

avatar image
Former Member

Dear All,

We implemented the below routine but when the BESTK=A, the routine is not getting triggered in the debugging.May be we need to make some changes in the routine, please suggest.

FORM KOBED_9XX.

TABLES: vbap.
data ws_vbap LIKE vbap.
SY-SUBRC = 0.
IF KOMKBV1-BESTK EQ 'A'. "Order confirmation status
clear ws_vbap.
SELECT SINGLE * INTO ws_vbap
FROM VBAP WHERE VBELN = KOMKBV1-VBELN
AND KBMENG NE 0.
IF SY-SUBRC NE 0.
SY-SUBRC = 4.
EXIT.
ENDIF.

ENDIF.

Thank you,

Regards.

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

2 Answers

Jelena Perfiljeva
Mar 20, 2017 at 05:37 PM
4

Kindly do some home work before posting questions on SCN. You're saying "the routine is not getting triggered in the debugging" but then asking if changes could be needed inside the routine. How does that make sense? If the whole routine is not triggered then the problem is clearly not inside it. Could it be that the routine is not even assigned in the configuration? And are you actually debugging output? It runs in a separate process and you likely won't see it if you just start debugger in the order transaction. Googl output debugging.

The code inside the routine seems to do the exact opposite of what stated in the title as a requirement. But it should become more clear in debugger.

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

Dear Jelena,

for "The code inside the routine seems to do the exact opposite of what stated in the title as a requirement. But it should become more clear in debugger."....this is definitely not the case because we have

"IF SY-SUBRC NE 0.

SY-SUBRC = 4".

The routine do get triggered while saving the Order in VA01 transaction for the cases where BESTK is NE A , so definitely no issues with configuration.

Just having status check is not sufficient, as for partially confirmed orders, for example one line item with 0 KBMENG and another with partially confirmed KBMENG the status check would not help.

Please note, I am not really a technical consultant, but trying to figure out the possible changes that can be made in the routine. One possibility could be figuring out how to access the VBELN when saving the order.

Thank you for you support!

Regards.

0

Then the statement "routine is not getting triggered" is incorrect. It's the specific code fragment that is not executed, which is different.

I've never had such requirement before but, as mentioned elsewhere in this post, SELECT does not seem a suitable option in VA01. I've just checked and requirement is triggered before the update process (doesn't seem to be triggered again afterwards). You can try to store some value in memory or add a custom field to KOMKBV1. An additional user exit would be needed in both cases.

0
Shanthi Kumar Juluru Mar 20, 2017 at 03:36 PM
0

Hi,

In which transaction are you trying this? It does not work with VA01 because, before the sales order is saved, KOMKBV1-VBELN does not contain any sales order. This routine will get triggered only in VA02.

Also, you need to query VBEP table to check the schedule lines

Thanks,

Shanthi Kumar Juluru

Show 4 Share
10 |10000 characters needed characters left characters exceeded

Too lazy to confirm but I believe KOMKBV1-VBELN should be filled in even in VA01. Not sure OP has to check VBEP since the requirement is just to compare to 0. Even the status check may be sufficient.

0

Agree with you on the status check. In VA01, KOMKBV1-VBELN is blank.

0
Former Member

Regarding VBELN that is not available, may be we need to get it from call stack

For example: (SAPMV45A)XVBAP : Table XVBAP ( it contains all lines ) but not really sure how to implement it within our existing code.

0

If VBELN is not available then data is not saved yet hence SELECT won't work anyway. But the status check should be sufficient IMHO, unless for some reason it's set differently.

0