Hiding columns in table type BSP View
SAP CRM 7.0, EHP1 and EHP2
This particular document illustrates the technique to hide the column in the table type view. There are umpteen number of ways of hiding the data in the row(one can use iterator approach where one can define the iterator class BHTML tag <chtml: configtable iterator> and use the customize class with the interface as IF_HTMLB_TABLEVIEW_ITERATOR and then write the logic in the method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_ROW_START). The other approach is with respect to switch framework where using get_A method in class we can use to hide the data. But over here we need to hide the whole column in table type view. I won’t be able to share the whole scenario as it was related to my project, but will be presenting a very simple value node type example, wherein I’ll be creating the table type view on value node and then will be illustrating the technique to hide the column.
Author(s): Rajwin Singh Sood
Created on: 27th June 2014
Rajwin Singh Sood is currently working as Team lead/Solution Architect at Atos. He has got experience of more than 9 years in SAP ABAP and SAP CRM web UI. He is also a SAP CRM EHP2 Certified associate consultant. Prior to working with Atos he had worked with SAP India(SAP Global Delivery), Capgemini , Accenture and Infosys. He worked in SAP CRM Web UI areas like BSP enhancements, transaction launchers, BOL Programming, BRFPlus .
As mentioned I’ll be using a simple scenario where in I am having a Ztable(as shown in the screenshot you can use any other table no need to use the same) with the fields and I have created the BSP component wherein created search and search result screen using value node to search the data in the Ztable. Please refer to the below screenshots:-
As I said the scenario doesn’t matter you can use any other scenario. I have used value node as its simple way of illustrating the same.
- As a first step we need to get the configuration data from the repository containing the definition of the fields which we had added in the configuration tab to be displayed on the browser. For this we need to go to layout( .HTM) page and add the following code:-
DATA lv_xml TYPE string.
lv_xml = controller->configuration_descr->get_config_data( ). Please refer to the below screenshot:-
2. In this step we need a global variable which we need to use to hide the column and would be containing the repository data as per step 1. So we have defined the parameter in controller class of the view
3. Now we need to use this variable in the layout page which is shown in the screenshot above in step1.
And also we need to add this variable in the configCellerator BHTML tag in order rebuild the view. Please refer to the below screenshot:-
4. Now comes the main step where we’ll write the logic to hide the column over here I have written the logic in DO_PREPARE_OUTPUT for illustration purpose. It depends upon your requirement whether it could on click of button or for that matter on some other event. Please refer to the code screenshot below with the highlighted area as the logic for hiding the column:-
For testing simply click on the test button of the BSP workbench transaction:-
In the above screenshot the highlighted one is the one which will be hidden once we click on search operation
So the column customer is hidden.
This is the simple illustration for hiding the column. I had used this in complex scenario wherein I was generating the dynamic table columns and then using the same to show and hide by utilizing the technique shown above.