05-23-2011 9:58 AM
Hi Gurus,
Kindly help,
I have created a dynamic internal table using:
CALL METHOD cl_alv_table_create=>create_dynamic_table
Now I want to insert values into the dynamic internal table. How Do I insert values into corresponding columns of the dynamic internal table.
I have searched for many codes on net but I could not find appropriate one.
For example:
vendor_101_xyz_international HY01 HY02 HY03 HY04 Total
article description fergy mash kenyi yaya
101 saffron 04 06 09 01 20
I created dynamic internal tabel with columns:
vendor_101_xyz_international HY01 HY02 HY03 HY04 Total
And now I wanto add values:
101 saffron 04 06 09 01 20
Here coulumns HY01 HY02 HY03 HY04 can change to one or two or any number.
Regards,
Dep
05-23-2011 10:12 AM
Hi,
If you are able to create a dynamic internal table then why are you not able to create a dynamic line type.
field:symbols:<fs> type any.
data:wf_ref type ref to data.
create data wf_ref like line of <fs_tab>. "<fs_tab> is your dynamic internal table
if wf_ref is bound.
assign wf_ref->* to <fs>.
endif.
Now you can use <fs> as your work area.
Search for more details in SCN regarding this.
kesav
05-23-2011 10:58 AM
Hi,
I'm not sure about your requirement but you can try to append an initial line and then loop at the dynamic table like this:
field-symbols: <fs_data> type standard table,
<fs_wa> type any,
<fs_val> type any.
assign dynamic_table->* to <fs_data>. "your dynamic internal table
append initial line to <fs_data>.
loop at <fs_data> assigning <fs_wa>.
assign component 'HY01' of structure <fs_wa> to <fs_val>.
<fs_val> = 'saffron'. "value to be inserted
assign component 'HY02' of structure <fs_wa> to <fs_val>.
<fs_val> = '04'.
"and so on..
endloop.
Hope this helps.
05-24-2011 6:16 AM