Skip to Content

This blog describes how to dynamically create a Web Dynpro ABAP table in a table popin, using Arun Padmanaban’s blog Table in Table Popin as an example. It is recommended to read and understand Arun Padmanaban’s blog before reading the reminder of this blog. Arun Padmanaban’s blog contains 7 steps for creating a table in table popin. Here, Step 4 and Step 6 are created dynamically via programming.

Step 4

Add the following code in method WDDOMODIFYVEIW

METHOD wddomodifyview .
  "
  " References
  DATA lr_root_container TYPE REF TO cl_wd_uielement_container.
  DATA lr_table_popin TYPE REF TO cl_wd_table_popin.
  DATA lr_transparent_container TYPE REF TO cl_wd_transparent_container.
  DATA lr_table TYPE REF TO cl_wd_table.
  DATA lr_table_column TYPE REF TO cl_wd_table_column.
  DATA lr_table_in_table_popin TYPE REF TO cl_wd_table.
  DATA lr_node_header_node TYPE REF TO if_wd_context_node.
  DATA lr_node_item_node TYPE REF TO if_wd_context_node.
  IF first_time = abap_true.
    " Context node HEADER_NODE    
    lr_node_header_node =
      wd_context->get_child_node(
         name = wd_this->wdctx_header_node ).
    "Context node ITEM_NODE    
    lr_node_item_node =
      lr_node_header_node->get_child_node(
         name = wd_this->wdctx_item_node ).
    IF lr_node_item_node IS BOUND.
    lr_root_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
    lr_table ?= lr_root_container->get_child( id = 'TABLE' ).
    lr_table_column ?= lr_table->get_grouped_column( id = 'TABLE_EBELN' ).
      "Table popin      
      lr_table_popin =
        cl_wd_table_popin=>new_table_popin(
          id = 'TABLEPOPIN'                                                        
          on_close = 'CLOSE_POPIN' ).
      "Transparent container            
      lr_transparent_container =   
        cl_wd_transparent_container=>new_transparent_container(   
          id = 'TRANSPARENT_CONTAINER' ).
      "Transparent container Layout
      cl_wd_matrix_data=>new_matrix_data( lr_transparent_container ).
      cl_wd_matrix_layout=>new_matrix_layout( lr_transparent_container ).
      "Add the Transparent Container to the Table Popin
      lr_table_popin->set_content( lr_transparent_container ).
      lr_table_column->set_popin( lr_table_popin ).
      "Table in table popin      
      lr_table_in_table_popin =
        cl_wd_dynamic_tool=>create_table_from_node(                         
          ui_parent      = lr_transparent_container                         
           table_id       = 'TABLE2'                         
           node           = lr_node_item_node ).
    ENDIF.
  ENDIF.
ENDMETHOD.

Step 6

The ON_CLOSE action is declared in the code of step 4 when creating the table popin. Actions declared dynamically are not automatically added to the actions. Therefore, it is necessary to manually add the CLOSE_POPIN action to the action list.

Action CLOSE_POPIN

That is it, the table popin has now been created dynamically. 

To report this post you need to login first.

Be the first to leave a comment

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

Leave a Reply