cancel
Showing results for 
Search instead for 
Did you mean: 

How to display(binding) values in the table from more than one node?

Former Member
0 Kudos

Hi,

I have two nodes (TRIPS & AMOUNTS)in the context. How to bind these values into the table control?

When i bind second one, first one is getting replaced.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Mog,

I dont think you can bind two nodes to a single table control. It is the standard table control behaviour that you bind a table with one node.

What you can do is: you can combine the attributes of the two nodes in a single node and then bind this new node to the table. ie: you need to create a single node, say 'Data' which will contain all the attributes which you want to display in the table. So 'Data' will contain attributes from both TRIPS and AMOUNTS.

When populating the context node you have to manually fill the attributes in a local table and then bind it to the table:

for eg:

ls_DATA-attribute_trip_1 = ls_TRIPS-attribute_1.

ls_DATA-attribute_amounts_1 = ls_AMOUNTS-attribute_1.

appand ls_DATA to lt_DATA.

node_data->bind_table( lt_DATA ).

I hope this helps you.

Best Regards,

Viqar Ali.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

What i think you can't bind the two node in a single table. What you have to do that just create a local node having all the fields required for tha table control and bind it to that table .

For dispaly just read the local node and put it into a internal table .

Hope this may work.

Cheers,

Satya

former_member215843
Active Participant
0 Kudos

Hi Mog,

Of course it is possible to create a table from attributes of more than one node, and in some cases this is still necessary, but you have to do this the hard (manual) way.

If you have a table control, have a look at the properties and the elements belonging to it.

First of all, there is the property "dataSource", which binds to a multiple node (let's name it TableRootNode). This means that for each element of THIS node, one row is created. In each row the data of exactly one element of this TableRootNode is displayed.

Then you have columns in this table. Inside of the columns there is a header and an editor. The editor is the interesting part.

Normally the primary property of this editor is bound to an attribute of the TableRootNode. Then everything works as expected. If it binds to an attribute of a subnode (SUB) of TableRootNode, then in row i the data of the subnode of the i-th element of TableRootNode is displayed. There is no need for SUB to be a multiple node, but it must not be a singleton.

If you bind a property of the editor to an attribute, which does not lie in the subtree of TableRootNode, then you will see the same value in each row.

Now it depends on the structure of your context. Take the node, which is relevant for the change in each row (I assume it is TRIPS) and bind the table to the node as you are used to. Then for each additional column, you have to create a new column in the tree, create a new header element with a title and a new editor (e.g. textview or inputfield) and then bind the right property of the editor to the corresponding attribute in node AMOUNTS).

If these 2 nodes do not have parent-child-relationship, the tip to create a new node, which consists of the attributes of both nodes is the only solution.

Ciao, Regina

Former Member
0 Kudos

dear Mog,

the best approach is to create a structure which has all the fields of trips and amounts(if both have a different strucure or a subset of fields from both amounts and trips) and

create a third node for the combined data.build the itab of the same combined structure.

u can create a setter method for context with input Parameters trips and amounts(passed as two tables)and write th logic to combine the same in side the method.

and a getter with two output tabels that reads the context data and seperates the table data.this way everywhere else u can use the two table and when u want to send to context call setter and when u want to read call the getter.

hope this helps

Best Regards

suhair

Former Member
0 Kudos

Hi,

you can make a view structure in dictionary of both tables

and fill a table of it where you fill your tables now and copy the right values into it

or create manually each attribute you wish to have in the node and then use the

stru_node (with the magic wand tool) to create a table which you will fill the same way,

in eather way, you will have to fill one structure/table in the node where you collect all the data

grtz

Koen