Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Lock object-in-abap-sap


Published on

lock obects

Published in: Technology

Lock object-in-abap-sap

  1. 1. Creating a Lock Object For WRITE Mode :-Custom Table By using SE11
  2. 2. Its Data
  3. 3. Go to SE11> Select Radio Button Lock Object > Provide Lock Object Name (Starting Letter Should Startwith E only) > Create..Click on Lock Parameter Tab
  4. 4. It will come Automatically
  5. 5. After activating the Lock ObjectAutomatically Two Function Modules will Generate..One for Lock an objectAnother for Unlock an objectThose will show belowWe can see by.. GOTO > Lock Modules in the Lock Object Screen .Upto now just we Created Lock Object for Kunnr Field in ZLCK TableNow we are going to use this lock object in a Custom Program
  6. 6. Custom Report By Using SE38*&---------------------------------------------------------------------**& Report ZAN_L_REPORT*&*&---------------------------------------------------------------------**&*&*&---------------------------------------------------------------------*REPORT ZAN_L_REPORT.TABLES ZLCK.parameters P_KUNNR type screen 100.*&---------------------------------------------------------------------**& Module STATUS_0100 OUTPUT*&---------------------------------------------------------------------** text*----------------------------------------------------------------------*MODULE STATUS_0100 OUTPUT. SET PF-STATUS BACK.* SET TITLEBAR xxx. SELECT SINGLE * FROM ZLCK INTO ZLCK WHERE KUNNR = P_KUNNR. CALL FUNCTION ENQUEUE_EZCUST_INFO EXPORTING MODE_ZLCK = X MANDT = SY-MANDT KUNNR = P_KUNNR X_KUNNR = _SCOPE = 2 _WAIT = _COLLECT = EXCEPTIONS FOREIGN_LOCK = 1 SYSTEM_FAILURE = 2 OTHERS = 3 .** IF SY-SUBRC <> 0. IF sy-subrc = 1.
  7. 7. data lv_msg type string. CONCATENATE This Record is Currently Using by another User sy-uname into lv_msg separated by space. MESSAGE : lv_msg type S display like E. ENDIF.*ENDMODULE. " STATUS_0100 OUTPUT*&---------------------------------------------------------------------**& Module USER_COMMAND_0100 INPUT*&---------------------------------------------------------------------** text*----------------------------------------------------------------------*MODULE USER_COMMAND_0100 sy-ucomm.when BACK. leave to screen 0.endcase.CALL FUNCTION DEQUEUE_EZCUST_INFO EXPORTING MODE_ZLCK = E MANDT = SY-MANDT KUNNR = p_kunnr X_KUNNR = _SCOPE = 3 _SYNCHRON = _COLLECT = .ENDMODULE. " USER_COMMAND_0100 INPUTFlow Logic of Screen 100 ³ GUI BACKPROCESS BEFORE OUTPUT.MODULE STATUS_0100.*
  8. 8. PROCESS AFTER INPUT.MODULE USER_COMMAND_0100.Output :If we want to check any lock object we have to execute the same program two times at once..So here first I am executing first timeFirst Time Output :This above screen is Selection Screen
  9. 9. This below screen will come after executing the above screenKeep this window in open..Andexecute This same Program in second time(Without Closing the above window) U will Get this belowone..
  10. 10. Enjoy Folks BY Anil