Skip to Content

Create a new Web Dynpro Component.

Create a new View and window.

Write the following code in the wddomodifyview method of view..

METHOD wddomodifyview .

” For dynamic Programing we need to write code in modify view..
   IF first_time  = abap_true.

     DATA lr_container TYPE REF TO cl_wd_uielement_container.
     DATA: lr_matrix    TYPE REF TO cl_wd_matrix_head_data,
           lr_matrix_lay    TYPE REF TO cl_wd_matrix_layout.

*    ** getting reference  of first ROOTUIELEMENTCONTAINER


     lr_container ?= view->get_element( ‘ROOTUIELEMENTCONTAINER’ ).
     cl_wd_matrix_layout=>new_matrix_layout( lr_container ) .

* Here we are Creating new Tab strip..
     DATA: lr_tabstrip TYPE REF TO cl_wd_tabstrip.
     lr_tabstrip = cl_wd_tabstrip=>new_tabstrip(
       id = `TABSTRIP_DYNAMIC`
       enabled = abap_true
       ” height =  “here you can give height of your tab strip
       ” selected_tab = ” here you can get/set selected tab.
       selection_change_behaviour = `00`
       tab_alignment = `00`
       ” tooltip =
       visible = `02`
       ” width =
*      on_select = `ON_SELECT_METHOD`          “Method we will be called on changing of tabs
     ).

* Here we are adding new Tab strip in the TC..
     lr_container->add_child( lr_tabstrip ).

  cl_wd_matrix_head_data=>new_matrix_head_data( lr_tabstrip ).

* Here we are creating tab in the tab strip..
     DATA: lr_first_tab TYPE REF TO cl_wd_tab.
     lr_first_tab = cl_wd_tab=>new_tab(
       id = `FIRST_TAB`
       closeable = abap_true
       enabled = abap_true
       has_content_padding = abap_true
       visible = abap_true
     ).

*    Caption for 1st tab..
     DATA: lr_caption_1st_tab TYPE REF TO cl_wd_caption.
     lr_caption_1st_tab = cl_wd_caption=>new_caption(
*      view = lri_view
       id = `CAPTION`
       context_menu_behaviour = `00`
       enabled = abap_true
       image_first = abap_true
       text = ‘1st tab’
      ).
* Here we are adding caption as header to new tab..
     lr_first_tab->set_header( lr_caption_1st_tab ).
* Here we are adding new Tab in the Tab strip ..
     lr_tabstrip->add_tab( lr_first_tab ).

* Here we are creating TC in the tab .
     DATA: lr_first_tab_tc TYPE REF TO cl_wd_transparent_container.
     lr_first_tab_tc = cl_wd_transparent_container=>new_transparent_container(
     id = `TC_1ST_TAB`
   ).

     ” Here we are giving matrix layout to newly created tc
     cl_wd_matrix_layout=>new_matrix_layout( lr_first_tab_tc ).

*   * Here we are creating adding tc in the tab .
     lr_first_tab->set_content( lr_first_tab_tc ).

*    making new txt view in the tc..
     DATA: lr_txt_view TYPE REF TO cl_wd_text_view.
     lr_txt_view = cl_wd_text_view=>new_text_view(
*      view = lri_view
       id = `TXT_DEMO`
       h_align = `03`
       layout = `01`
       semantic_color = `00`
       text = ‘My textview in the 1st tab in the TC’
     ).

     cl_wd_matrix_head_data=>new_matrix_head_data( lr_txt_view ).

     lr_first_tab_tc->add_child( lr_txt_view ).

*  creation of 2nd tab..

     DATA: lr_second_tab TYPE REF TO cl_wd_tab.
     lr_second_tab = cl_wd_tab=>new_tab(
*      view = lri_view
       id = `SECOND_TAB`
       closeable = abap_true
       enabled = abap_true
       has_content_padding = abap_true
       visible = abap_true
     ).

     lr_caption_1st_tab = cl_wd_caption=>new_caption(
*   view = lri_view
    id = `CAPTION_1`
    text = ‘Second Tab’
    text_direction = `02`
    visible = `02`
  ).

     lr_second_tab->set_header( lr_caption_1st_tab ).

     lr_tabstrip->add_tab( lr_second_tab ).

   ENDIF.
ENDMETHOD.

Output..

To report this post you need to login first.

5 Comments

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

      1. Suseelan Hari

        Why not? You are there for me. I dont want to worry at all.

        I know you will definitely help me. If any issue, I always ask you.

        No worries.

        Regards,

        Hari Suseelan

        (0) 

Leave a Reply