cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 
Read only

Enqueue Read Validation

0 Likes
788

Hi,

We are having a Z table containing credit limit wrt customer, business, payment terms and an Unique Id. Whenever this Unique Id is attached to any sale order @ Sales order creation or Sales order change, the payment terms gets attached with the order.

Also, the credit limit gets consumed accordingly wrt current order value and the orders in which this Unique Id is attached. For correct credit limit consumption, we have enabled lock/Enqueue for the orders wrt Unique Id(thats like, users cannot simultaneously save multiple orders with same Unique Id, it happens one by one)

Question:

1. Business says, we are unable to process orders simultaneously, they want users to save orders without enqueue, still want correct credit limit consumption - Is there anyway out for this?

2. Can we do like this - While doing Enqueue while creating or changing order containing Unique Id, can we pass capping credit limits for each simultaneous order save in SM12 and read the same in "USEREXIT_SAVE_DOCUMENT" and use below code to stop further processing of order -- Will there be a sales order number skip as SO number would get generated in this exit?

MESSAGE Sxxx. "to tell the user what's the problem
PERFORM FOLGE_GLEICHSETZEN(SAPLV00F).
FCODE = 'ENT1'.
SET SCREEN SYST-DYNNR.
LEAVE SCREEN.

While we do understand, validations have to happen in USEREXIT_SAVE_DOCUMENT_PREPARE, but we are not getting the exact SO value in USEREXIT_SAVE_DOCUMENT_PREPARE, as freight and tax computation happens only in "USEREXIT_CHECK_VBAK" or in "USEREXIT_CHECK_VBAP".

Waiting for your suggestions

With Regards,
Jagan

Accepted Solutions (1)

Accepted Solutions (1)

RaymondGiuseppi
Active Contributor
0 Likes

Strange, as SAP also does its check in the main form beleg_sichern, something seems wrong in your current user-exits there, some forms intended for check are used for update, you should correct this first, use forms like USEREXIT_MOVE_FIELD or PREPARE instead of CHECK.

Only lock the credit record in USEREXIT_SAVE_DOCUMENT_PREPARE, last statements suggested, if already locked, stop saving with gf_exit_save_document_prepare = 'X' and a message 'sorry locked, please try again', if not locked and not enough credit, unlock, send a message 'no more credit' and stop saving in the same way. Otherwise, register the credit limit update in any FM update task. The commit will release the record.

In USEREXIT_SAVE_DOCUMENT it's too late, you can only abort the transaction in case of failure, so user input is lost.

SAP also provides such a credit limit in the standard, was not accepted?

0 Likes

Thanks for your response Raymond, this helped.

Answers (0)