Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Hierarichal Tree display

Former Member
0 Kudos

Hi Friends,

Can anybody of u Please tell me the Sample code for how to use 'CALLBACK_TOP_OF_PAGE' in the Function Module rs_tree_list_display.

Thanks & Regards.

Naga Priyanka.T

1 REPLY 1

Former Member
0 Kudos

hi priyanka,,,,,,,

see the code below......


*
*    Construct the tree
*
     Call Function 'RS_TREE_CONSTRUCT'
          Tables
               Nodetab            = T_Nodes
          Exceptions
              Tree_Failure       = 1
              Id_Not_Found       = 2
              Wrong_Relationship = 3
              Others             = 4.
     If sy-subrc = 0.
*
*       Now display the tree
*
        Set pf-status 'LD_TREE' Of Program 'SAPLSEUT'
            Excluding t_excludes.
        Call Function 'RS_TREE_LIST_DISPLAY'
              Exporting
                 Callback_Program      = Sy-Cprog
                 Callback_User_Command = 'CB_USER_COMMAND'
                 Callback_Top_Of_Page  = 'CB_TOP_OF_PAGE'
              Exceptions
                 Others                = 0.
     Else.
        Message E000 with text-032.
     EndIf.
Endform.
*Eject
**********************************************************************
*
*       Procedure:            CB_TOP_OF_PAGE
*
*       Purpose:              Call back routine for RS_TREE_DISPLAY to
*                             handle the top of page for the tree
*                             display
*
*       Entry:                None
*
*       Exit:                 Relevant top of page displayed
*
*       Called By:
*
*       Calls:
*
*       Modification History:
*
Form CB_Top_Of_Page.                                      "#EC CALLED
     Move c_error_report to g_report_type.
     Perform Top_Of_Page.
EndForm.
*Eject
***********************************************************************
*
*       Procedure:     CB_User_Command
*
*       Purpose:       Handles At User Command events
*                      for RS_TREE_DISPLAY
*
*       Entry:         Node Table
*                      User Command
*
*       Exit:          Exit Flag    True - exit,  false continue
*                      List_refresh True - Refresh list,  false not
*
*       Called By:
*
*       Calls:
*
*       Modification History:
*
*   Date    Reason                                         Version  Who
*
Form CB_User_Command Tables NodeTab Structure SnodeText
                      using pu_ucomm        like rsnewleng-fcode
                   changing pc_exit         type c
                            pc_list_refresh type c.       "#EC CALLED
*
     Move True  to pc_exit.
     Move False to pc_list_refresh.
     Case pu_ucomm.
          When 'TRPI'.
*
*              Pick Line. If it's a hotspot then display the order
*              or the delivery otherwise expand/compress the tree
*
               If NodeTab-Hotspot5 = True.
*
*                 Scuttle up the tree until an order or delivery is
*                 found and then open that object for change
*
                  Read Table t_nodes with key id = NodeTab-Parent.
                  While t_nodes-parent <> '000000' and
                        t_nodes-type <> c_pr_order and
                        t_nodes-type <> c_dlvy.
                        Read Table t_nodes with key id = t_nodes-parent.
                  EndWhile.
                  Case t_nodes-type.
                       When c_dlvy.
                            Set Parameter id 'VL' field t_nodes-text4.
                            Call Transaction 'VL02'
                                 And Skip First Screen.
                       When c_pr_order.
                            Set Parameter Id 'ANR' field t_nodes-text4.
                            Call Transaction 'CO02'
                                 And skip first screen.
                       When Others.
                            Message E000 with text-033.
                   EndCase.
               EndIf.
               Move True to pc_list_refresh.
          When 'TREP'.
*
*              Expand Tree
*
               Move True to pc_list_refresh.
          When 'TRCM'.
*
*              Collapse
*
               Move True to pc_list_refresh.
          When 'TRZM'.
*
*              Highlight branch
*
               Move True to pc_list_refresh.
          When Others.
               Break-point.
     EndCase.
     If pc_list_refresh = True.
        pc_exit = false.
     EndIf.
EndForm.

Thanks

Saurabh