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 comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

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

    Hi,

    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.

    Regards,

    Harish

    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      thanks for reply. I am fetching like that only but not working.

      is there any way to lock the sales order creation if already processing to create sales order for same quotation

  • 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 |http://help.sap.com/abapdocu_70/en/ABENSAP_LOCK.htm] if you are not familiar with the concept of lock in SAP.

    Regards,

    Raymond

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

    Add comment
    10|10000 characters needed characters exceeded