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:
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.
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.
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
Press enter and we have added first node to our tree and it will appear like this.
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 .
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.
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.
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.
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.
Click on the create button.A the Pop up will appear to assign report to the node.
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.
Enter F110 into the Transaction code filed and press Enter.
So we just assigned Transaction code F110 to the SUBTEST node
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 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 . 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.
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 . 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.
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.
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.
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.
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.
CALL FUNCTION ‘K_RW_REPORT_TREE_CALL’
I_APPL = ‘ZTST’
TREE_NOT_ACTIVE = 01
NO_TREE_SET = 02.
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!!