Skip to Content

Hello,

I developed useful functionality for SPRO

I detected that is common the necessity of copy IMG path when you navigated of SPRO Tree Customizing .

With the following code you can copy the path very easy

The change is only apply in Developer System and is necessary register one standard object.

  • Step 1: Add customer Button in Status GUI IMG_DISP of Function Group S_IMG_TOOL_1.

Register the object in Marketplace, before the changes apply

  • Create a Custom Function Code “ZCOPY_P”

Add custom Function Code “ZCOPY_P”

  • Add Custom Code Functions in Interface and Key Function

  • Step 2: Insert Implicit Enhancement in INCLUDE: LSHI01F0X – end of FORM  execute_user_command

  • Step 3: Add the following ABAP code and active the implicit enhancement
DATA: lv_nodekey TYPE tv_nodekey ,
      le_item TYPE shi_item,
      le_node TYPE treev_node,
      lv_relatkey TYPE tv_nodekey,
      lv_text(500) TYPE c ,
      lv_relatship_ant TYPE int4,
      lt_path TYPE STANDARD TABLE OF char100,
      le_path TYPE char100,
      lv_choise TYPE  sy-tabix.

CASE fcode.
  WHEN 'ZCOPY_P'.
    CHECK g_tree_data->tree IS NOT INITIAL.
    READ TABLE g_tree_data->nodes INTO le_node WITH KEY node_key =  g_tree_data->node_key  .
    CHECK sy-subrc = 0.
    READ TABLE g_tree_data->items INTO le_item WITH KEY node_key =  g_tree_data->node_key  item_name = 'TEXT'.
    CHECK sy-subrc = 0.
    le_path =  le_item-text.
    APPEND le_path TO lt_path.
    lv_relatkey  = le_node-relatkey.
    lv_relatship_ant = le_node-relatship.
    WHILE lv_relatkey IS NOT INITIAL.

      READ TABLE g_tree_data->nodes INTO le_node WITH KEY node_key =  lv_relatkey .

      READ TABLE g_tree_data->items INTO le_item WITH KEY node_key =  le_node-node_key item_name = 'TEXT' .

      lv_relatkey = le_node-relatkey .

      IF  le_item-text IS NOT INITIAL AND  lv_relatship_ant = '4'.
        CONCATENATE le_item-text '->' INTO le_path.
*        le_path =  le_item-text.
        INSERT le_path INTO lt_path  INDEX 1.
      ENDIF.
      lv_relatship_ant =  le_node-relatship..
    ENDWHILE.

    CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
      EXPORTING
        endpos_col   = 130
        endpos_row   = 10
        startpos_col = 40
        startpos_row = 1
        titletext    = 'Ruta de Configuración'
*      IMPORTING
*        choise       = lv_choise
      TABLES
        valuetab     = lt_path
      EXCEPTIONS
        break_off    = 1
        OTHERS       = 2.
    IF sy-subrc <> 0.
* Implement suitable error handling here
    ENDIF.
  • Step 4: Active all objects and test de functionality. TCode SPRO–> F5 –> “Copy IMG Path”

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Sandra Rossi

    Nice idea. I’ve got an error with POPUP_WITH_TABLE_DISPLAY not found in my ABAP trial system 7.51.

     

    You might also start your tool via the context menu:

     

    1. Add an enhancement at the end of Form HANDLE_MENU_REQUEST in INCLUDE LSHI01F1I :

          call method g_tree_data->menu->add_function
            exporting
              fcode = 'ZZSHOWPATH'
              text  = 'Show activity path'.
    

     

    2. Add an implicit enhancement at the beginning of Form HANDLE_MENU_SELECT in INCLUDE LSHI01F1J :

        CASE g_fcode.
        WHEN 'ZZSHOWPATH'.
    
          DATA: BEGIN OF zz,
                lv_nodekey TYPE tv_nodekey ,
                le_item TYPE shi_item,
                le_node TYPE treev_node,
                lv_relatkey TYPE tv_nodekey,
                lv_relatship_ant TYPE int4,
                html TYPE string,
                END OF zz.
    
          CHECK g_tree_data->tree IS NOT INITIAL.
    
          READ TABLE g_tree_data->nodes INTO zz-le_node WITH KEY node_key = g_tree_data->node_key  .
          CHECK sy-subrc = 0.
    
          READ TABLE g_tree_data->items INTO zz-le_item
            WITH KEY
              node_key = g_tree_data->node_key
              item_name = 'TEXT'.
          CHECK sy-subrc = 0.
    
          zz-html = |<html><body style="width:100%">{ escape( val = zz-le_item-text format = cl_abap_format=>e_html_text ) }|.
    
          zz-lv_relatkey  = zz-le_node-relatkey.
          zz-lv_relatship_ant = zz-le_node-relatship.
    
          WHILE zz-lv_relatkey IS NOT INITIAL.
    
            READ TABLE g_tree_data->nodes INTO zz-le_node WITH KEY node_key = zz-lv_relatkey .
            CHECK sy-subrc = 0.
    
            READ TABLE g_tree_data->items INTO zz-le_item WITH KEY node_key = zz-le_node-node_key item_name = 'TEXT' .
            CHECK sy-subrc = 0.
    
            zz-lv_relatkey = zz-le_node-relatkey .
    
            IF zz-le_item-text IS NOT INITIAL AND zz-lv_relatship_ant = '4'.
              zz-html = zz-le_item-text && '-&gt;' && zz-html.
            ENDIF.
            zz-lv_relatship_ant = zz-le_node-relatship.
          ENDWHILE.
    
          zz-html = zz-html && |</body></html>|.
    
          cl_abap_browser=>show_html(
          EXPORTING
            title       = 'Activity path'
            html_string = zz-html
            check_html  = abap_false
            size        = cl_abap_browser=>small
            format      = cl_abap_browser=>portrait
          ).
    
        RETURN.
    
      ENDCASE.

    Cheers.

    (2) 

Leave a Reply