Skip to Content

Problem in lock Sales order create with BAPI BAPI_SALESORDER_CREATEFROMDAT2

Hi All,

i have the z program to create the sales order with reff quotation in SD With BAPI BAPI_SALESORDER_CREATEFROMDAT2.

this program will excute every 30 mins .

Problem: Some times if i excute the program in background it is taking morethan 30mins so second batch excution also gets starting to create the sales order for same quotation then it is creating 2 sales orders at atime with 1 quotation.

here i am getting duplicate sales orders so i want to lock the creation of duplicate sales order.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 06, 2011 at 11:10 AM


    How you are fetching the Quotation which should will be passed to the BAPI to create the Sales Order.

    If it is based on the creation date and time of quotation, then always fetch the quotation which are created 30 mins back to the start of the background processing of your Z report.



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 06, 2011 at 11:36 AM

    Some solutions

    - Just lock (ENQUEUE) any object at the start of the job(*), if not locked, you can exit or wait in a loop, will be released at end of job (use a _SCOPE '3' so commit work wont release the lock)

    -> This will insure the job runs only once at a time

    - Lock the quotation before calling the BAPI, will be released by the COMMIT_WORK (from where do you fetch the quotation, if it is a customer Z_table, you can use the lock object that you have surely created ?) (use a _scope '2')

    -> This will insure that at most one job will convert a quotation (i suppose you set a "done" flag or status in the quotation record)

    Read [SAP Locks |] if you are not familiar with the concept of lock in SAP.



    (*) E_TABLEE for table, E_TRDIR for program, anything not required by another process

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.