Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the Customizing Path via IMG-Activity

Tags:

abap

sap-basis

I want to read the customizing path of an IMG-Activity in SAP via Code (abap). I have the IMG-Activity from e071K, which stores objects within a transport job. Now I found the table TNODEIMG where the tree structure of SPRO is stored. This is perfect, because it holds what I need. But I can't find the connection to my IMG-Activity. The Unique-Id in TNODEIMG is in other format and seems to be a different Id. Someone got an idea how I can read this out?

UPDATE:

@vwegert: Thank you for you helpful answer. So far I get this list filled with Node-Id's: lt_eref_list, but don't get the parents. Do you see some missunderstood or failure here?

DATA: lt_iref_list TYPE STANDARD TABLE OF hier_ref,
          lt_eref_list TYPE STANDARD TABLE OF hier_ref,
          ls_ref TYPE hier_ref,
          lt_parent_list TYPE STANDARD TABLE OF hier_iface,
          lt_check_list TYPE STANDARD TABLE OF hier_iface.

    ls_ref-node_id = 'SIMG_CFMENUOLQSOQ46'.
    APPEND ls_ref TO lt_iref_list.

    CALL FUNCTION 'STREE_GET_NODES_FOR_GIVEN_REF'
      TABLES
        i_list_of_references = lt_iref_list
        e_list_of_references = lt_eref_list.

    LOOP AT lt_eref_list ASSIGNING FIELD-SYMBOL(<ls_ref>).

      CALL FUNCTION 'STREE_GET_PARENTS_OF_NODE'
        EXPORTING
          structure_id = <ls_ref>-node_id
*     IMPORTING
*         message      = ls_message
        TABLES
          check_nodes  = lt_check_list
          parent_nodes = lt_parent_list.

    ENDLOOP.

Thank you in advance.

like image 698
Sebi Avatar asked Aug 01 '17 14:08

Sebi


1 Answers

IMG activities are maintained using the rather unwieldy transaction S_CUS_IMG_ACTIVITY. That transaction supplies a where-used function:

where-used index

Tracing that function leads through the function modules S_CUS_IMG_ACTIVITY_XREF and S_CUS_IMG_ENTRY_VIA_ACTIVITY to a function module named STREE_GET_NODES_FOR_GIVEN_REF that identifies the nodes (for the preparation, check its caller). Reading these function modules gives you a lot of information about the structures and function modules to be used.

For your purposes, STREE_GET_NODES_FOR_GIVEN_REF might be interesting. In the list of references, specify the activity ID as NODE_ID with type COBJ. This will give you a list of nodes including their parent IDs that you can then feed to STREE_GET_PARENTS_OF_NODE (the structure ID is the tree ID from the result set). To get the node text, you would use STREE_NODE_READ.

like image 63
vwegert Avatar answered Nov 06 '22 14:11

vwegert