How to find the configuration path through IMG activity

I want to read the path to configure IMG-Activity in SAP through the code (abap). I have an IMG activity from e071K that stores objects in a transport job. Now I have found the TNODEIMG table where the SPRO tree structure is stored. This is great because it holds what I need. But I can not find a connection with my IMG-Activity. The unique identifier in TNODEIMG is in a different format and seems to be different from Id. Someone understood how I can read this?

UPDATE:

@vwegert: Thanks for the helpful answer. For now I get this list populated by Node -Id's: lt_eref_list , but I don't get the parents. Do you see some missed errors or setbacks 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. 

Thanks in advance.

+5
source share
2 answers

IMG actions are supported using the rather cumbersome transaction S_CUS_IMG_ACTIVITY . This transaction provides the function used:

where-used index

Tracking this 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 , which identifies the nodes (for preparation, check its caller). Reading these function modules gives you a lot of information about the structures and function modules that will be used.

For your purposes, STREE_GET_NODES_FOR_GIVEN_REF may be interesting. In the list of links, specify the activity identifier NODE_ID with type COBJ . This will give you a list of nodes, including their parent identifiers, which can then be passed to STREE_GET_PARENTS_OF_NODE (the structure identifier is the tree identifier from the result set). To get the text node, you must use STREE_NODE_READ .

+1
source

Here is another approach for finding a table based IMG path.

At e071k , we have technical identifiers for IMG actions. You can also include them in SPRO through additional information โ†’ Additional information โ†’ Soft key โ†’ IMG activity, so they will be displayed as follows:

enter image description here

But in the TNODEIMG table, we have GUIDs that do not match the technical ones. The link table you can use to link them, TNODEIMGR , contains both the GUID and the technology identifier of each node. By joining the parent node, node ID, and node texts from the TNODEIMGR , TNODEIMG and TNODEIMGT , we can create a full IMG path for each node:

 REPORT z_img. DATA: lv_final_path TYPE string, exit_root TYPE abap_bool, out TYPE string. * picking random activity from requests SELECT SINGLE * FROM e071k INTO @DATA(lv_e071k). * finding correspondent GUID ID for tech ID SELECT gr~node_id, ach~text, img~parent_id FROM tnodeimgr AS gr JOIN cus_imgact AS ach ON ach~activity = gr~ref_object JOIN tnodeimg AS img ON img~node_id = gr~node_id AND spras = @sy-langu INTO TABLE @DATA(lt_node) WHERE ref_object = @lv_e071k-activity. LOOP AT lt_node ASSIGNING FIELD-SYMBOL(<fs_tnode>). CLEAR: lv_final_path. * writing bottom node text lv_final_path = lv_final_path && <fs_tnode>-text. DATA(lv_node_id) = <fs_tnode>-parent_id. DO 15 TIMES. * fetching parent node text SELECT SINGLE g~parent_id, text INTO @DATA(lv_node) FROM tnodeimg AS g LEFT JOIN tnodeimgt AS t ON t~tree_id = g~tree_id AND t~extension = g~extension AND t~node_id = g~node_id AND t~ext_key = g~ext_key AND t~spras = @sy-langu WHERE g~node_id = @lv_node_id. * checking if parent exists IF sy-subrc <> 0. exit_root = abap_true. EXIT. ELSE. exit_root = abap_false. ENDIF. lv_final_path = |{ lv_final_path } \n { repeat( val = |\t| occ = sy-index + 1 ) } --> { lv_node-text }|. lv_node_id = lv_node-parent_id. IF lv_node-parent_id IS INITIAL. EXIT. ENDIF. ENDDO. CHECK exit_root = abap_false. * building the path lv_final_path = | IMG path no. { sy-tabix } is \n\n { lv_final_path } \n\n |. out = out && lv_final_path. ENDLOOP. cl_demo_output=>display( out ). 

However, the root IMG node itself is not available with this approach.

0
source

Source: https://habr.com/ru/post/1270435/


All Articles