Skip to Content
-1

How to using lock object by row

Hi all,
i need your advice,

i have screen and i create lock object,

i need when user1 open no.bill ex : 1-10 and change it, screen will input = 1.
and then when user 2 open no.bill ex : 8 - 12 , screen output no.bill 8-10 equal = 0 because user 1 opened it and no.bill 11-12 screen output = 1.

how can lock object inside loop ?

this is my code.

PROCESS BEFORE OUTPUT.
  MODULE status_0100.
  MODULE init.
  LOOP AT it_show WITH CONTROL tc_0001
  CURSOR tc_0001-current_line.
    MODULE icon_status.
    MODULE lock_object.
    MODULE screen_control.
    MODULE moveback_to_screen.
  ENDLOOP.


"------------------
MODULE lock_object.
DATA : lv_uname TYPE sy-msgv1,
       lv_msg   TYPE c LENGTH 40.

  CALL FUNCTION 'ENQUEUE_EZLOSD_TRIP_BBO2'
    EXPORTING
      mode_zsdtb_trip_bbo2 = 'E'
      mandt                = sy-mandt
      no_bill              = it_show-no_bill
    EXCEPTIONS
      foreign_lock         = 1
      system_failure       = 2
    OTHERS                 = 3.
  IF sy-subrc <> 0.
*    lv_uname = sy-msgv1.
*    CONCATENATE 'Data has been locked by :' lv_uname INTO lv_msg
*    SEPARATED BY space.
*    MESSAGE i000(zmm) WITH lv_msg DISPLAY LIKE 'E'.
    gv_error2 = 'X'.
  ENDIF.
ENDMODULE.

Thank You

usr1.png (14.7 kB)
usr-2.png (16.7 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jun 24 at 05:53 AM

    Hi

    You can make it disable as below

      CALL FUNCTION 'ENQUEUE_EZLOSD_TRIP_BBO2'
        EXPORTING
          mode_zsdtb_trip_bbo2 = 'E'
          mandt                = sy-mandt
          no_bill              = it_show-no_bill
        EXCEPTIONS
          foreign_lock         = 1
          system_failure       = 2
        OTHERS                 = 3.
      IF sy-subrc <> 0.
           LOOP AT screen.               "<===== screen loop
               SCREEN-INPUT = 0.    " Disable for input
               MODIFY SCREEN.
          ENDLOOP.                         "<=== screen loop
        gv_error2 = 'X'.
      ENDIF.
    
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 24 at 09:01 AM

    Not related to your question, but please don't lock during the PBO because you shouldn't lock at each input of the user, or at each scroll of the screen.

    Instead, I propose that you lock before displaying the screen, store the lock status in an intermediate field of the internal table IT_SHOW, don't display that field, and in PBO test this field to make fields input-capable or output-only.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.