Regarding Function Module for Locking ( enque)

Hi,
I am facing a Problem that is when iam running Call transaction one popup is coming because some other user currently editing that Tcode at that time i need to lock tcode using enque specially for table . If suppose some other user editing at that time it will shoe that popup and it will exit from their with out doing any other process For that i need Function module for Lock and Delock.
thanks in advance,
murali krishna.

So in this example, I am doing a loop and check for a lock, if I don't get one, I wait for 5 seconds, this loop continues untill 30 seconds, no lock then it quits and gives message.
report zrich_0001.
data: counter type i.
parameters: p_equnr type equi-equnr.
start-of-selection.
  clear counter.
  do.
Exhausted,  no luch in getting a lock, get of of DO loop.
    if counter > 6.
      sy-subrc = 1.
      exit.
    endif.
Try for lock
    call function 'ENQUEUE_EIEQUI'
      exporting
        mode_equi            = 'E'
        mandt                = sy-mandt
        equnr                = p_equnr
   _wait                = 'X'
      exceptions
        foreign_lock         = 1
        system_failure       = 2
        others               = 3.
Got a lock, get out of DO loop.
   if sy-subrc  = 0.
      exit.
    endif.
Still here?  Then wait another 5 seconds
    wait up to 5 seconds.
    counter = counter  + 1.
  enddo.
Report status
  case sy-subrc.
    when  0.
      message s001(00) with 'Lock could not be established'.
    when  1.
      message i001(00) with 'Lock could not be established'.
  endcase.
Regards,
rewards point

Similar Messages

  • Regarding Function module for validating Date

    Hi ,
    Cananybody tell me that is there any function mdoule for validating the BGDDA and ENDDA.

    dear ,
    See if you are using it in the input parameter then you dont need to validate .
    Beacuse selection option has that option .
    secondlly if you are checking internally then is could be done simplly by if condition
    regds ankit

  • Function Module for Excise and VAT Calculation

    Dear All,
    I required one Function module for calculation of Excise % and amount of Invoice Verification Document.
    We are use TAXINN tax procedure. I am try to make Purchases Register where we required the Break up of Full tax amount as basic excise duty, Education Cess, S&H Education Cess and VAT Amount.
    Thanks
    Mukesh

    Hi,
    Locks are usually appliend on Tables. So you could find the table names affecting.
    Then you could goto SE11 and n Lock objects search for table name
    Once you identify the lock object. Display. Goto->Lock Modules.
    You will get 2 module names one for enqueue and 1 for dequeue.
    e.g. Lock object EBKK_ACCNT.
    and FMs are DEQUEUE_EBKK_ACCNT and ENQUEUE_EBKK_ACCNT
    Hope this helps.
    Regards
    Megha

  • How to create ENQUEUE function module for s567 table

    Hi Experts,
    Anyone Plz tell the steps how to create a ENQUEUE function module for the table s567.
    Its somewht urgent, plz help me.
    <REMOVED BY MODERATOR>
    Mohana
    Edited by: Alvaro Tejada Galindo on Mar 10, 2008 4:21 PM

    Hi,
    You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
    Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
    Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
    Technicaly:
    When you create a lock object System automatically creat two function module.
    1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
    2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
    You have to use these function module in your program.
    Hope this will give a basic idea.
    Regards
    Sudheer

  • Functional module for automatic creation of pur requisition & pur order

    hello,
    what is the functional module for automatic creation of puchase requisition and automatic creation of purchase order which we will assign in action box in service order processing management.
    please let me know as early as possible
    regards,
    rajesh kumar raju

    Hi,
             Please check with following.
    IDOC_INPUT_ACC_PURCHASE_REQUI
    IDOC_INPUT_ACC_PURCHASE_ORDER
    /ISDFPS/OR_PURCHASE_ORDER_CR
    BS01_PURCHASE_DOCUMENT_CREATE
    CO_MP_CREATE_PURCHASE_ORDER
    Thanks & Regards
    Sadhu Kishore

  • Function module for calculating planned and actual cost of production order

    Hi ,
    Do we have any standard function module for calculating planned and actual cost for production order?
    i need to implement this in a Z-report.
    Thanks
    Srini

    Hi,
    try below function module
    CRMCO_GET_PLAN_ACTUAL_COSTS
    CO_IH_GET_PLANNED_COSTS_TOTAL
    Regards,
    Sankaran

  • How to create the INBOUND Function Module for INBOUND IDOCs

    Hi Friends,
    Can any Suggest me How to proceed to Create an INBOUND Function Module for Processing the INBOUND IDOCS
    which are recieved from XI Server ?
    I am working in SAP-ISU
    Here i will recieve the INBOUND IDOCs for the Meter Reading Orders.
    We have a Standard INBOUND FUNCTION MODULE
    IDOC_INPUT_ISU_MR_UPLOAD
    which Uploads the Meter Reading Results.
    I copied the Same function Module into ZIDOC_INPUT_
    and working on it.
    Can any one suggest me, whether i am going in correct way or not.
    In IDOC_INPUT_ISU_MR_UPLOAD Inbound fun module,
    BAPI_MTRREADDOC_UPLOAD is used to Update or Insert the Meter Reading Results,
    My requirment is to Insert and Update the Meter Reading Orders which are Inbounded from XI.
    Can I Use the Same BAPI
    BAPI_MTRREADDOC_UPLOAD
    to Update the below fields,
    EABL-SERNR
    EABL-ZWNUMMER
    EABLG-ABLESGR
    EABL-V_ZWSTAND
    EABL-N_ZWSTAND
    EABL-ABLHINW
    EABL-ZSKIPC
    EABL-ADAT
    EABL-ATIMTATS
    EABL-ADATTATS
    EABL-ATIM
    EABL-ZMESSAGE
    EABL-ABLESER(Meter reader number)
    Kindly Suggest me,
    Thanks in Advance,
    Ganesh

    Hello Ganesh
    I think you are going completely astray with you z-function module for IDoc processing.
    If you look at TABLES parameter METERREADINGRESULTS (type BAPIEABLU ) of BAPI_MTRREADDOC_UPLOAD you will find many of the requested fields already:
    EABL-SERNR => BAPIEABLU-SERIALNO
    EABL-ZWNUMMER =>REGISTER
    EABLG-ABLESGR
    EABL-V_ZWSTAND
    EABL-N_ZWSTAND
    EABL-ABLHINW
    EABL-ZSKIPC
    EABL-ADAT
    EABL-ATIMTATS => ACTUALMRTIME
    EABL-ADATTATS => ACTUALMRDATE
    EABL-ATIM
    EABL-ZMESSAGE
    EABL-ABLESER(Meter reader number)
    Field EABL-ZMESSAGE appears to be custom field (at least I cannot find it on ECC 6.0). If this field was added using include CI_EABL then you probably can get these values into the BAPI using the EXTENSIONIN parameter.
    Check routine CHECK_UPLOADRECORDS in the BAPI which allows two extension structures:
    - BAPI_TE_EABL
    - BAPI_TE_EOSB
    Not surprisingly BAPI_TE_EABL contains the include CI_EABL.
    Regards
      Uwe

  • How to config Check Digits function module for Student Number Validation

    Hi SLCM Experts,
    In the SAP-SLCM, How to use check digits function module for validate student number.  Just only config it or need to customizing program.
    *Any idea to student number validation in SLCM?*
    Best Regards,
    Suvatchai K.

    Hi ,
    Can you expalin it further ?
    You configure the St. no in piq_matr . And set it  as external or internal no. range which suits your business .
    What is the validation you are looking for ?
    Regards
    Gajalakshmi

  • Function modules for the following

    Hi,
    I want to know the function modules for the following purposes.
    1) Check whether a date is valid or not
    2) Calculate the no of days between two dates.
    Expecting an early response.
    Thanks n Regards,
    Amit

    Hi,
    PARAMETERS: p_list LIKE t009b-bumon AS LISTBOX
                         VISIBLE LENGTH 11 OBLIGATORY ,
                p_list1 LIKE t009b-bdatj OBLIGATORY.
    SELECTION-SCREEN POSITION POS_HIGH.
    PARAMETERS: p_list2 LIKE t009b-bumon AS LISTBOX
                          VISIBLE LENGTH 11 OBLIGATORY,
                p_list3 LIKE t009b-bdatj OBLIGATORY.
    Calling Function Module for calculating no of days between the
    selected period
        CALL FUNCTION 'NUMBER_OF_DAYS_PER_MONTH_GET'
             EXPORTING
                  par_month = p_list
                  par_year  = p_list1
             IMPORTING
                  par_days  = ws_n_days.
        CALL FUNCTION 'NUMBER_OF_DAYS_PER_MONTH_GET'
             EXPORTING
                  par_month = p_list2
                  par_year  = p_list3
             IMPORTING
                  par_days  = ws_n_days1.
    For Concatenating the month and year into the date format
        CONCATENATE  p_list1  p_list ws_i INTO ws_c_date1.
        CONCATENATE p_list3  p_list2 ws_n_days1 INTO ws_c_date2.
      date = ws_c_date1 - ws_c_date2.
    In the above sample code the selection screen has month and year as input.
    Also check this link
    http://www.sapdevelopment.co.uk/tips/date/datehome.htm
    Check FM
    <b>RP_CALC_DATE_IN_INTERVAL</b> Add/subtract years/months/days from a date
    <b>SD_DATETIME_DIFFERENCE</b> Give the difference in Days and Time for 2 dates
    <b>Also for checking valid date:</b>
    U can specify the date field as
    Select-options:  s_date like likp-date(similar to ur requirement)
    This itself ceck for the valid date no seperate validation needed.
    Thanks & Regards,
    Judith.

  • Function Module for open Purchase Order & Sales Order?

    Hi, commonly I read the data from tables and calculate the open quantity for sales order and purchase order, but I want to know, are there any standard function modules for getting the list of open "purchase order" and "sales order" respectively?
    Thanks and Regards.

    hi Ren,
    u can check all these bapi's related to salesorder
    BAPI_SALESORDER_CHANGE Sales order: Change Sales Order
    BAPI_SALESORDER_CONFIRMDELVRY Sales Order: Confirmation of Delivery; Document Flow Update
    BAPI_SALESORDER_CREATEFROMDAT1 Sales order: Create Sales Order
    BAPI_SALESORDER_CREATEFROMDAT2 Sales order: Create Sales Order
    BAPI_SALESORDER_CREATEFROMDATA Create Sales Order, No More Maintenance
    BAPI_SALESORDER_GETLIST Sales order: List of all Orders for Customer
    BAPI_SALESORDER_GETSTATUS Sales Order: Display Status
    BAPI_SALESORDER_SIMULATE Sales Order: Simulate Sales Order
    May be this FM can help you
    MB_ADD_PURCHASE_ORDER_QUANTITY (Reading and adding open purchase order quantities)
    Regards,
    Naveen

  • Function module for GL account open items at a key date

    Is there a function module for "GL account open items at a key date" similar to following for customer and vendor accounts?
    BAPI_AR_ACC_GETOPENITEMS Customer account open items at a key date
    BAPI_AP_ACC_GETOPENITEMS Vendor account open items at a key date
    If not, please suggest any alternatives. I am looking to capture the output of FBL3N (GL account line item display) in a program.
    Thank you in advance.
    Prasanna Pujari

    hi,
    please go through the below link i think it will help u.
    http://sapfunctional.com/FI/GL/Balance.
    Regard
    Abhishek Tripathi

  • Function Module for outline agreement

    Dear Sir,
    I want to know the function module for contract/outline agreement from where I can fetch the details of release orders against the given contract.
    Regards
    Amit Agarwal

    Hi
    Go to SE37 enter the Outline agreement and press F4
    you can see the function module
    (or) Post the same message in  SAP ABAP forum
    G.Ganesh Kumar

  • Function Module for Job reschedule

    Hello Experts,
    Is there a function module for job rescheduling as i need to create a automation program where i need to select all jobs from excel sheet and reschedule at different time.
    Thanks and Regards,
    Nikhil Kanegaonkar.

    You could use the following FM
    - [BP_JOB_READ|http://www.sdn.sap.com/irj/scn/advancedsearch?query=bp_job_read] (read first from TBTCO to fill field JOBCOUNT)
    - [BP_JOB_CREATE|http://www.sdn.sap.com/irj/scn/advancedsearch?query=bp_job_create] (change schedule parameters first)
    - for recent versions [BP_JOB_COPY|http://www.sdn.sap.com/irj/scn/advancedsearch?query=bp_job_copy]
    You should take a look at FM of the FG BTCH and SAP documentation like [Programming with the Background Processing System (BC-CCM-BTC)|http://help.sap.com/saphelp_nwpi71/helpdata/en/fa/096c53543b11d1898e0000e8322d00/frameset.htm]
    Regards,
    Raymond

  • Function module for background jobs email

    hi abaper's
                     i hace to create a function module for background jobs this function module have to send an email automatically when a background job is assigned or processed in background.
    thnks n regards
    pardeep kumar

    hi dear
    open this site
    https://weblogs.sdn.sap.com/pub/wlg/781. [original link is broken] [original link is broken] [original link is broken]
    <removed by moderator>
    Edited by: Mike Pokraka on Aug 8, 2008 12:48 PM

  • Error in XXL_FULL_API function module for download report to excel

    Hi all,
    I am using XXL_FULL_API function module for download report to excel, In this FM we have to fill a table called sema        = t_gxxlt_s. in this table we have a fields called
    i_sema-col_no  = 19.
      i_sema-col_src = 19.
      i_sema-col_typ = 'STR'.
      i_sema-col_ops = 'DFT'
    here in 'col_typ' if we put STR in excel it will come as a text but i wnat the time field what i have to pass ?
    and for filed 'col_ops' also ??
    Thaks,
    Sridhar

    Hi sridhar joshi,
    Please check this program
    REPORT Excel.
    TABLES:
      sflight.
    * header data................................
    DATA :
      header1 LIKE gxxlt_p-text VALUE 'Suresh',
      header2 LIKE gxxlt_p-text VALUE 'Excel sheet'.
    * Internal table for holding the SFLIGHT data
    DATA BEGIN OF t_sflight OCCURS 0.
            INCLUDE STRUCTURE sflight.
    DATA END   OF t_sflight.
    * Internal table for holding the horizontal key.
    DATA BEGIN OF  t_hkey OCCURS 0.
            INCLUDE STRUCTURE gxxlt_h.
    DATA END   OF t_hkey .
    * Internal table for holding the vertical key.
    DATA BEGIN OF t_vkey OCCURS 0.
            INCLUDE STRUCTURE gxxlt_v.
    DATA END   OF t_vkey .
    * Internal table for holding the online text....
    DATA BEGIN OF t_online OCCURS 0.
            INCLUDE STRUCTURE gxxlt_o.
    DATA END   OF t_online.
    * Internal table to hold print text.............
    DATA BEGIN OF t_print OCCURS 0.
            INCLUDE STRUCTURE gxxlt_p.
    DATA END   OF t_print.
    * Internal table to hold SEMA data..............
    DATA BEGIN OF t_sema OCCURS 0.
            INCLUDE STRUCTURE gxxlt_s.
    DATA END   OF t_sema.
    * Retreiving data from sflight.
    SELECT * FROM sflight
             INTO TABLE t_sflight.
    * Text which will be displayed online is declared here....
    t_online-line_no    = '1'.
    t_online-info_name  = 'Created by'.
    t_online-info_value = 'KODANDARAMI REDDY'.
    APPEND t_online.
    * Text which will be printed out..........................
    t_print-hf     = 'H'.
    t_print-lcr    = 'L'.
    t_print-line_no = '1'.
    t_print-text   = 'This is the header'.
    APPEND t_print.
    t_print-hf     = 'F'.
    t_print-lcr    = 'C'.
    t_print-line_no = '1'.
    t_print-text   = 'This is the footer'.
    APPEND t_print.
    * Defining the vertical key columns.......
    t_vkey-col_no   = '1'.
    t_vkey-col_name = 'MANDT'.
    APPEND t_vkey.
    t_vkey-col_no   = '2'.
    t_vkey-col_name = 'CARRID'.
    APPEND t_vkey.
    t_vkey-col_no   = '3'.
    t_vkey-col_name = 'CONNID'.
    APPEND t_vkey.
    t_vkey-col_no   = '4'.
    t_vkey-col_name = 'FLDATE'.
    APPEND t_vkey.
    * Header text for the data columns................
    t_hkey-row_no = '1'.
    t_hkey-col_no = 1.
    t_hkey-col_name = 'PRICE'.
    APPEND t_hkey.
    t_hkey-col_no = 2.
    t_hkey-col_name = 'CURRENCY'.
    APPEND t_hkey.
    t_hkey-col_no = 3.
    t_hkey-col_name = 'PLANETYPE'.
    APPEND t_hkey.
    t_hkey-col_no = 4.
    t_hkey-col_name = 'SEATSMAX'.
    APPEND t_hkey.
    t_hkey-col_no = 5.
    t_hkey-col_name = 'SEATSOCC'.
    APPEND t_hkey.
    t_hkey-col_no = 6.
    t_hkey-col_name = 'PAYMENTSUM'.
    APPEND t_hkey.
    * populating the SEMA data..........................
    t_sema-col_no  = 1.
    t_sema-col_typ = 'STR'.
    t_sema-col_ops = 'DFT'.
    APPEND t_sema.
    t_sema-col_no = 2.
    APPEND t_sema.
    t_sema-col_no = 3.
    APPEND t_sema.
    t_sema-col_no = 4.
    APPEND t_sema.
    t_sema-col_no = 5.
    APPEND t_sema.
    t_sema-col_no = 6.
    APPEND t_sema.
    t_sema-col_no = 7.
    APPEND t_sema.
    t_sema-col_no = 8.
    APPEND t_sema.
    t_sema-col_no = 9.
    APPEND t_sema.
    t_sema-col_no = 10.
    t_sema-col_typ = 'NUM'.
    t_sema-col_ops = 'ADD'.
    APPEND t_sema.
    CALL FUNCTION 'XXL_FULL_API'
      EXPORTING
    *   DATA_ENDING_AT          = 54
    *   DATA_STARTING_AT        = 5
       filename                = 'TESTFILE'
       header_1                = header1
       header_2                = header2
       no_dialog               = 'X'
       no_start                = ' '
        n_att_cols              = 6
        n_hrz_keys              = 1
        n_vrt_keys              = 4
       sema_type               = 'X'
    *   SO_TITLE                = ' '
      TABLES
        data                    = t_sflight
        hkey                    = t_hkey
        online_text             = t_online
        print_text              = t_print
        sema                    = t_sema
        vkey                    = t_vkey
    EXCEPTIONS
       cancelled_by_user       = 1
       data_too_big            = 2
       dim_mismatch_data       = 3
       dim_mismatch_sema       = 4
       dim_mismatch_vkey       = 5
       error_in_hkey           = 6
       error_in_sema           = 7
       file_open_error         = 8
       file_write_error        = 9
       inv_data_range          = 10
       inv_winsys              = 11
       inv_xxl                 = 12
       OTHERS                  = 13
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    please refer this link
    http://www.thespot4sap.com/Articles/Download_to_excel.asp
    Best regards,
    raam

Maybe you are looking for

  • How can I Import CA Certificate into a new user profile when it's created

    I need to deploy a CA Root Certificate to new firefox user profile when it is created in windows. I Seen somewhere that you could place a working copy of cert8.db in %programfiles%\firefox-installation-folder\defaults\profile and this would get added

  • Add new items to the top of a list in iWeb

    One of my sites is for a cat charity : www.catsprotectionshop.com When a new cat is added it is easiest to add it to the bottom of the page. The alternative would be to move all the others down to put it at the top. Is there an easy way to move the e

  • Getting Audio/MIDI to recognize my Digidesign 002 rack

    I just upgraded from a G4 with Tiger to an iMac with Leopard. As I wait for Pro Tools LE to upgrade for Leopard compatibility, I thought I'd try to learn Garageband. Although I copied my old hard drive over to my new one and attached my Digi 002 rack

  • VB code not working in all sheets

    Hi, we have one workbbok and it haveing 4 sheets.We written VBA code in the workbook at module level  by useing SAPBEXon refresh.But whenever we refresh workbook VBA code is working for only opend sheet and not working for other sheets.we want VBA co

  • Navigation with a target

    Hi all masters, I have a Question..... I'm working with two frames  ( FR1 and FR2 ) with a tableView in FR1 I'm getting somethings events, (rowselect), and with the data of that row, i need show in the frame FR2 the content of it.. I try with, naviga