Skip to Content

I think most of readers at least once have parametrized their WebUI components, applications or views with some values or parameters depending on some information about user, runtime or whatever. For example, current business role or its configuration key is taken into consideration. Recently I found for myself pretty convenient way to configure (e.g. parametrized) own or enhanced WebUI views with a set of attributes. There is a standard way to assign a set of values to WebUI view configuration, named “General View Settings”. In this way sets of parameters will depend on well-known ones: configuration key, component usage, UI object type, UI object subtype.

Let’s start from the beginning. First of all we need a structure which represents a set of attributes we’d like to have. For example, I’ll take a simple one.

Structure.png

Then we need to enter our component, view and structure in maintenance view BSPC_DL_VIEWS:

/wp-content/uploads/2015/02/bspc_dl_views_635679.png

After that on Configuration tab of our view in BSP_WD_CMPWB we will have an additional button Attributes.

For configurable view:

ConfigView.png

For table view:

TableView.png

 

Going there we’ll see a view to maintain values for attributes from our structure. To maintain a value for an attribute select the row of this attribute.

Maintenance.png

But we’re not finished yet. Now we need to utilize these maintained parameters. Let’s assume that my view does some search in DO_PREPARE_OUTPUT and then depending on parameters sort the result collection. For example, in view controller in DO_PREPARE_OUTPUT method. So here the code to get current set of parameters:


DATA: lr_config_descr  TYPE REF TO if_bsp_dlc_config_attrib,
            ls_config_attr   TYPE zst_example_parameters.
     lr_config_descr ?= me->configuration_descr.
     IF lr_config_descr IS BOUND.
       me->configuration_descr->get_config_data( ).
       lr_config_descr->get_attributes( CHANGING cs_attributes = ls_config_attr ).
 ENDIF.


Originally this feature seems to be developed to help in CRM-BI integration. See Using Attributes for Assignment Blocks – Fact Sheet – SAP Library Mainly the system uses such attributes to define BI connection or to store parameters for search/filter use cases. You can explore how these attributes are used in standard components/views referring entries maintained in BSPC_DL_VIEWS.

But who cares? I think we can use it for our own good 🙂

UPD: Cross-reference with SAP Note 2193909 – Setting Default Values in the UI Framework (link to this blog post is in the attachment to the note)

To report this post you need to login first.

2 Comments

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

  1. Krishnendu Laha

    Hello Andrei,

    For me it would be quite useful, and if I could know earlier many lines code would have been less 🙂

    Thanks for sharing.

    Regards,

    Krish

    (0) 

Leave a Reply