Thursday, February 16, 2012

TR_OBJECT_JUMP_TO_TOOL


Have you ever wondered how any object that you want to view in the requests in se10 gets displayed ?
If your answer is yes, then read on to find an interesting function which you can use in your custom code to actually display any object in its own editor!

TR_OBJECT_JUMP_TO_TOOL
This Function Module (FM) is very simple to use. All you need to know  is the Object Name, Program ID and the Object Id.

Importing Parameters:
Object Name - The name of the object.
PGMID & OBJECT - These two fields together denote the type of object

The above data can be fetched from E071 table provided you know the Transport Request Number.

Once you pass these fields to the respective importing parameters of the FM, it will open the desired tool for you.

 Mode (iv_action):
Also,  you can control the way the object is opened in its tool, i.e. in display mode or in change mode.
This is easily done by passing the respective character strings in the importing parameter 'iv_action'.

Mode
Value
Display
'SHOW'
Change
'EDIT'

Example code:


CALL FUNCTION 'TR_OBJECT_JUMP_TO_TOOL'
            EXPORTING
              iv_pgmid           = e071-pgmid            " PGMID
              iv_object          = e071-object           " OBJECT
              iv_obj_name      = e071-obj_name       " Object Name
              iv_action          = 'SHOW'                  " Mode
            EXCEPTIONS
              jump_not_possible = 1
              OTHERS            = 2.

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



Any comments or suggestions are welcome!

No comments:

Post a Comment