cancel
Showing results for 
Search instead for 
Did you mean: 

Bind Table with dynamic data

Former Member
0 Kudos

Hi,

hope someone can help.

I try to bound a dynamic table via BIND_TABLE to context node, but i get a error message.

My coding :


    FIELD-SYMBOLS: <data_table> TYPE ANY TABLE.

    CALL METHOD obj_data_import->map_data_to_structure
      EXPORTING
        i_data           = lt_data
      IMPORTING
        e_data           = obj_data
        e_distributor    = lv_distributor
        e_file_date      = lv_file_date
        e_file_type      = lv_file_type
        e_data_structure = lv_data_structure
        e_return         = lt_return.

    ASSIGN obj_data->* TO <data_table>.

* navigate from <CONTEXT> to <UPLOAD_PREVIEW> via lead selection
    obj_node = wd_context->get_child_node( name = wd_this->wdctx_upload_preview ).

* Bind table
    obj_node->bind_table( <data_table> ).

Has anyone a idea how i can bind the data to context node?

Regards,

Anton

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Check this code.

In that code tablename is the Structure name. It may be any table.

create subnode named TEST1 of structure (tablename)
  cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
    parent_info = rootnode_info
    node_name = tablename
    structure_name = tablename
    is_multiple = abap_true ).

  DATA: stru_tab TYPE REF TO data.

  FIELD-SYMBOLS:
   <tab> TYPE table.

* create internal table
  CREATE DATA stru_tab TYPE TABLE OF (tablename).
  ASSIGN stru_tab->* TO <tab>.

* Get table content
  SELECT * FROM (tablename) INTO CORRESPONDING FIELDS OF TABLE <tab>.

* get instance of new node
  dyn_node = wd_context->get_child_node( name = tablename ).

* Bind internal table to context node.
  dyn_node->bind_table( <tab>

Thanks.

Former Member
0 Kudos

Hi Viji,

thanks for your help!!

That`s part one of my problem ;-).

Is it also possible to make a dynamic node mapping? Because i need my created dynamic table for a ALV Grid in my WDA.

And therefore i must map my context node to the data node from alv component.

Regars,

Anton

Former Member
0 Kudos

Hi Anton,

is this not, what you require? (already described by Viji):

  • get instance of new node

dyn_node = wd_context->get_child_node( name = tablename ).

after this, do the bind.

Regards,

Peter

Former Member
0 Kudos

Hi Peter,

its step one of my problem.

Now, i must show the data of this context node in a ALV grid on my WDA. For this, normaly i must map my data context node to the context node DATA of the SALV_WD_TABLE component during design time.

But now, i had the problem, that i created the context node during runtime. So i must map my new context node to the SALV_WD_TABLE component also during runtime.

Maybe there is a function to create attributes to a context node. If this is possible, i can create a context node like DATA and map this node to the context node of SALV_WD_TABLE. And during runtime, i add the Attributes to this node and append my data.

But i didn`t find such a function.

Regards,

Anton

Former Member
0 Kudos

Hi,

Sorry for the delay.

Ok You have the dynamic node and you want to pass the data's from node to ALV means use the below code.

Before that you should Instanciate the ALV component.

Please refer the following code.

DATA: L_REF_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
L_REF_INTERFACECONTROLLER =   WD_THIS->WD_CPIFC_ALV( ).
  L_REF_INTERFACECONTROLLER->SET_DATA(
    R_NODE_DATA = DYN_NODE                      " Ref to if_Wd_Context_Node
  ).

Thanks.

Former Member
0 Kudos

Hi Anston,

I had the same requirement as you have. The way you are binding is perfect. The only thing is as Viji suggested Instantiate ALV Component and SET DATA.

That should work.

Thank You,

Gajendra.

Former Member
0 Kudos

Hi,

thnaks for your help.

Problem resolved!

Regards,

Anton

Former Member
0 Kudos

Hi,

I've the same problem: I must create all attribute of my node at run-time and then create alv.

I use the method:

DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.

DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .

lo_cmp_usage = wd_this->wd_cpuse_alv( ).

IF lo_cmp_usage->has_active_component( ) IS INITIAL.

lo_cmp_usage->create_component( ).

ENDIF.

    • Pass context node to ALV

lo_interfacecontroller = wd_this->wd_cpifc_alv( ).

lo_interfacecontroller->set_data( node_lenght ). " node_lenght is my dynamic node

But I receive this message error:

Invalid operand type for the MOVE-CORRESPONDING statement.

Method: IF_WD_CONTEXT_NODE~GET_STATIC_ATTRIBUTES_TABLE of program CL_WDR_CONTEXT_NODE_VAL=======CP

Method: GET_REF_TO_TABLE of program CL_SALV_WD_DATA_TABLE=========CP

Method: EXECUTE of program CL_SALV_BS_SERVICE_MNGR_TABLE=CP

Method: EXECUTE of program CL_SALV_WD_SERVICE_MANAGER====CP

Method: APPLY_SERVICES of program CL_SALV_BS_RESULT_DATA_TABLE==CP

Method: REFRESH of program CL_SALV_BS_RESULT_DATA_TABLE==CP

Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE_DATA of program CL_SALV_WD_C_TABLE_V_TABLE====CP

Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE of program CL_SALV_WD_C_TABLE_V_TABLE====CP

Method: IF_SALV_WD_COMP_TABLE_DATA~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP

Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP

What can I do??? My node doesn't static attribute....

Thank,

Federica.

Answers (3)

Answers (3)

Former Member
0 Kudos

Credits to Viji.

Former Member
0 Kudos

hi Anton,

did you create the node also dynamically from the structure of the table?

What is the error message by the way?

Cheers,

Peter

Former Member
0 Kudos

hi anton....

this is how you bind an internal table to a node.



 DATA lt_table_mara TYPE wd_this->Elements_table_mara.
  DATA ls_table_amara LIKE LINE OF lt_table_mara.

select * from mara
into corresponding fields of table lt_table_mara .

 node->bind_table( lt_table_mara ).

---regards,

alex b justin

Former Member
0 Kudos

Hi Alex,

thanks for your answer.

But my Problem is, that i know the table type during runtime and not in design time. So i can`t declare my internal type like you.

My context node has no structure at design time.

I get my data from a class mehtod with type DATA and my field symbol has typy ANY TABLE.

And now, i must bind my data to context node. You can see it in my example.

Regards,

Anton

Former Member
0 Kudos

hi anton....

so first you recieve the node that is bound to the table using..

the method.... get_data_source in the class cl_wd_table.

it will return the node to which the table has been bound.....

then you can declare the internal table according to that structure and then process.

---regards,

alex b justin