Skip to Content
Author's profile photo Vijay Sharma

Report Tree From Scratch

Recently I came across a requirement to create a completely new custom Report tree from scratch.I was aware of how to make minor changes in existing Report tree but had never created one from scratch. So I started looking for the help docs on the internet. I found some that gave me basic idea but none of them was taking me till the very end.

Now, when I am done with the creation of it, I thought of sharing the learning so that beginners on this topic can get some help.

Enough of stories… let begin with the real stuff.

So to create a custom Report tree we need to perform the following steps:

Start with the transaction code SERP. A screen as show below will appear. Enter the Report Tree name that you want to create and click on the10_CR_ICON.pngicon.

2_SERP.jpg

A pop screen will appear. It’s nothing but just the information that if you are trying to create area menu, use transaction code SE43N. Just press enter.

Click on the create icon and you will see a screen to create a node for your report tree.

5_Str_node.png

As you see there are different options to create a node, Structure node, ABAP Report, ABAP Query Transaction code etc… as shown in screen shot above.

By default structure node is selected. This structure is mainly used to create hierarchical tree structure nodes. The first node under the report tree will always be subordinate node i.e.  node can’t be created at the same level as that of report tree (As shown in screen shot above. The option to create node at the same level of the report tree ZTST is greyed out.)

Different input screens appear depending on the type of node selected. For e.g. if we select a node of type ABAP Report following screen will appear and we need to provide Report name and Variant that we want to execute through this node.

6_R_NODE.png

If we select “Transaction code” we need to pass the transaction code and variant to call the transaction. Similarly, different inputs required for different node types.

We will start with Structure node and will use different types as we proceed. So select the Structure node and enter the Technical name and description of the new node. In this case I passed TEST and Test Report 1 respectively as shown below

8_STR_CR.png

Press enter and we have added first node to our tree and it will appear like this.

9_INIT_TREE.png

Now let’s say we want to add one node (TEST2) at the same level as that of TEST and one node(SUBTEST) under TEST node. Put cursor on the TEST node and click create  icon. Again the same screen will appear but with current node as TEST and eith the option to input the nodeat the same level as that of the TESTt and at the subordinate level .

11_SEC_NODE.png

Enter the node name as shown and press enter. Now our screen will look like the below screen. It has two nodes under ZTST, TEST & TEST1 and TEST has further subnode under it by the name SUBTEST.

12_TREE.png

Let’s say you don’t like the description of your nodes and you want it to be Header Node1 and Header Node2 respectively. To change the Description, put your cursor on the node, select Node from the Menu item and click on “ Change node text” as shown below.

13_TXT_CHG.png

A popup window will appear. Change the text to “Header Node1” and press enter. Similarly change for the other node.

And here we go, Screen with the changed descriptions.

15_TREE.png

We have created the report tree structure, but at this point of time it not linked to any of the report, transaction, form etc.

 

Now let’s say we want to link Payment run transaction F110 to the SUBTEST node.Double click on SUBTEST and the below screen will appear. As you can see no report is linked to this node at this time.

17_CHLD_ASSIGN.png

Click on the create button.A the Pop up will appear to assign report to the node.

18_ASSIGN2.png

To select ‘Transaction Code’ type node, Click on other type at the bottom of the popup. Another popup window will appear and select Transactions from the list.

19_ASSIGN3.png

Enter F110 into the Transaction code filed and press Enter.

20_ASSIGN4.png

So we just assigned Transaction code F110 to the SUBTEST node

21_ASSIGN5.png

So this way we can create any no of nodes and sub nodes and can assign Reports, Transaction code Forms etc. to them.

Change Node Assignment

Now suppose we assigned the child node to the wrong parent node. One way to correct it could be to delete the child node and create it again under the correct parent node. Secondly, there is an easy way. Just put cursor on the child node to be moved and click Select icon 22_SEL_ICON.png on the  icon. Say, we want to move SUBTEST under TEST2 node. Put your cursor on SUBTEST and click  on the select icon. Then put cursor on TEST2 and click on assign icon 24_ASSIGN_ICON.png. A popup window as shown below will appear to confirm if you want to add SUBTEST at the same level. Select Lower and click on reassign and BOOM we are done. SUBTEST will now appear under TEST2 now.

26_CHG_TREE.png

Linking Authorization group to Report tree or Nodes

We can also link the authorization group to the Report tree so that only authorized people can execute it. To do that, put your cursor on the Report tree and click on the Attribute icon 27_ATTR_ICON.png. Now, as we have selected the highest level i.e. Report tree, so the Inherited filed is blank.Pass the authorization group in the New field on the screen shown below and press enter.

29_AUTH.png

It will assign the authorization group to all the nodes of the Tree. To see if it is assigned, we need to turn on the Authorization group display as shown in the next screen shot.

30_AUTH_SW.png

So, we can see that the same authorization group is assigned to all the nodes and sub nodes as it flows from parent to the child nodes.

31_TREE.png

Now, to assign a different authorization group to any node, we need to put cursor on the required node and click on the attributes icon. Pass the new authorization group and press enter.Here we go. We have assigned the new authorization group ZTEST to the node TEST2. The authorization group assigned to the parent node automatically flows to the child nodes and we need to perform the same process if we want to change it.

33_TREE.png

So with this we are done with the creation of the custom report tree and learnt how we can we use different inbuilt functionalities of the report tree.

Transaction Code for the Report Tree

We are not left with the last and the most it important step and that is to create a Transaction code to execute this report tree.

To create the Transaction for this tree, first we need to create a report with the code as shown below.Don’t forget to replace the change APPL name in the called Function module.

                                       

                             REPORT ZVJ MESSAGE-ID AB.

                                        INCLUDE RKKBEQ60.

                                        CALL FUNCTION ‘K_RW_REPORT_TREE_CALL’
                                             EXPORTING
                                                       I_APPL          = ‘ZTST’
                                             EXCEPTIONS
                                                      TREE_NOT_ACTIVE = 01
                                                      NO_TREE_SET     = 02.
                                             CASE SYSUBRC.
                                                      WHEN ‘1’.
                                                         MESSAGE A500.
                                                      WHEN ‘2’.
                                                         MESSAGE A501.
                                             ENDCASE.

Next create a Transaction code for this Program in SE93.

So, we have created the Program that calls our report tree and the transaction for the program.

But, this transaction will not work unless we will maintain the entry in the TABLE TKKBU for the report tree we just created. This is the part which you will rarely found on the net.

To maintain the entry in table TKKBU, SAP has provided a standard report RKKBPARA. Execute this report in SE38 and maintain the entry in TKKBU for your TREE.

In this case, the record will have data like this:

P_APPL      —> ZTST

P_RPPAR   —> TREE

P_SUBPR   —> R

P_RPDATA —> ZTST

MODE        —> U

Now we are actually done. Execute the transaction ZTST and you are on.

With this we have learnt how to create custom Report tree from beginning.  Hope you will like this blog. Happy learning …Thanks!!

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Lisa Zhou
      Lisa Zhou

      Hi, very helpful post thank you!

      I was wondering if there is any way to change also the description of our z report showed in the report tree.

      Like in this case is 'Parameters for Automatic Payment' and what if I want to edit as '1) Parameter for Automatic Paayment', without changing it from SE38 -> attributes

      21_ASSIGN5.png