Quantcast
Channel: SCN : All Content - Web Dynpro ABAP
Viewing all articles
Browse latest Browse all 3667

Binding of dynamic table ?

$
0
0

hi,

 

i have pasted the code below (from an demo) into my method WDDOMODIFYVIEW of an view. so there should be a table with demo data to be displayed. So far so good, BUT: this coding is only doing the binding of the table in context dynamicly. So HOW can i display this table now in my view ? See screenshot: i want to display the table inside the tabstrip "TAB_2".

 

So how to achive that ?

 

br Martin

 

Capture.PNG

 

 

 

  DATA: node_info   TYPE REF TO if_wd_context_node_info,

        struct_type TYPE REF TO cl_abap_structdescr,

        table_type  TYPE REF TO cl_abap_tabledescr,

        comp_tab    TYPE cl_abap_structdescr=>component_table,

        comp        LIKE LINE OF comp_tab,

        my_table    TYPE REF TO data,

        my_row      TYPE REF TO data.

  FIELD-SYMBOLS: <table>  TYPE table,

                 <row>    TYPE data,

                 <flight> TYPE sflight.

 

 

* build a structure description from the list of single fields

  comp-name = 'CARRID'.

  comp-type ?= cl_abap_datadescr=>describe_by_name( 'S_CARR_ID' ).

  APPEND comp TO comp_tab.

 

 

comp-name = 'CONNID'.

comp-type ?= cl_abap_datadescr=>describe_by_name( 'S_CONN_ID' ).

APPEND comp TO comp_tab.

 

 

* note this structure contains the fields "CONNID" and "CARRID"

  struct_type = cl_abap_structdescr=>create( comp_tab ).

 

 

* now the nodeinfo is created

  node_info = wd_context->get_node_info( ).

  node_info = node_info->add_new_child_node(

    name                         = 'MY_NODE'

    is_mandatory                 = abap_true

    is_multiple                  = abap_true

    static_element_rtti          = struct_type

    is_static                    = abap_false

       ).

 

 

* fill new node;

  DATA: l_node   TYPE REF TO if_wd_context_node,

        l_flight TYPE STANDARD TABLE OF sflight.

 

 

*l_flight = CL_WD_DEMO_DYN_MODEL->get_flights( ).

 

 

  l_node = wd_context->get_child_node( 'MY_NODE' ).

* l_flight = wd_assist->get_flights( ).

*

*  if you could create a local data type, would be fine, but if you have to do it dynamically ...

  struct_type = node_info->get_static_attributes_type( ).

* create tabledescriptor from structdescription (standard table, no keys)

  table_type = cl_abap_tabledescr=>create( p_line_type = struct_type ).

  CREATE DATA my_table TYPE HANDLE table_type.

  ASSIGN my_table->* TO <table>.

  LOOP AT l_flight ASSIGNING <flight>.

    CREATE DATA my_row TYPE HANDLE struct_type.

    ASSIGN my_row->* TO <row>.

    MOVE-CORRESPONDING <flight> TO <row>.

    APPEND <row> TO <table>.

  ENDLOOP.


  l_node->bind_table( <table> ).


Viewing all articles
Browse latest Browse all 3667

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>