Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

One of the coolest features in the New ABAP WebDynpro is the ALV Grid with rich set of functionalities. Just reading through the Web Dynpro for ABAP documentation. I just happened to read a

very cool feature. You can display data in ALV plus represent the same as a business graphics just using a few additional lines of code.





Here is a simple application which displays the ALV data and Business Graphics at the same time. The necessary steps required are explained in the below steps. I belive they are

very much self explanatory and hence I am just providing the steps and the relavent screen shots.



Create a context node in the Component Controller


















Attribute

Data Type

YEAR

STRING

PROFIT

I







Add the ALV Component Usage







Map the Controller Component Context Node to the Interface Controller Usage







Embed the ALV Table view into the Window




!https://weblogs.sdn.sap.com/weblogs/images/31132/4.JPG|height=193|alt=image|width=450|src=https://we...!





Add the following code in the COMPONENTCONTROLLER WDDOINIT method




  • Declarations

  DATA: node_profit TYPE REF TO if_wd_context_node.

  TYPES: BEGIN OF t_profit,

          year TYPE string,

          profit TYPE i,

         END OF t_profit.

  DATA: i_profit TYPE TABLE OF t_profit,

        w_profit TYPE t_profit.

  • Populating the Data

  CLEAR w_profit.

  w_profit-year = '2001'.

  w_profit-profit = 2000.

  APPEND w_profit TO i_profit.

  CLEAR w_profit.

  w_profit-year = '2002'.

  w_profit-profit = 2200.

  APPEND w_profit TO i_profit.

  CLEAR w_profit.

  w_profit-year = '2003'.

  w_profit-profit = 2500.

  APPEND w_profit TO i_profit.

  CLEAR w_profit.

  w_profit-year = '2004'.

  w_profit-profit = 2400.

  APPEND w_profit TO i_profit.

  CLEAR w_profit.

  w_profit-year = '2005'.

  w_profit-profit = 2500.

  APPEND w_profit TO i_profit.

  •   navigate from <CONTEXT> to <PROFIT> via lead selection

  node_profit = wd_context->get_child_node(

                name = if_componentcontroller=>wdctx_profit ).

  • Fill the context Node

  node_profit->bind_table( i_profit ).

  • Create a Component Controller Usage

  DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.

  l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).

  IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.

    l_ref_cmp_usage->create_component( ).

  ENDIF.

  • Get the ALV Modal and make the config changes

  DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .

  l_ref_interfacecontroller =   wd_this->wd_cpifc_alv( ).

  DATA:

    l_value TYPE REF TO cl_salv_wd_config_table.

  l_value = l_ref_interfacecontroller->get_model(

  ).

  • Set Visible Row Count as 5

  l_value->if_salv_wd_table_settings~set_visible_row_count( '5' ).

  • The Config Table Setting to Display Table & Business Graphics

  DATA: l_ref_config_table TYPE REF TO if_salv_wd_table_settings,

        l_display_as TYPE salv_wd_constant VALUE '02'.

  l_ref_config_table ?= l_value.

  l_ref_config_table->set_display_as(

                      value = l_display_as ).






The Result






Many people would prefer the data to be displayed as business graphics than tables. How about a mix of both, no one will say no for that I believe.

11 Comments