Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8635

Re: SAP Lock Concept - Wich User Locks my TCode

$
0
0

Hi,

 

fm ENQUEUE_READ will give you the informations you want.

 

Pass th name of thge lock object to parameter GNAME, pass the lock argument to parameter GARG and pass SPACE to argument GUNAME.

 

Sample:

 

* Call custom lock object

  CALL FUNCTION 'ENQUEUE_MYLOCKOBJ'

    EXPORTING

      sase           = xv_sase

      _scope         = '3' "till the end

    EXCEPTIONS

      foreign_lock   = 1

      system_failure = 2

      OTHERS         = 3.

                                                                                                                                                                                                                                                              

* Check return code

  CASE  sy-subrc.

    WHEN  0.      "lock successful

      xv_lock                 =  'X'.

    WHEN  1.      "foreign lock

      xv_uname                =  text-unk.

      CONCATENATE                sy-mandt

                                 xv_sase

                           INTO  xv_garg.

      CLEAR                      xt_enq.

                                                                                                                                                                                                                                                              

      CALL FUNCTION 'ENQUEUE_READ'

        EXPORTING

          gname  = xk_gname_sase

          garg   = xv_garg

          guname = space

        TABLES

          enq    = xt_enq

        EXCEPTIONS

          OTHERS = 4.

                                                                                                                                                                                                                                                              

      IF  sy-subrc           EQ  0.

        READ  TABLE              xt_enq

                           INTO  xs_enq

                          INDEX  1.

        IF  sy-subrc         EQ  0.

          xv_uname            =  xs_enq-guname.

        ENDIF.

      ENDIF.

                                                                                                                                                                                                                                                              

      MESSAGE  s000(38)

                   DISPLAY LIKE  'E'

                           WITH  text-sas

                                 xv_sase

                                 text-m07

                                 xv_uname.

      EXIT.

    WHEN  OTHERS.  "unknown lock error

      MESSAGE  s000(38)

                   DISPLAY LIKE  'E'

                           WITH  text-sas

                                 xv_sase

                                 text-m04

                                 sy-subrc.

      EXIT.

  ENDCASE.

 

Regards,

 

Klaus


Viewing all articles
Browse latest Browse all 8635

Trending Articles