Friday, July 6, 2018

SYSTEM_CALLSTACK functionality

  DATA  : gt_abap_stack TYPE abap_callstack,  " Call Stack
          gt_sys_stack TYPE sys_callst.

** get the call stack to get the details of the Program and Even triggered
    CALL FUNCTION 'SYSTEM_CALLSTACK'
*     EXPORTING
*       MAX_LEVEL          = 0
     IMPORTING
       CALLSTACK          =   gt_abap_stack
       ET_CALLSTACK       =   gt_sys_stack.
*** Get the details of the HU details
    READ TABLE gt_abap_stack TRANSPORTING NO FIELDS
        WITH KEY mainprogram = dc_program "Your Program name
                 INCLUDE     = dc_program "Include Name
                 blocktype   = 'EVENT'
                 BLOCKNAME   = 'START-OF-SELECTION'.   "Event Block Name
      IF sy-subrc EQ 0.

your logic  --- to fetch the details of other program or to check the main program details by making 
IMPORT memory data details.


  ENDIF.

NOTE:

Export Memory should be written in the Called Prgram(Main Program)

No comments:

Post a Comment