cancel
Showing results for 
Search instead for 
Did you mean: 

Append rows in a dynamic table.

Former Member
0 Kudos

Hi All,

I have a dynamic table and in that I need two rows that should appear at the end of that dynamic table everytime. I am calculating totals and displaying in those rows. So, no matter how many rows are displayed in dynamic table the last two rows should be displayed.

Can anyone help in this issue.

Thanks in advance,

Chandra

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

There are number of ways you can add row to a table. One is bind table with node and you can keep on inserting in your internal table. Also to add new row to table at runtime you always need not to get all the data in internal table and then again bind it to the node what you can do is just add an element to the node and set your new data in a structure with this new element. Code goes like this:

data: lv_node type ref to if_wd_context_node,

lv_elem type ref to if_wd_context_element,

ls_struc type yyy. (Where yyy is the structure of your node element).

Get the instance of the node in lv_node.

lv_elem = lv_node->create_element( ).

populate ls_struc with your data for new row.

lv_elem->set_static_attributes( static_attributes = ls_struc ).

lv_node->bind_element( NEW_ITEM = lv_elem SET_INITIAL_ELEMENTS = abap_false ).

I hope this might help you a lot.

Regards,

Anand

Answers (1)

Answers (1)

Former Member
0 Kudos

hi chandra ,

take an internal table .take ur value in that ,then append two lines in to that and bind it to that node which is binded to table .as far as for displaying them ,you have to bind table property (ROW VISIBLE) with an attribute.like :

calculate the toal rows in ur table ,add 2 and set that attribute .it will display that much lines.

feel free to get back.

Regards

govi

Former Member
0 Kudos

Hi,

issue :

i have created a dynamic internal table(dyn_tab) and a dynamic work area (dyn_wa).

1. actually i have to calculate some data and then insert the same in to the dynamic table .

ex:

if suppose i have 10 fields in my dynamic table.

and my field names are suppose from 0 to 10 .(wil be created at run time)

iam not able to write " <dyn_wa>-0 = 'help'. " (it is showing an syntax error because the structure is created dynamically which does not have that field name befor the program is executed )

("I WANT TO APPEND A RECORD IN TO DYNAMIC INTERNAL TABLE ")

"PLEASE HELP ME "

please help me out regarding this issue i hope u can do this.

WATING.

Thanks in advance,

shivkanth

Former Member
0 Kudos

Hi,

issue :

i have created a dynamic internal table(dyn_tab) and a dynamic work area (dyn_wa).

1. actually i have to calculate some data and then insert the same in to the dynamic table .

ex:

if suppose i have 10 fields in my dynamic table.

and my field names are suppose from 0 to 10 .(wil be created at run time)

iam not able to write " <dyn_wa>-0 = 'help'. " (it is showing an syntax error because the structure is created dynamically which does not have that field name befor the program is executed )

("I WANT TO APPEND A RECORD IN TO DYNAMIC INTERNAL TABLE ")

"PLEASE HELP ME "

please help me out regarding this issue i hope u can do this.

WATING.

Thanks in advance,

shivkanth

Former Member
0 Kudos

Hi

inside the loop of field catalog or use read statement ,and then use

assign component statement.

for ex:

READ TABLE it_fcat into wa_fcat INDEX 1.

assign component wa_fcat-fieldname of structure <fs_dyntable_ord> to <lv_field>.

here:

<fs_dyntable_ord> - dynamic table Structure

and <lv_field> is a temporary field symbol of type any.