Quantcast
Channel: Tweaks
Viewing all articles
Browse latest Browse all 66

ABAP – Power To Kill

$
0
0

OK. The title might look like click bait, but ABAP developers do have the Power to Kill the SAP Session. 😛

This document has provided me the opportunity to flaunt the power of an ABAP team members. You have always undermined the service of an ABAPer. You have used them for SAP house cleaning tasks. But ABAP team members are the backbone of any SAP Project. So never underestimate the powerful ABAPer. 😛

Remember my last article A to Z of AL11? A basis colleague of mine helped me know about the server details/creation of directory etc. Now it was payback time. I was a little tensed, what I might need to offer for the help but my colleague is a simple guy. He just wanted a help with an annoying daily job nothing else. Fewww!! 😉

Now was the time to thank him with my ABAP skill.

Over a tea break, he casually told me that the Basis team has one job scheduled to update some master data. They schedule the job during the lean window time frame after business hours but somehow very often they find some users locking the transaction the basis team needs to update. And if any user is sitting in that material master, the basis job failed and the basis team had to re-run again.

Our Basis Team members were frustrated as they had to monitor the job every day and reschedule it again if it failed.

After hearing his pain, I could empathize with his plight. After all ABAPers are also victim of similar agony. Anyway, I had to return the favor and this was the right time.

Here is the summary of the issue:

There is a batch job which updates the material master (for simplicity assume the data in table MARA) on daily basis. But if some user has logged into that material in MM02 then the job fails to update the material master and logs the lock object error. Basis team has to re-run the job again.

How many times have you opened the SM30 t-code or MM02 or VA02 sessions in the evening and left for home without signing off your system? Now anyone working late night or in another time zone cannot use SM30 to maintain the table you have opened. Next time you are done for the day, log off your SAP system and shut down your machine. It will help global warming and keep the earth green.  (from Gyan Bhandar) 😛

My Basis friend wanted a solution on priority basis.

High level Solution Architecture

  • Check how many users are locking the Material Master transaction.
  • Provide Pop Up warning message to those users to save their session and come out of transaction within 5 minutes.
  • After 5 minutes (time should be configurable and not hard coded), check again for those are still locking the transaction. Provide the 2nd and final warning to save their work within 5 minutes.
  • After further 5 minutes, the material master transaction which the user is locking would be released/closed. All other transactions and sessions which are not interfering with the job is left untouched.

Also Read: Simple SAP Security Breach

Sounds interesting? Now, action time.

Steps:

Identify Users:

Function module ENQUEUE_READ provides the details of locks.

Here, I am going to provide sy-uname = my name as I am going to test this object and don’t want to close other’s sessions.

After full testing, will remove my name with ‘*’ to get all the users.

*** FM to get all lock details of MARA table (like SM12)

<code> CALL FUNCTION 'ENQUEUE_READ'
   EXPORTING
     gname                 = 'MARA'
     guname                = '$SBHANDARE'
   TABLES
     enq                   = gt_lock_details
   EXCEPTIONS
     communication_failure = 1
     system_failure        = 2
     OTHERS                = 3.
 IF sy-subrc &lt;> 0.
   EXIT.
 ENDIF.  </code>

Get active sessions:

Once we know which users are locking our transaction, we need to find out how many sessions are open in the users’ system.

There is a standard ABAP class SERVER_INFO which will give us all active session info.

<code>*** Get all user sessions
 CREATE OBJECT server_info.
 gt_session_list = server_info->get_session_list( with_application_info = 1 ).</code>

Now we need to filter out the sessions which belong to our users with client details.

<code>*** Filter user sessions on the basis of username and client.
 gt_session_list_user = VALUE #( FOR ls_lock_details IN gt_lock_details
                                 FOR ls_session_list IN gt_session_list
                                    WHERE ( user_name = ls_lock_details-guname
                                           AND tenant = sy-mandt )
                                             ( ls_session_list ) ).</code>

By now, we have all open sessions of our target users only.

Time to send warnings and notifications to these stubborn users. May be hard working users. 😛

We use FM ‘POPUP_TO_CONFIRM’ for pop up messages. But there is a catch. POPUP_TO_CONFRIM will give message to the person who is running the report or program. The user who has opened the screen in change mode will not get notification if we use this FM. So, what is the alternative?

Also Read: Can you really restrict developers from executing any t-code?

Chat in SAP. Yes, you read it right. You can send anonymous pop up messages to anyone in your office SAP network. The good thing is they will not be able to find the sender name easily. I hope you are not thinking what I am thinking. Ready for teenage prank? 😀

FM ‘TH_POPUP’ helps us to send pop up messages to any user in the network system. Works perfectly in our scenario.

<code>DATA(gv_msg) = |You are locking Transaction { gv_tcode }. Please save and leave the transaction within 5 Secs!!!|. 

DATA gv_message TYPE sm04dic-popupmsg.  

gv_message = gv_msg.
 
     LOOP AT gt_lock_details INTO gs_lock_details.
 
       CALL FUNCTION 'TH_POPUP'
         EXPORTING
           client         = sy-mandt
           user           = gs_lock_details-guname
           message        = gv_message
         EXCEPTIONS
           user_not_found = 1
           OTHERS         = 2.
 
     ENDLOOP.</code>

Looping through the users table, we can send notification to all the users who are locking our transaction.

Let’s wait from 5 minutes so that users can save the data and close the session.

<code>WAIT UP TO 300 SECONDS.</code>

ABAP Wait statement in SAP Workflow nearly brought my SAP Production system to halt. That is an interesting story which I will tell some other day. I even have the title of the article in mind – “Wait Wait.. do NOT use me”. 😛

After 5 minutes, check again for the list of users who are sitting on our transaction. In between if any new user locks the transaction; this poor guy would only get 5 minutes. They would not get the 2nd warning as the first list of users are getting.

<code>gv_msg = |grrr..You are still locking Transaction { gv_tcode }. Your session will be killed soon!!!|.
     gv_message = gv_msg. 
 
     LOOP AT gt_lock_details ASSIGNING &lt;fs_lock_details>.
 
       CALL FUNCTION 'TH_POPUP'
         EXPORTING
           client         = sy-mandt
           user           = &lt;fs_lock_details>-guname
           message        = gv_message
         EXCEPTIONS
           user_not_found = 1
           OTHERS         = 2.
 
     ENDLOOP.</code>

Wait from final 5 minutes to give the users one more chance to save the data and close the session.

<code>WAIT UP TO 300 SECONDS.</code>

After the 10th minute, take the list of users who are still locking the transaction. They are the guys who have already left for the day or are talking on phone for more than 10 minutes. By the way, with whom would they talk at these late hours? 😛

Action Time.

We will use system kernel call to get all active session details same as t-code SM04.

<code>        "get technical info for the user
         CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_usr_info
           ID 'TID' FIELD &lt;fs_session_list>-logon_hdl
           ID 'WITH_APPL_INFO' FIELD with_appl_info
           ID 'TABLE' FIELD gt_usr_info[].</code>

Here we will get a huge list of multiple rows for each session number (0-6) that the user has opened. Each login by a user is assigned a unique login ID which is generated based on parameters you log in with viz: the client number, system, and language. This session ID has the form of TXX_UXXXXX, where X can be any number 0-9.

Each session then has a session ID which is comprised of first the login ID as described above, with an appended _MX, where X in this case is the session number, 0-6 (session 1-7). So, we are interested in the .session value of this technical list:

modelinfo[0] is for session 1. Similarly [1] and [2] would be for session 2 and 3 respectively.

modeinfo[1].session = T51_U11407_M1

Session 3 would have: modeinfo[2].session = T51_U11407_M2

Now we need to use the ‘/UPD’ value in the technical info to get the exact session used by the user. You guessed it right. UPD must be for Update Mode.

<code>CONCATENATE &lt;fs_lock_details>-gusrvb '/UPD' INTO DATA(gv_value).
 
 READ TABLE gt_usr_info ASSIGNING FIELD-SYMBOL(&lt;fs_usr_info>)
                        WITH KEY value = gv_value.
 IF sy-subrc IS INITIAL.
 "The key for the value is 'modeinfo[X].enq_info'.... we need just the X
    gv_modus_index = &lt;fs_usr_info>-field+9(1).
 ELSE.
    CONTINUE.
 ENDIF.</code>

Now we will do above process and make the list of the users with required sessions which we need to close/kill.

After preparing the final user list, I tried to figure out the right way to kill the session of user but failed if initial attempt.

I tried to do the BDC recording of SM12 with delete functionality but that didn’t work. Not sure, may be I did not have the right authorization. I did not dig deep though.

Also Read: How to Delete Foreign Lock Entries in Debug

Then I researched t-code SM04. I did the BDC recording of it and sent user session number to kill that session.

<code>" call transaction SM04, sync (S), no screens
         CALL TRANSACTION 'SM04'
                 USING bdcdata
                 MODE 'N'
                 UPDATE 'S'.
 
         " Now use bdc to end the session with that session id
         CLEAR bdcdata[].
         PERFORM bdcdaten USING:
           'X' 'SAPMSSY0' '0120',
             ' ' 'BDC_CURSOR' '04/03',
             ' ' 'BDC_OKCODE' '=&amp;OL0'.
         PERFORM bdcdaten USING:
           'X' 'SAPLSKBH' '0800',
             ' ' 'BDC_CURSOR' 'GT_FIELD_LIST-SELTEXT(01)',
             ' ' 'BDC_OKCODE' '=WLSE',
             ' ' 'GT_FIELD_LIST-MARK(01)' 'X',
             ' ' 'BDC_SUBSCR' 'SAPLSKBH          0810SUB810'.
         PERFORM bdcdaten USING:
           'X' 'SAPLSKBH' '0800',
             ' ' 'BDC_CURSOR' 'GT_FIELD_LIST-SELTEXT(01)',
             ' ' 'BDC_OKCODE' '=CONT',
             ' ' 'BDC_SUBSCR' 'SAPLSKBH          0810SUB810'.
         PERFORM bdcdaten USING:
           'X' 'SAPMSSY0' '0120',
             ' ' 'BDC_CURSOR' '04/03',
             ' ' 'BDC_OKCODE' '=PS 63'.
         PERFORM bdcdaten USING:
           'X' 'SAPMSSY0' '0120',
             ' ' 'BDC_CURSOR' '02/76',
             ' ' 'BDC_OKCODE' '=&amp;IC1'.
         PERFORM bdcdaten USING:
           'X' 'SAPMSSY0' '0120',
             ' ' 'BDC_CURSOR' '02/76',
             ' ' 'BDC_OKCODE' '=&amp;ILT'.
         PERFORM bdcdaten USING:
           'X' 'SAPLSSEL' '1104',
             ' ' 'BDC_OKCODE' '=CRET',
             ' ' 'BDC_SUBSCR' 'SAPLSSEL           1105%_SUBSCREEN_FREESEL',
             ' ' 'BDC_CURSOR' '%%DYN001-LOW',
             ' ' '%%DYN001-LOW' gv_ssi_session_id.
         PERFORM bdcdaten USING:
           'X' 'SAPMSSY0' '0120',
             ' ' 'BDC_CURSOR' '04/15',
             ' ' 'BDC_OKCODE' '=&amp;IC1'.
         PERFORM bdcdaten USING:
           'X' 'RSM04000_ALV_NEW' '2000',
             ' ' 'BDC_CURSOR' gv_modus_string,
             ' ' 'BDC_OKCODE' '=DEL'.
         PERFORM bdcdaten USING:
           'X' 'SAPMSSY0' '0120',
             ' ' 'BDC_CURSOR' '04/15',
             ' ' 'BDC_OKCODE' '=&amp;F15'.
 
         " call transaction SM04, sync (S), no screens
         CALL TRANSACTION 'SM04'
                 USING bdcdata
                 MODE 'P'
                 UPDATE 'N'. </code>

Finally let’s go in for the kill and shut down that session(s). Once we do that, we log which session/user/transaction combo we deleted to the spool so that no one can cry foul play later. We gave enough time people!

Don’t feel sorry for closing the sessions. We warned the users twice, gave them 10 minutes to save the thing but if they are still blocking our transaction. We were forced for the attack.

Sometimes, we need to be difficult. Kicking the users out of the system ensures that the overall system is synced with up to date master data.

This is my favorite line from Spiderman “With great power comes great responsibility”. Always use your super power for the good reason. 🙂

Check this video for the output in action:

You can use the below code in your system and execute it. Do not forget to remove the hard code 300 seconds and my sy-uname. If your system is below 7.4, you need to change the new syntax to old and also you might not have some data elements.

Working Code

<code>*&amp;---------------------------------------------------------------------*
 *&amp; Report ZUSER_SESSION_KILL
 *&amp;---------------------------------------------------------------------*
 *&amp;
 *&amp;---------------------------------------------------------------------*
 REPORT zuser_session_kill.
 
 *** Types declarations.
 DATA:BEGIN OF gt_usr_info OCCURS 10,
        field(40),
        value(80),
      END OF gt_usr_info.
 
 *** Variable declarations.
 DATA: gv_time             TYPE string,
       gv_tcode            TYPE eqetcode,
       gv_ssi_session_id   TYPE ssi_session_id,
       gv_modus_num_found  TYPE ssi_session_hdl,
       gv_modus_index_char TYPE numc1,
       gv_message          TYPE sm04dic-popupmsg,
       gv_modus_string     TYPE string,
       gv_modus_index      TYPE string,
       gv_stop             TYPE c,
       th_opcode(1)        TYPE x.
 
 *** Internal table declarations.
 DATA: gt_lock_details      TYPE TABLE OF seqg3,
       gt_session_list      TYPE TABLE OF ssi_session_info,
       gt_session_list_user TYPE TABLE OF ssi_session_info,
       gt_sessions_user     TYPE TABLE OF ssi_session_info.
 
 *** Workareas declarations.
 DATA: server_info     TYPE REF TO cl_server_info,
       bdcdata         LIKE bdcdata OCCURS 0 WITH HEADER LINE.
 
 *** Constants declarations.
 CONSTANTS: opcode_usr_info LIKE th_opcode VALUE 52,
            with_appl_info  TYPE ssi_bool VALUE 1. " this is the internal SAP number
 
 
 CLEAR gv_time.
 
 "To stop the loop processing.
 WHILE gv_stop NE abap_true.
 
   "send notification to users, those who are locking our table, do it till 10 seconds.
   IF gv_time IS INITIAL. " First warning message after 5 minutes
 *** fm to GET all lock details of mara table (like sm12)
     CALL FUNCTION 'ENQUEUE_READ'
      EXPORTING
        gname                 = 'MARA'
        guname                = '$SBHANDARE'
      TABLES
        enq                   = gt_lock_details
      EXCEPTIONS
        communication_failure = 1
        system_failure        = 2
        OTHERS                = 3.
        IF sy-subrc &lt;> 0.
          EXIT.
        ENDIF.
 
 
     DATA(gv_msg) = |You are locking Transaction { gv_tcode }. Please save and leave the transaction within 5 Secs!!!|.
     gv_message = gv_msg.
 
 
     LOOP AT gt_lock_details ASSIGNING FIELD-SYMBOL(&lt;fs_lock_details>).
 
       CALL FUNCTION 'TH_POPUP'
         EXPORTING
           client         = sy-mandt
           user           = &lt;fs_lock_details>-guname
           message        = gv_message
         EXCEPTIONS
           user_not_found = 1
           OTHERS         = 2.
 
     ENDLOOP.
 
     WAIT UP TO 300 SECONDS.
     gv_time = '01'.
 
     FREE: gt_lock_details[], gv_message, gv_msg.
     "send notification to users, those who are locking our table after first notification too, do it from 5 seconds to 45 seconds.
   ELSEIF gv_time = '01'. " Second warning message
 *** FM to get all lock details of MARA table (like SM12)
     CALL FUNCTION 'ENQUEUE_READ'
       EXPORTING
         gname                 = 'MARA'
         guname                = '$SBHANDARE'
       TABLES
         enq                   = gt_lock_details
       EXCEPTIONS
         communication_failure = 1
         system_failure        = 2
         OTHERS                = 3.
     IF sy-subrc &lt;> 0.
       EXIT.
     ENDIF.
 
 
     gv_msg = |Uff...You are still locking Transaction { gv_tcode }. Your session will be killed soon!!!|.
     gv_message = gv_msg.
 
 
     LOOP AT gt_lock_details ASSIGNING &lt;fs_lock_details>.
 
       CALL FUNCTION 'TH_POPUP'
         EXPORTING
           client         = sy-mandt
           user           = &lt;fs_lock_details>-guname
           message        = gv_message
         EXCEPTIONS
           user_not_found = 1
           OTHERS         = 2.
 
     ENDLOOP.
 
     WAIT UP TO 300 SECONDS.
     gv_time = '03'.
 
     FREE: gt_lock_details[], gv_message, gv_msg.
 
     "kill the user sessions after 50 seconds.
   ELSEIF gv_time = '03'.
     gv_stop = abap_true.
 
 *** FM to get all lock details of MARA table (like SM12)
     CALL FUNCTION 'ENQUEUE_READ'
       EXPORTING
         gname                 = 'MARA'
         guname                = '$SBHANDARE'
       TABLES
         enq                   = gt_lock_details
       EXCEPTIONS
         communication_failure = 1
         system_failure        = 2
         OTHERS                = 3.
     IF sy-subrc &lt;> 0.
       EXIT.
     ENDIF.
 
 *** Get all user sessions
     CREATE OBJECT server_info.
     gt_session_list = server_info->get_session_list( with_application_info = 1 ).
 
 *** Filter user sessions on the basis of username and client.
     gt_session_list_user = VALUE #( FOR ls_lock_details IN gt_lock_details
                                           FOR ls_session_list IN gt_session_list
                                           WHERE ( user_name = ls_lock_details-guname
                                               AND tenant = sy-mandt )
                                                 ( ls_session_list ) ).
 
     FREE: gt_session_list[].
 
     LOOP AT gt_lock_details ASSIGNING &lt;fs_lock_details>.
       gv_tcode = &lt;fs_lock_details>-gtcode.
 
       CLEAR gt_sessions_user.
       LOOP AT gt_session_list_user ASSIGNING FIELD-SYMBOL(&lt;fs_session_list>). " loop at all open sessions to build a list of just the user sessions
 
         CLEAR gv_modus_index.
         CLEAR gt_usr_info[].
 
         "get technical info for the user
         CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_usr_info
           ID 'TID' FIELD &lt;fs_session_list>-logon_hdl
           ID 'WITH_APPL_INFO' FIELD with_appl_info
           ID 'TABLE' FIELD gt_usr_info[].
 
         "Need to use the '/UPD' value in the technical info to get the exact session used by user
         CONCATENATE &lt;fs_lock_details>-gusrvb '/UPD' INTO DATA(gv_value).
 
         READ TABLE gt_usr_info ASSIGNING FIELD-SYMBOL(&lt;fs_usr_info>)
                    WITH KEY value = gv_value.
         IF sy-subrc IS INITIAL.
           "The key for the value is 'modeinfo[X].enq_info'.... we need just the X
           gv_modus_index = &lt;fs_usr_info>-field+9(1).
         ELSE.
           CONTINUE.
         ENDIF.
 
         " If we found a session with that number, we know we had the correct logon... we can add this to the user list
         IF gv_modus_index IS NOT INITIAL.
           " convert to type ssi_session_handle for later lookup
           gv_modus_num_found = gv_modus_index.
           " get the session id for this specific session.
           CONCATENATE 'modeinfo[' gv_modus_index '].session' INTO DATA(gv_field). " this time we need to find the value from the field
 
           READ TABLE gt_usr_info ASSIGNING &lt;fs_usr_info> WITH KEY field = gv_field.
           IF sy-subrc IS INITIAL.
             gv_ssi_session_id = &lt;fs_usr_info>-value.
           ENDIF.
 
           APPEND &lt;fs_session_list> TO gt_sessions_user.
         ENDIF.
       ENDLOOP.
 
       IF gt_sessions_user[] IS NOT INITIAL.
         SORT gt_sessions_user BY session_hdl ASCENDING.
 
         READ TABLE gt_sessions_user TRANSPORTING NO FIELDS
                    WITH KEY session_hdl = gv_modus_num_found .
         IF sy-subrc IS INITIAL.
           " Kill only the session from the table that matches the index of the modus found
           gv_modus_index_char = sy-tabix.
           CLEAR gv_modus_string.
           CONCATENATE 'MODUS-MTCODE(0' gv_modus_index_char ')' INTO gv_modus_string.
         ENDIF.
 
         IF gv_modus_index_char EQ '0'.
           CONTINUE.
         ENDIF.
 
         " First ensure that sm04 is called and set to the sessions view
         CLEAR bdcdata[].
         PERFORM bdcdaten USING:
           'X' 'SAPMSSY0' '0120',
             ' ' 'BDC_CURSOR' '04/03',
             ' ' 'BDC_OKCODE' '=SESSIONS'.
 
         " call transaction SM04, sync (S), no screens
         CALL TRANSACTION 'SM04'
                 USING bdcdata
                 MODE 'N'
                 UPDATE 'S'.
 
         " Now use bdc to end the session with that session id
         CLEAR bdcdata[].
         PERFORM bdcdaten USING:
           'X' 'SAPMSSY0' '0120',
             ' ' 'BDC_CURSOR' '04/03',
             ' ' 'BDC_OKCODE' '=&amp;OL0'.
         PERFORM bdcdaten USING:
           'X' 'SAPLSKBH' '0800',
             ' ' 'BDC_CURSOR' 'GT_FIELD_LIST-SELTEXT(01)',
             ' ' 'BDC_OKCODE' '=WLSE',
             ' ' 'GT_FIELD_LIST-MARK(01)' 'X',
             ' ' 'BDC_SUBSCR' 'SAPLSKBH                                0810SUB810'.
         PERFORM bdcdaten USING:
           'X' 'SAPLSKBH' '0800',
             ' ' 'BDC_CURSOR' 'GT_FIELD_LIST-SELTEXT(01)',
             ' ' 'BDC_OKCODE' '=CONT',
             ' ' 'BDC_SUBSCR' 'SAPLSKBH                                0810SUB810'.
         PERFORM bdcdaten USING:
           'X' 'SAPMSSY0' '0120',
             ' ' 'BDC_CURSOR' '04/03',
             ' ' 'BDC_OKCODE' '=PS 63'.
         PERFORM bdcdaten USING:
           'X' 'SAPMSSY0' '0120',
             ' ' 'BDC_CURSOR' '02/76',
             ' ' 'BDC_OKCODE' '=&amp;IC1'.
         PERFORM bdcdaten USING:
           'X' 'SAPMSSY0' '0120',
             ' ' 'BDC_CURSOR' '02/76',
             ' ' 'BDC_OKCODE' '=&amp;ILT'.
         PERFORM bdcdaten USING:
           'X' 'SAPLSSEL' '1104',
             ' ' 'BDC_OKCODE' '=CRET',
             ' ' 'BDC_SUBSCR' 'SAPLSSEL                                1105%_SUBSCREEN_FREESEL',
             ' ' 'BDC_CURSOR' '%%DYN001-LOW',
             ' ' '%%DYN001-LOW' gv_ssi_session_id.
         PERFORM bdcdaten USING:
           'X' 'SAPMSSY0' '0120',
             ' ' 'BDC_CURSOR' '04/15',
             ' ' 'BDC_OKCODE' '=&amp;IC1'.
         PERFORM bdcdaten USING:
           'X' 'RSM04000_ALV_NEW' '2000',
             ' ' 'BDC_CURSOR' gv_modus_string,
             ' ' 'BDC_OKCODE' '=DEL'.
         PERFORM bdcdaten USING:
           'X' 'SAPMSSY0' '0120',
             ' ' 'BDC_CURSOR' '04/15',
             ' ' 'BDC_OKCODE' '=&amp;F15'.
 
         " call transaction SM04, sync (S), no screens
         CALL TRANSACTION 'SM04'
                 USING bdcdata
                 MODE 'P'
                 UPDATE 'N'.
 
         " proper logging. times, order number, and transaction added as well as
         WRITE: / 'User session from user ', &lt;fs_lock_details>-guname, 'with session number', gv_modus_index_char, 'was deleted.'.
         WRITE: / 'Object Lock Time Length:', &lt;fs_lock_details>-gttime.
 
       ENDIF.
     ENDLOOP.
   ENDIF.
 ENDWHILE.
 
 
 *&amp;---------------------------------------------------------------------*
 *&amp;      Form  BDCDATEN
 *&amp;---------------------------------------------------------------------*
 FORM bdcdaten USING start fnam fval.
 
   CLEAR bdcdata.
   IF start = abap_true.
     bdcdata-dynbegin = start.
     bdcdata-program  = fnam.
     bdcdata-dynpro   = fval.
   ELSE.
     bdcdata-fnam = fnam.
     bdcdata-fval = fval.
   ENDIF.
   APPEND bdcdata.
 
 ENDFORM.                               " BDCDATEN</code>

Below are the output snapshots of the code:

First Warning message to user (done for 5 secs time as doing testing):

Second Warning message after 10 minutes to user:

SM12 entry of lock:

After 10 minutes, the sessions which are locking the material master will be closed.

Hope you found this interesting. Try it internally in your team and remember its impact. Also take note of the forbidden system kernel calls.

Your comments make me smile. Please comment!

We have a very active Telegram (App) SAP Technical Group with more than 4930+ SAP Technical Practitioners from 6 Continents of the SAP World. Please join it using below link.
Telegram SAP Technical Discuss Group. You need to install the Telegram App first on your mobile device. Once you have it on your mobile, you can join the group and also access it from the Web on your computer and laptop.

Please SUBSCRIBE to SAPYard’s Youtube Channel for Free End to End SAP Video Course and Training.

Check HANA-ABAP Tutorials


Viewing all articles
Browse latest Browse all 66

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>