cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding attribute binding in table

Former Member
0 Kudos

Hi all,

I have to create a table with one dropdown by key Column.For creation ,i will select one entry according to that(in col1) name and address(in col2) will come For example: Sold to party- name and address,Ship to party-name address,Engineer-name address.For Display,all table rows with values will come.My problem is for every entry name and address are coming from different tables means different fields.so if i will create one node with attributes for name and address ,through which i will bind these fields as for every entry fields are coming from diff table fields.Pls help me how to proceed.

Thanks

Kiran

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184578
Active Contributor
0 Kudos

Hi Kiran,

I think I understood ur prob clearly.. if nt reply me..

No Problem if the fields are from different tables.., take a node in context op_table create two attributes name address.,

now write a query as follows.,

select aname baddress

into corresponding fields of table lt_op_table " ( this is the req internal table., ie type ref to wd_this-elements_lo_nd_op_table)

from name_table as a

inner join on common field from address_table as b

where <condition required>

now bind this internal table to ur table UI.

lo_nd_op_table->bind_table( lt_op_table ).

U can use for all entries also.. else u can also take two internal tables in the first table all name values and in the second table all address values and loop those two tables and append to final out put table and then bind.

Reply if u need some more clarifications.,

Thanks and Regards,

Kiran

Former Member
0 Kudos

Thanks Kiran... but the problem is same NAME and ADDRESS field have different data element.Let me elaborate it.

i have 4 columns in table.first col with dropdown having 5 options based on selection NAME ADDRESS col will display.say :

col1 col2 col3

selection

from dropdown NAME ADDRESS

Currently i have to work for display mode..so if selection is

AB(hrp1000) then NAME(STEXT) ADDRESS(SHORT)

ZB(pa0001) then NAME(ENAME) ADDRESS(SNAME)

SP(kna1) then NAME(NAME1) ADRESS(ORT01)

So i have 3 attributes for name and three for add.through which i bind this name and add.Pls help to figure out this.

former_member184578
Active Contributor
0 Kudos

Hi kiran,

Take attribute type for name address in context node as string..

and in onselect event of drop down check the condition and based on that populate the values..

for ex.. if drop_dwn_val = 'AB'

select aname baddress " here give corresponding field names

into corresponding fields of table lt_op_table " ( this is the req internal table., ie type ref to wd_this-elements_lo_nd_op_table)

from name_table_1 as a

inner join on common field from address_table_1 as b

where <condition required>

elseif drop_dwn_val = '$$$'

select aname baddress " here give corresponding field names

into corresponding fields of table lt_op_table " ( this is the req internal table., ie type ref to wd_this-elements_lo_nd_op_table)

from name_table_2 as a

inner join on common field from address_table_2 as b

where <condition required>

else u can take different internal tables and loop and finally append to ur output table and bind it..

Thanks

Regards

Kiran

Former Member
0 Kudos

Hi Kiran,

Hope I understand the problem correctly......

we have to get the table row from which the drop down was selected and we have to populate other columns in that particular row as per the selection.

The steps will be

1)Get the selected row index in the table

DATA : lo_element TYPE REF TO if_wd_context_element.

CALL METHOD wdevent->get_context_element

EXPORTING

name = 'CONTEXT_ELEMENT'

RECEIVING

value = lo_element.

lv_index = lo_element->get_index( ).

2)Get the values in that row of table

  • get element via lead selection

lo_el_node = lo_nd_node->get_element( lv_index ).

3)if you have created your dropdown in another node then navigate to the drop down get the selected value.

4) Go for the select queries as per your condtion

5)Bind them again to the table (can use lo_el_node->set_attribute )....

I guess it works...

Thanks,

Anil kumar Y.

Edited by: YENGALASETTY ANIL on Mar 21, 2011 12:39 PM

Former Member
0 Kudos

Thank you so much Kiran.....i got an idea...now i am proceeding.