Skip to Content
Author's profile photo NAVEEN MANDA

How to Use Business Graphics in Webdynpro Abap?

Business Graphics Screen Element in Webdynpro

Initially create a table with attributes  in SE11

Zbg_demo

/wp-content/uploads/2014/04/tabl_strucvture_424779.png
    Insert some in table

tbl2.PNG

Webdynpro

  • Go to Webdynpro and create a window and view. (
    SE80)
  • Go to
    view controller context create a node ZBG_DEMO with all fields available
  • Go to view controller layout create business graphics screen element.

   

  1. Bind that business graphics screen element series source property with zbg_demo
    node.

bg1.PNG

  1. Create a category  and bind
    description and tooltip with title field from zbg_demo node

category.PNG

Create 3 steps to it. For step1 bind value with
value1 from zbg_demo and provide description for ID , Label, Tooltip

step1.PNG

For step2 bind value with value2 from zbg_demo and provide
description for ID , Label, Tooltip

step2.PNG

For step3 bind value with value3 from zbg_demo and provide
description for ID, Label, and Tooltip

step3.PNG

CODE SNIPPET

  • Go to view controller wddoinit( ) method and
    write the code

          DATA lo_nd_zbg_demo TYPE REF TO if_wd_context_node.

    DATA lo_el_zbg_demo TYPE REF TO if_wd_context_element.

    DATA ls_zbg_demo TYPE wd_this->element_zbg_demo.

    DATA lt_zbg_demo TYPE wd_this->elements_zbg_demo.

    DATA wa_zbg_demo Like LINE OF lt_zbg_demo.
*   navigate from <CONTEXT> to <ZBG_DEMO> via lead selection

    lo_nd_zbg_demo =

wd_context->get_child_node( name = wd_this>wdctx_zbg_demo ).

*   @TODO handle non existant child

   IF lo_nd_zbg_demo IS INITIAL.

   ENDIF.

*   get element via lead selection

    lo_el_zbg_demo = lo_nd_zbg_demo->get_element( ).
*   alternative access  via index
*   lo_el_zbg_demo = lo_nd_zbg_demo->get_element( index = 1 ).
*   @TODO handle not set lead selection

    IF lo_el_zbg_demo IS INITIAL.

    ENDIF.

   SELECT * from zbg_demo into CORRESPONDING FIELDS OF TABLE lt_zbg_demo.

   lo_nd_zbg_demo->bind_table( lt_zbg_demo ) .

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

  • Save and activate. crate an application an test
    it …

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

  • If we worked on alv table data :… add
    this code also (extra code)

*********************************alv code…
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.

lo_cmp_usage =   wd_this->wd_cpuse_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.

  lo_cmp_usage->create_component( ).
ENDIF.

********************************************
*
*
*•Get the ALV Modal and make the config changes
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .

lo_interfacecontroller =   wd_this->wd_cpifc_alv( ).

  DATA lv_value TYPE REF TO cl_salv_wd_config_table.

  lv_value = lo_interfacecontroller->get_model(

   ).

*Set Visible Row Count as 5

  lv_value->if_salv_wd_table_settings~set_visible_row_count( ‘5’ ).

* *** set display as graphics with table

  lv_value->IF_SALV_WD_TABLE_SETTINGS~SET_DISPLAY_AS(‘2’).
*  lv_value->IF_SALV_WD_TABLE_SETTINGS~SET_DISPLAY_AS(’03’).

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

sampel screen

bg_screen.PNG

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.