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: 

BADI u0091SD_COND_SAVE_Au0092-Transaction terminated

Former Member
0 Kudos

In BADI ‘SD_COND_SAVE_A’ implementation, a validation check is added to prevent pricing condition from saving if the price entered is lower than the standard price of the material and an error message is issued using Message EXXX to indicate the error to the user. However, in the case of the validation check does fail, after the error message is issued, if user presses enter key or back key to re-activate the field for re-entering data, a cancel popup window is displayed with the error message (from message class NR number 001). Then, the transaction is terminated and user loses all data entered previously.

During our trace in debug mode, we noticed that a change document was generated (in subroutine ‘NUMBERN_VERGABE’) and added to internal table NUMBER_CHANGE during the initial save of the pricing condition, but due to the failure of the validation check placed in BADI implementation ‘SD_COND_SAVE_A’, the actual save did not take place. Then, when user pressed enter key or back key, the PAI event of the transaction VK11 was triggered and the routine NUMMERN_VERGABE’ was called again to generate a new change document. This time, in the routine ‘NUMMERN_VERGABE’, the statement READ TABLE NUMBER_CHANGE WITH KEY NUMBER_CHANGE-OLD NUMBER BINARY SERACH this time has return code ‘0’ because the internal table NUMBER_CHANGE still keeps the record previously stored during the initial save. As a result, the transaction terminated and all data was lost.

Code from Subroutine ‘NUMBER_VERGABE’:

READ TABLE NUMBER_CHANGE WITH KEY NUMBER_CHANGE-OLD_NUMBER

BINARY SEARCH.

  • Neue Nummer in den Funktionsteil

MOVE NV_NEW_NUMBER TO NUMBER_CHANGE-NEW_NUMBER.

CASE SY-SUBRC.

  • Nummer bereits vergeben

WHEN 0. MESSAGE A001(NR) WITH NUMBER_CHANGE-OLD_NUMBER.

  • Einfügen der neuen Nummer

WHEN 4. INSERT NUMBER_CHANGE INDEX SY-TABIX.

WHEN 8. APPEND NUMBER_CHANGE.

ENDCASE.

How to avoid the transaction from being terminated when the user wants to EDIT it.

regards,

Ravi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Ravi,

This BADI is called in a function module SD_CONDITION_SAVE_EXIT that is an update function module. You cannot issue error messages in an update task. So I am not sure if this is the right place to implement your logic.

Srinivas

5 REPLIES 5

Former Member
0 Kudos

Hi Ravi,

This BADI is called in a function module SD_CONDITION_SAVE_EXIT that is an update function module. You cannot issue error messages in an update task. So I am not sure if this is the right place to implement your logic.

Srinivas

0 Kudos

Hi Srini,

If you have experience in addressing this type of request could you sugest any are I should look into. the requirement is to check selling price V/s cost price during in VK11,12. The user dont want a BDC with a check put upfront.

Thanks,

Ravi

0 Kudos

Hi Ravi!

I don't know an exit in condition maintenance (VK11/MEK1/XK15). But there is an exit for user checks in transaction VKP1 - unfortunately that's Retail module, so probably not available to you.

As Srini said: don't raise messages in update part of a program.

There is an other option: add a surcharge in pricing schema, which is filled by a formula with the difference between price (including some discounts...) and costs. Then final price in a document is always equal (or higher) as costs.

Especially when additional discounts are used, a simple check in condition maintenance won't bring desired results.

If in exceptional cases still a lower final price should be possible, use a manual discount after mininum price surcharge.

Regards,

Christian

0 Kudos

Hi Ravi,

We are also having similar problem as explained you in the beginning of this thread. Did you get solution for this problem? Please share with me if you have already resolved.

Regards,

Ramesh

Former Member
0 Kudos

Ravi - Same issue here. Did you get a solution to this problem. Please let me know