Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

locking

Former Member
0 Likes
347

hi all,

I would like to investigate the feasibility of changing the way the routing table is currently updated (t-code ZMM_ROUTE). Currently there are a number of users worldwide and when any one person is in the table it locks all others users out of change mode. Since users only see the plants they are authorized to change is it possible to only lock those specific plants when the user is in the transaction? We're seeing problems arise as more SBUs come online that the table is often locked for hours at a time and users cannot make their updates as needed to support the business.

We want to lock this table records based on Shipping Point (ShPt). Right now, users who are editing it will lock the whole table. As certain users will only have authorization to view certain Shipping Points, we can lock the records based on that, instead of the whole table.

1 REPLY 1
Read only

Former Member
0 Likes
309

Abinash,

There are two approaches you can take.

The first is that you only lock, and at the RECORD level when the user has the record up for update and until they save it.

The second, if you need to lock all the records based on a certian field value, You can use code similar to this


*&---------------------------------------------------------------------*
*&      Form  zgrdata_lock
*&---------------------------------------------------------------------*
*      -->P_RETCODE  text
*----------------------------------------------------------------------*
FORM zgrdata_lock USING    p_retcode.

  LOOP AT it_po.

    CALL FUNCTION 'ENQUEUE_EZGRDATA'
         EXPORTING
              mode_zgrdata   = 'X'
              mandt          = sy-mandt
              pronr          = it_po-pspid
*            x_pronr        = ' '
*            _scope         = '2'
*            _wait          = ' '
*            _collect       = ' '
         EXCEPTIONS
              foreign_lock   = 1
              system_failure = 2
              OTHERS         = 3.

    p_retcode = sy-subrc.

    IF sy-subrc <> 0.
      PERFORM zgrdata_unlock.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
  ENDLOOP.

ENDFORM.                    " zgrdata_lock
*&---------------------------------------------------------------------*
*&      Form  zgrdata_unlock
*&---------------------------------------------------------------------*
FORM zgrdata_unlock.

  LOOP AT it_po.

    CALL FUNCTION 'DEQUEUE_EZGRDATA'
         EXPORTING
              mode_zgrdata = 'X'
              mandt        = sy-mandt
              pronr        = it_po-pspid.
  ENDLOOP.
ENDFORM.                    " zgrdata_unlock