Enqueue and dequeue in SAP ABAP

Enqueue - It is used to lock the database while updating the database. Because values are not overlapped.

Dequeue - It is used to unlock the database after updating the database.


In This scenario I am updating the date in database TVARVC.




Report

    REPORT zab_rp_enqueue_dequeue.

    PARAMETERS: p_date TYPE sy-datum.
    CONSTANTS: g_c_po_date TYPE string VALUE 'ZAB_DATE1'.
    DATA(lv_yearp_date+0(4).
    DATA(lv_monp_date+4(2).
    DATA(lv_datep_date+6(2).
    CONCATENATE lv_year lv_mon lv_date INTO DATA(lv_final).
    CALL FUNCTION 'ENQUEUE_E_TABLE'
      EXPORTING
        mode_rstable   'E'
        tabname        'TVARVC'
      EXCEPTIONS
        foreign_lock   1
        system_failure 2
        OTHERS         3.

     IF sy-subrc 0.

      UPDATE tvarvc SET low lv_final WHERE name g_c_po_date.
      IF sy-subrc 0.
        MESSAGE  TEXT-001 TYPE 'S'.   " Date is updated into database
      ENDIF.
      CALL FUNCTION 'DEQUEUE_E_TABLE'
        EXPORTING
          mode_rstable 'E'
          tabname      'TVARVC'.

      ELSE.
          MESSAGE TEXT-002 TYPE 'E'.  " Date is not updated into database.
      ENDIF.

Input

Output


Checking

    * Goto SE11 T-code.

    * Give table name TVARVC.

    * Execute and give name 'ZAB_DATE1'.


******************************Thank You***************************

Comments

Popular posts from this blog

Pf status and user command in factory method - OOPS ALV in ABAP

fetch the data from table and send an email in ABAP

Enhancements in abap