ENQUEUE_E_TABLE and DEQUEUE_E_TABLE

Dear all,
Can anybody please tell me the significance of parameters in the above FMs.
i.e.  _SCOPE,  _WAIT, _COLLECT, _SYNCHRON.
Thanks a lot in advance.
Best Regards,
Prasad

Hi Prasad,
please see the link, it explains everything you are asking.
http://help.sap.com/search/highlightContent.jsp
Regards,
Bindu

Similar Messages

  • Hi how to handel the lock and unlock the table

    Hi,
    i am having the one scenario like,for lock and unlock the table i used the function modules ENQUEUE_E_TABLE and  DEQUEUE_E_TABLE but it allowing the edit the first user and suppose to try the editing the second user it is giving the error message it correct but again the second user press any button it is leaving the program it should not happened please help me that.
    regards,
    Hari.

    Hi,
    i assume it's in table JEST
    so select:
      SELECT        * FROM  JEST
               WHERE  OBJNR  =  aufk-OBJNR
                AND   STAT   IN S_STATI
    Andreas

  • Maker and Checker in ABAPHR

    HI,
    I got a requirement in hrabap. Maker can make changes of different perners of different infotypes. After changing, the records get locked. Checker can see the Locked infotypes of the Maker and he Unlock the infotypes. Then these infotypes will be saved in the database.
    My requirement is how to findout the Locked infotypes of the Maker. Is there any function module exits to find out the lock status of all infotypes of the user.
    Regards
    prasad.m

    Hi
    Use function module ENQUEUE_E_TABLE and DEQUEUE_E_TABLE by passing the table name to lock and unlock info types.
    Example:
    Infotype 0001
    Table name is PA0001 for infotype 0001
    Need to pass table name PA0001 to function modules  ENQUEUE_E_TABLE and DEQUEUE_E_TABLE to lock and unlock infotype
    0001.
    Regards
    Srilaxmi

  • Lock object is not working automatically

    Hi experts,
    i have a problem , A table is updated by a program which is used by multiple user . I have used lock function module 'ENQUEUE_E_TABLE ' and 'DEQUEUE_E_TABLE' for that . when updation section occurs first user which come first go through it and for rest users amessage cones 'table is locked by XYZ user' . When first completes the updation resr users is not updating automatically they stand at that position where message comes. How to solve this issue?
    Avadhesh Chandra

    Hi,
    We can lock the table before updating the entries. Two types of locks are there.
    1. To lock the entire table. Here when the table is locked by one program, another program will not be able to modify it.
    2. To lock the particular record only. Here when the record is locked by one program, the other program can modify records other than the one locked.
    For option 1
    Use the FM ENQUEUE_E_TABLEE to lock the table and FM DEQUEUE_E_TABLEE to unlock table.
    For option 2
    Go to SE11. There enter the name of your lock object and create it. Next screen you have to mention which field you want to lock.
    For more info. on LOCK OBJECTS go to
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    If you want to lock the entire table, then use the FM said in option 1 in DO-ENDDO loop. 
    Run the loop till it gets successful (sy-subrc = 0)
    DO.
    *Call the FM.
    IF sy-subrc = 0.
        EXIT.
    ENDIF.
    ENDDO.
    If you want to just try some number of times rather than keep on looping then can use for eg: DO 100 TIMES.

  • Lock entries making problem

    Hi Experts,
    We are facing one problem durring updating the records in background 'Z' transaction. It will update the a record in mm02. The updated record will store in a Z table.
    But while executing mass records(multiple records) its getting error as lock entries. This error also coming after 1000 records. Upto 1000 records we are not getting any error. After this lock entries error comming.
    Can any one pls guide me what will be the reason behind this? Even while updating the 'Z' records we are added the commit work also . Still the same error comming. Kindly guide as.
    Moahana.

    Hi
    I hope you are using ENQUEUE_E_TABLE and DEQUEUE_E_TABLE FM while updated the tables
    Yes Commit statement is very important while updating the records in Tables
    Regards
    Renu Gusain

  • FM to lock the Table

    Could anybody check and tell me whether Function Module ENQUEUE_E_TABLE
    and DEQUEUE_E_TABLE are working fine and if it is so let me know the Parameters used for it.
    Full reward points for issue solver.
    Regards,
    Amol

    hi..
    check out the following documentation
    Lock objects are used to lock the database table while making the modifications on the database table.
    you can create your own lock objects using SE11.
    if you create lock objects on any table system will create two function modules.
    1.ENQUEUE....
    2.DEQUEUE.....
    first one is used to lock the table
    second one used to removing lock on the table.
    lock Table
    CALL FUNCTION 'ENQUEUE_E_TABLE'
    EXPORTING
    tabname = table_name
    EXCEPTIONS
    foreign_lock = 1
    system_failure = 2
    OTHERS = 3.
    Unlock Table
    CALL FUNCTION 'DEQUEUE_E_TABLE'
    EXPORTING
    tabname = table_name
    check this link :
    http://help.sap.com/saphelp_40b/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    _SCOPE = 1: The lock is not sent to the update program. The lock is removed when the transaction is ended.
    _SCOPE = 2: The lock is sent to the update program. The update program is responsible for removing the lock. The dialog program which requested the lock no longer has an influence on the lock behavior. This is the standard setting for the ENQUEUE function module.
    _SCOPE = 3: The lock
    Re: lock objects
    Managingin lock entries
    http://help.sap.com/saphelp_nw04/helpdata/en/37/a2e3ae344411d3acb00000e83539c3/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/7b/f9813712f7434be10000009b38f8cf/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/cb/168237d30d974be10000009b38f8cf/frameset.htm
    <b>Reward points if useful</b>
    Regards
    Ashu

  • Differeence between Lock object and enqueue_e_table

    Hi  ,
    what is diff between Lock object and enque_e_table.  Where to use enqueue_e_table and where to use lock object.
    I think with a lock object i can lock more than one table (passing tables  in secondary table). Please correct me.

    A lock object does not really "lock a table" though most of lock objects refer to a database table.
    I explain:
    The principle is that when 2 programs lock at the same time with the same lock object, only the first will succeed.
    If you have a program which does not use the lock, it may update the database table without any problem.
    All programs which update a table have to use the same lock object. Note that users are always able to update this table via SM30 as they don't know the lock object to be used.
    enqueue_xxxx is the name of the generated function module used to lock the xxxx lock object. E_TABLE lock is ONLY used by SM30 if I remember well, so that to prevent one table from being updated via SM30 by 2 persons at the same time. But it is not related at all with programs which would also update this table.
    Edited by: Sandra Rossi on Mar 14, 2010 9:53 PM

  • DEQUEUE_E_TABLE  is not working

    Hi All,
    We have a locked a Ztable by using the FM  "ENQUEUE_E_TABLE"  and the in SM12 we can see that the table is locked.
    We are unlocking the ztable by uing the FM  "DEQUEUE_E_TABLE" but  when we check in SM12 the loked  entery is not unlocked  .can any one help us what is the issue with "DEQUEUE_E_TABLE " FM.
    Regards
    cb

    Hi  ,
    for locking
    FORM F_LOCK_TABLE  USING    P_GV_TABLE_NAME.
      DATA : lv_varkey TYPE rstable-varkey.
      lv_varkey = sy-mandt.
        CALL FUNCTION 'ENQUEUE_E_TABLE'
         EXPORTING
           TABNAME              = P_GV_TABLE_NAME
           VARKEY               = lv_varkey
         EXCEPTIONS
           FOREIGN_LOCK         = 1
           SYSTEM_FAILURE       = 2
           OTHERS               = 3.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    ENDFORM.  
    for unlocking
    FORM F_UNLOCK_TABLE  USING    P_GV_TABLE_NAME.
    CALL FUNCTION 'DEQUEUE_E_TABLE'
    EXPORTING
       TABNAME            = P_GV_TABLE_NAME.
    ENDFORM.
    between this we are doing chages to ztable.
    Regards
    cb

  • Table lock in Batch jobs

    There is a program which runs in batch mode every 30 mins. After successful execution, program updates last run time stamp in a Z table. For each sales org we set one batch job, like this there are several jobs running in same time & some jobs are not updating time stamp. My gut feeling is reason could be table lock. We canu2019t ask batch team to schedule  all jobs in sequential manner with in 30 mins duration because of huge number of jobs.
    How we can overcome this problem.. Check for table lock using ENQUEUE_E_TABLES and wait for some time is feasible solution? Can some one guide me in this regard please?
    Thanks in advance.

    Hi Perez C,
    you may try ENQUEUE and skip for reprocessing, you can also set WAIT = 'X' in the  ENQUEUE call. This will wait a pre-set time (default I think like 3 seconds) trying to lock the object. In most cases it helps. But if you can not lock successfully, you should write it to application log at least.
    Regards,
    Clemens

  • Lock a program

    Dear all,
    For my case, i've a main program(Prog AAA) and subprogram(Prog BBB). Where user will execute prog AAA, in turn it will schedule prog BBB to run in background by using FM BP_EVENT_RAISE.
    Now the prob is happen on prog BBB, where it does perform BDC transaction update. And i want to place a lock on prog AAA to block someone to execute prog AAA at the same time. And i will release the lock in prog BBB to reach a consistence stage.
    This is what i plan to do:
    Prog AAA:
    ...Place lock by passing in program name AAA as lock argument.
    Prog BBB:
    ...BDC code for transaction update
    ...Release lock with argument program name AAA.
    Basically i did tried to place the lock in prog AAA by using FM ENQUEUE_E_TABLE, 'AAA' as lock argument. But too bad because the lock will be released by system once prog AAA finish.
    So i would like to check with you if there any FM or tools that can be used to retain the lock till i explicitly dequeue it?
    Please comment.

    Dear all,
    I did tried on both FM ENQUEUE_E_TABLE and ENQUEUE_ESFUNCTION, it doesn't work. I have tried to used locking scope 1/2/3/, no luck.
    I want to place a lock at the begining execution of prog AAA by using lock argument "AAA", where the unlock will be placed at last stage of prog BBB. Purpose is to ensure a consistent stage of update at prog BBB, because prog AAA can be executed more than 1 time within the single minute.
    Prog AAA is to call the event(as i mentioned in my first post) to schedule prog BBB run in background, then prog AAA will finish its own part and then transaction end. Since the dialog step end, regardless of what scope value i used (either 1/2/3) system will release the lock automatically.
    For my case, i want the lock retain and it will be release by prog BBB.
    Could you please comment..
    Thanks in advance.

  • Problems with ENQUEUE_E_TABLE/DEQUEUE_E_TABLE

    Hi all,
    i use the above FMs in this case.
    REPORT ZGRO_TEST1 MESSAGE-ID ZZ.
    PARAMETERS: P_LOCK   RADIOBUTTON GROUP PRI1 DEFAULT 'X',
                P_UNLOCK RADIOBUTTON GROUP PRI1.
    DATA: TABLE LIKE  RSTABLE-TABNAME VALUE 'MSEG'.
    START-OF-SELECTION.
      CASE P_LOCK.
        WHEN 'X'.
          CALL FUNCTION 'ENQUEUE_E_TABLE'
            EXPORTING
              TABNAME        = TABLE
            EXCEPTIONS
              FOREIGN_LOCK   = 1
              SYSTEM_FAILURE = 2
              OTHERS         = 3.
          IF SY-SUBRC <> 0.
            WRITE: / 'P_LOCK', SY-SUBRC.
            EXIT.
          ENDIF.
        WHEN OTHERS.
          CALL FUNCTION 'DEQUEUE_E_TABLE'
            EXPORTING
              TABNAME        = TABLE
            EXCEPTIONS
              FOREIGN_LOCK   = 1
              SYSTEM_FAILURE = 2
              OTHERS         = 3.
          IF SY-SUBRC <> 0.
            WRITE: / 'P_UNLOCK', SY-SUBRC.
            EXIT.
          ENDIF.
      ENDCASE.
    END-OF-SELECTION.
    When i run with P_LOCK = 'X' and look in SM12 nothing is locked.
    What mistake is in my report?
    Regards, Dieter

    Hi
    i executed ur program and checked the entries in sm12.
    there exists an entry in sm12 for the program code  in TRDIR table .
    it shows an exclusive lock placed on the table which could be deleted as well
    by checking the other radiobutton.
    i suggest you to check the locked entry in TRDIR table , by entering your program name in the selection screen .
    plz revert if the issue persists
    Regards
    Pankaj

  • How to trigger pop-up window in report and update data base from report

    Hi All,
    I have a requirement, in a report output list to trigger a pop up window with some rejection codes corresponding to each sales order when i select from the output list. Also i need to update data base by selecting one of the rejection code in the pop-up window list for that sales order. Can any one please let me know how to achive this.
    Also, i have check boxes for each record in the output list. Also, i have added one more check box as "Select All'. When select 'Sleect All' check box , all check boxes need to be checked, how to achieve this. PLease let me know.
    Thanks in advance.
    Regards,
    Rajesh

    Hi check this code of editable ALV report... I updated the data base with the changes made..in the editable ALV
    *& Report ZJAY_EDIT_ALV
    REPORT zjay_edit_alv.
    * TYPE-POOLS *
    TYPE-POOLS: slis.
    * INTERNAL TABLES/WORK AREAS/VARIABLES
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
    i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
    w_field TYPE slis_fieldcat_alv,
    p_table LIKE dd02l-tabname,
    dy_table TYPE REF TO data,
    dy_tab TYPE REF TO data,
    dy_line TYPE REF TO data.
    * FIELD-SYMBOLS *
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
    <dyn_wa> TYPE ANY,
    <dyn_field> TYPE ANY,
    <dyn_tab_temp> TYPE STANDARD TABLE.
    * SELECTION SCREEN *
    PARAMETERS: tabname(30) TYPE c DEFAULT 'MARA',
    lines(5) TYPE n DEFAULT 7.
    * START-OF-SELECTION *
    START-OF-SELECTION.
    * Storing table name
    p_table = tabname.
    * Create internal table dynamically with the stucture of table name
    * entered in the selection screen
    CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
    ASSIGN dy_table->* TO <dyn_table>.
    IF sy-subrc <> 0.
    MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'.
    LEAVE TO LIST-PROCESSING.
    ENDIF.
    * Create workarea for the table
    CREATE DATA dy_line LIKE LINE OF <dyn_table>.
    ASSIGN dy_line->* TO <dyn_wa>.
    * Create another temp. table
    CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
    ASSIGN dy_tab->* TO <dyn_tab_temp>.
    SORT i_fieldcat BY col_pos.
    * Select data from table
    SELECT * FROM (p_table)
    INTO TABLE <dyn_table>
    UP TO lines ROWS.
    REFRESH <dyn_tab_temp>.
    * Display report
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    i_structure_name = p_table
    i_callback_user_command = 'USER_COMMAND'
    i_callback_pf_status_set = 'SET_PF_STATUS'
    TABLES
    t_outtab = <dyn_table>
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    ENDIF.
    *& Form SET_PF_STATUS
    * Setting custom PF-Status
    * -->RT_EXTAB Excluding table
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
    SET PF-STATUS 'ZSTANDARD'. "copy it from SALV func group standard
    ENDFORM. "SET_PF_STATUS
    *& Form user_command
    * Handling custom function codes
    * -->R_UCOMM Function code value
    * -->RS_SELFIELD Info. of cursor position in ALV
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    * Local data declaration
    DATA: li_tab TYPE REF TO data,
    l_line TYPE REF TO data.
    * Local field-symbols
    FIELD-SYMBOLS:<l_tab> TYPE table,
    <l_wa> TYPE ANY.
    * Create table
    CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
    ASSIGN li_tab->* TO <l_tab>.
    * Create workarea
    CREATE DATA l_line LIKE LINE OF <l_tab>.
    ASSIGN l_line->* TO <l_wa>.
    CASE r_ucomm.
    * When a record is selected
    WHEN '&IC1'.
    * Read the selected record
    READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
    rs_selfield-tabindex.
    IF sy-subrc = 0.
    * Store the record in an internal table
    APPEND <dyn_wa> TO <l_tab>.
    * Fetch the field catalog info
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_structure_name = p_table
    CHANGING
    ct_fieldcat = i_fieldcat
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    IF sy-subrc = 0.
    * Make all the fields input enabled except key fields
    w_field-input = 'X'.
    MODIFY i_fieldcat FROM w_field TRANSPORTING input
    WHERE key IS INITIAL.
    ENDIF.
    * Display the record for editing purpose
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    i_structure_name = p_table
    it_fieldcat = i_fieldcat
    i_screen_start_column = 10
    i_screen_start_line = 15
    i_screen_end_column = 200
    i_screen_end_line = 20
    TABLES
    t_outtab = <l_tab>
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc = 0.
    * Read the modified data
    READ TABLE <l_tab> INDEX 1 INTO <l_wa>.
    * If the record is changed then track its index no.
    * and populate it in an internal table for future
    * action
    IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
    <dyn_wa> = <l_wa>.
    i_index = rs_selfield-tabindex.
    APPEND i_index.
    ENDIF.
    ENDIF.
    ENDIF.
    * When save button is pressed
    WHEN 'SAVE'.
    * Sort the index table
    SORT i_index.
    * Delete all duplicate records
    DELETE ADJACENT DUPLICATES FROM i_index.
    LOOP AT i_index.
    * Find out the changes in the internal table
    * and populate these changes in another internal table
    READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
    IF sy-subrc = 0.
    APPEND <dyn_wa> TO <dyn_tab_temp>.
    ENDIF.
    ENDLOOP.
    * Lock the table
    CALL FUNCTION 'ENQUEUE_E_TABLE'
    EXPORTING
    mode_rstable = 'E'
    tabname = p_table
    EXCEPTIONS
    foreign_lock = 1
    system_failure = 2
    OTHERS = 3.
    IF sy-subrc = 0.
    * Modify the database table with these changes
    MODIFY (p_table) FROM TABLE <dyn_tab_temp>.
    REFRESH <dyn_tab_temp>.
    * Unlock the table
    CALL FUNCTION 'DEQUEUE_E_TABLE'
    EXPORTING
    mode_rstable = 'E'
    tabname = p_table.
    ENDIF.
    ENDCASE.
    rs_selfield-refresh = 'X'.
    ENDFORM. "user_command

  • Change and Save records on ALV List

    Hi,
    i made alv list with fieldcatalog-edit to change records on alv list. But i want to save it to my dictionary table after changed. I think i should use dialog program to do that. The problem is how i can use dialog program.(i dont have an idea which user-command perform fields on alv list) I have used dialog programs before but i am new on this so i am not sure how i can do that. I will be pleased if you can help me.
    Regards.

    Hello Masuke,
    You have to code that in the AT- USER COMMAND event.
    Follow the below sample code.
    If the record is changed then track its index no.
            and populate it in an internal table for future
            action
              IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
                <dyn_wa> = <l_wa>.
                i_index = rs_selfield-tabindex.
                APPEND i_index.
              ENDIF.
            ENDIF.      ENDIF.*   When save button is pressed
        WHEN 'SAVE'.*     Sort the index table
          SORT i_index.*     Delete all duplicate records
          DELETE ADJACENT DUPLICATES FROM i_index.      LOOP AT i_index.*       Find out the changes in the internal table
          and populate these changes in another internal table
            READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
            IF sy-subrc = 0.
              APPEND <dyn_wa> TO <dyn_tab_temp>.
            ENDIF.      ENDLOOP.*     Lock the table
          CALL FUNCTION 'ENQUEUE_E_TABLE'
            EXPORTING
              mode_rstable   = 'E'
              tabname        = p_table
            EXCEPTIONS
              foreign_lock   = 1
              system_failure = 2
              OTHERS         = 3.      IF sy-subrc = 0.*       Modify the database table with these changes
            MODIFY (p_table) FROM TABLE <dyn_tab_temp>.        REFRESH <dyn_tab_temp>.*       Unlock the table
            CALL FUNCTION 'DEQUEUE_E_TABLE'
              EXPORTING
                mode_rstable = 'E'
                tabname      = p_table.      ENDIF.
      ENDCASE.  rs_selfield-refresh = 'X'.
    Hope it helps you.
    Best Regards
    Santosh

  • Enque and Deque

    Hi all,
    Can any one explain with example how to use Enque and Deque to lock a database table?

    this editable alv using this to make change in standard table.
    *& Report  ZALVF
    REPORT  ZALVF.
    TYPE-POOLS                                                      *
    TYPE-POOLS: SLIS.
    INTERNAL TABLES/WORK AREAS/VARIABLES     *
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          I_INDEX TYPE STANDARD TABLE OF I WITH HEADER LINE,
          W_FIELD TYPE SLIS_FIELDCAT_ALV,
          P_TABLE LIKE DD02L-TABNAME,
          DY_TABLE TYPE REF TO DATA,
          DY_TAB TYPE REF TO DATA,
          DY_LINE TYPE REF TO DATA.
    FIELD-SYMBOLS                                                   *
    FIELD-SYMBOLS: <DYN_TABLE> TYPE STANDARD TABLE,
                   <DYN_WA> TYPE ANY,
                   <DYN_FIELD> TYPE ANY,
                   <DYN_TAB_TEMP> TYPE STANDARD TABLE.
    SELECTION SCREEN                                                *
    PARAMETERS: TABNAME(30) TYPE C,
                LINES(100)  TYPE N.
    START-OF-SELECTION                                              *
    START-OF-SELECTION.
    Storing table name
      P_TABLE = TABNAME.
    Create internal table dynamically with the stucture of table name
    entered in the selection screen
      CREATE DATA DY_TABLE TYPE STANDARD TABLE OF (P_TABLE).
      ASSIGN DY_TABLE->* TO <DYN_TABLE>.
      IF SY-SUBRC <> 0.
        MESSAGE I000(Z_ZZZ_CA_MESSAGES) WITH ' No table found'.
        LEAVE TO LIST-PROCESSING.
      ENDIF.
    Create workarea for the table
      CREATE DATA DY_LINE LIKE LINE OF <DYN_TABLE>.
      ASSIGN DY_LINE->* TO <DYN_WA>.
    Create another temp. table
      CREATE DATA DY_TAB TYPE STANDARD TABLE OF (P_TABLE).
      ASSIGN DY_TAB->* TO <DYN_TAB_TEMP>.
      SORT I_FIELDCAT BY COL_POS.
    Select data from table
      SELECT * FROM (P_TABLE)
      INTO TABLE <DYN_TABLE>
      UP TO LINES ROWS.
      REFRESH <DYN_TAB_TEMP>.
    Display report
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = SY-REPID
          I_STRUCTURE_NAME         = P_TABLE
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
          I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
        TABLES
          T_OUTTAB                 = <DYN_TABLE>
        EXCEPTIONS
          PROGRAM_ERROR            = 1
          OTHERS                   = 2.
      IF SY-SUBRC <> 0.
      ENDIF.
    *&      Form  SET_PF_STATUS
          Setting custom PF-Status
         -->RT_EXTAB   Excluding table
    FORM SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'Z_STANDARD'.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  user_command
          Handling custom function codes
         -->R_UCOMM      Function code value
         -->RS_SELFIELD  Info. of cursor position in ALV
    FORM USER_COMMAND  USING    R_UCOMM LIKE SY-UCOMM
                      RS_SELFIELD TYPE SLIS_SELFIELD.
    Local data declaration
      DATA: LI_TAB TYPE REF TO DATA,
            L_LINE TYPE REF TO DATA.
    Local field-symbols
      FIELD-SYMBOLS:<L_TAB> TYPE TABLE,
                    <L_WA>  TYPE ANY.
    Create table
      CREATE DATA LI_TAB TYPE STANDARD TABLE OF (P_TABLE).
      ASSIGN LI_TAB->* TO <L_TAB>.
    Create workarea
      CREATE DATA L_LINE LIKE LINE OF <L_TAB>.
      ASSIGN L_LINE->* TO <L_WA>.
      CASE R_UCOMM.
      When a record is selected
        WHEN '&IC1'.
        Read the selected record
          READ TABLE <DYN_TABLE> ASSIGNING <DYN_WA> INDEX
          RS_SELFIELD-TABINDEX.
          IF SY-SUBRC = 0.
          Store the record in an internal table
            APPEND <DYN_WA> TO <L_TAB>.
          Fetch the field catalog info
            CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
              EXPORTING
                I_PROGRAM_NAME         = 'Z_DEMO_PDF_JG'
                I_STRUCTURE_NAME       = P_TABLE
              CHANGING
                CT_FIELDCAT            = I_FIELDCAT
              EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.
            IF SY-SUBRC = 0.
            Make all the fields input enabled except key fields
              W_FIELD-INPUT = 'X'.
              MODIFY I_FIELDCAT FROM W_FIELD TRANSPORTING INPUT
              WHERE KEY IS INITIAL.
            ENDIF.
          Display the record for editing purpose
            CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
              EXPORTING
                I_CALLBACK_PROGRAM    = SY-REPID
                I_STRUCTURE_NAME      = P_TABLE
                IT_FIELDCAT           = I_FIELDCAT
                I_SCREEN_START_COLUMN = 10
                I_SCREEN_START_LINE   = 15
                I_SCREEN_END_COLUMN   = 200
                I_SCREEN_END_LINE     = 20
              TABLES
                T_OUTTAB              = <L_TAB>
              EXCEPTIONS
                PROGRAM_ERROR         = 1
                OTHERS                = 2.
            IF SY-SUBRC = 0.
            Read the modified data
              READ TABLE <L_TAB> INDEX 1 INTO <L_WA>.
            If the record is changed then track its index no.
            and populate it in an internal table for future
            action
              IF SY-SUBRC = 0 AND <DYN_WA> <> <L_WA>.
                <DYN_WA> = <L_WA>.
                I_INDEX = RS_SELFIELD-TABINDEX.
                APPEND I_INDEX.
              ENDIF.
            ENDIF.
          ENDIF.
      When save button is pressed
        WHEN 'SAVE'.
        Sort the index table
          SORT I_INDEX.
        Delete all duplicate records
          DELETE ADJACENT DUPLICATES FROM I_INDEX.
          LOOP AT I_INDEX.
          Find out the changes in the internal table
          and populate these changes in another internal table
            READ TABLE <DYN_TABLE> ASSIGNING <DYN_WA> INDEX I_INDEX.
            IF SY-SUBRC = 0.
              APPEND <DYN_WA> TO <DYN_TAB_TEMP>.
            ENDIF.
          ENDLOOP.
        Lock the table
          CALL FUNCTION 'ENQUEUE_E_TABLE'
            EXPORTING
              MODE_RSTABLE   = 'E'
              TABNAME        = P_TABLE
            EXCEPTIONS
              FOREIGN_LOCK   = 1
              SYSTEM_FAILURE = 2
              OTHERS         = 3.
          IF SY-SUBRC = 0.
          Modify the database table with these changes
            MODIFY (P_TABLE) FROM TABLE <DYN_TAB_TEMP>.
            REFRESH <DYN_TAB_TEMP>.
          Unlock the table
            CALL FUNCTION 'DEQUEUE_E_TABLE'
              EXPORTING
                MODE_RSTABLE = 'E'
                TABNAME      = P_TABLE.
          ENDIF.
          RS_SELFIELD-REFRESH = 'X'.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDFORM.                    "user_command

  • How to Lock a Transaction for Editing AND VERY minor tab cont. help

    Just two things I need to ask about
    <b>1. How to Lock a Transaction for Editing</b>
    I am currently using the fcode ENQUEUE_E_TABLE. The function works as once the transaction in opened, another cannot access it.
    However, I have two modes in my transction (Display and Edit). <u> What I need to do is If another user has already opened the transaction, the other user can still access the transaction but cannot access the edit mode.</u>
    <b> 2. VERY minor tab cont. help </b>
    I noticed in a table control is being used in a transction you can resize a colunm. <u> How do you disable this </b>?
    and <u> how do you resize the horizontal scroll bar </u> so that you can limit scrolling upto the point where there are field columns?
    Thanks for you help ppl and take care

    Hi chad,
    This link will help u know abty different types of locks that are available:
    http://help.sap.com/saphelp_erp2005/helpdata/en/7b/f9813712f7434be10000009b38f8cf/frameset.htm
    For resizing all u can go to the table settings and u can do it.
    Hope tis helps u,
    Regards,
    Nagarajan.

Maybe you are looking for