Skip to Content

Dynamic modification of Configuration fields ( Part -2) : Table View

In this document we will focus on table views which are widely used in many UI components and provide the user about the brief information regarding the business object in focus. We will use the same technique to modify the configuration data dynamically as discussed in previous document,

Please check the document http://scn.sap.com/docs/DOC-29342 for information on Dynamic modification of Configuration of form fields ( Part -1).

Before CRM 7.0 Ehp1 , we can use the same technique to modify the search result which use to have .htm page . But from Ehp1 if the search page is created through wizard an .htm page in the result view will not get generated.

We mainly use two types of configuration tags in table views.

1.  Configurable table tag

  &lt;chtmlb:configTable xml              = “<%= lv_xml %>”
                                        id               = “ResTable”
                                   table               = “//RESULT/Table” />

2.  Next one is the Configuration Cellerator Tag

     &lt;chtmlb:configCellerator id       = “ConfCellTable”
                                            table       = “//Result/Table”
                                              xml        =  “<%= lv_xml %>”/>

In both the tags the XML table configuration data is passed using lv_xml

<%

  DATA:

  lv_xml    TYPE string.

  lv_xml = controller->configuration_descr->get_config_data( ).

%>

We have a seperate utility class method to read the configuration table data from XML to ABAP . Now we can modify the table configuration data as per our requirement.

************************************************************************************************************************************************************************

<%@page language=”abap” %>
<%@extension name=”chtmlb” prefix=”chtmlb” %>
<%@extension name=”thtmlb” prefix=”thtmlb” %>
<%@extension name=”bsp” prefix=”bsp” %>
<%
  DATA: lv_xml_inp TYPE bsp_dlc_xml,
             ls_config TYPE bsp_dlc_table_descr,
             lt_columns TYPE bsp_dlc_column_descr_tab.

  FIELD-SYMBOLS <ls_column> TYPE bsp_dlc_column_descr.

************Read the original configuration data of the table view as an xml file

lv_xml_inp    = controller->CONFIGURATION_DESCR->GET_CONFIG_DATA( ).

*********** Convert from XML format to ABAP special table utility class method

ls_config = cl_bsp_dlc_table_utility=>conf_xml_to_abap( lv_xml_inp ).

********* LS_CONFIG is of type BSP_DLC_COLUMN_DESCR which stores the details about each table column with its label properties and alignments

  loop at LS_CONFIG-COLUMNDEFINITION ASSIGNING <LS_COLUMN>.
  if <ls_column>-name = ‘field1’.

**************************************************************************************************************************************

*** Place the logic to modify each column label or property. We can also hide the field from the view .

*************************************************************************************************************************************


  endif.
  endloop.

******** Now convert the modified table configuration data back to XML format

  lv_xml = cl_bsp_dlc_table_utility=>CONF_ABAP_TO_XML( ls_config ).
%>

********* Finally pass the modified configuration data to the tag

<chtmlb:tableExtension tableId = “ResultList”
                       layout  = “FIXED” />
<chtmlb:configTable xml              = “<%= lv_xml %>”
                    id               = “ResTable”
                    navigationMode   = “BYPAGE”
                    onRowSelection   = “select”
                    table            = “//RESULT/Table”
                    width            = “100%”
                    headerVisible    = “FALSE”
                    hasLeadSelection = “TRUE”
                    visibleRowCount  = “10”
                    actionsMaxInRow  = “5”
                    selectionMode    = “<%= RESULT->SELECTION_MODE %>” />

*********************************************************************************************************************************************************************************

Now the modified table configuration is rendered overriding the configuration created for the view.

In the next document we will continue to focus on Search View and Overview .

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