Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

dynamic internal table please help

Former Member
0 Likes
590

hi

i have bulid a internal table (dynamically)

but i cannot get value to print under the internal table

loop at it_final2 into WA_COUNT.

MOVE-CORRESPONDING WA_COUNT TO <DYN_WA>.

ASSIGN COMPONENT WA_COUNT-BTEXT OF STRUCTURE <dyn_wa> TO <fs_1>.

*ASSIGN COMPONENT WA_COUNT-num OF STRUCTURE <dyn_wa> TO <fs1>.

ASSIGN WA_COUNT-NUM TO <fs_1>.

append <dyn_wa> to <DYNTABLE>.

endloop.

sarangan r

5 REPLIES 5
Read only

FredericGirod
Active Contributor
0 Likes
573

What about something like that ?

loop at it_final2 
  into wa_count.
  loop at it_fieldcatalog
    into is_fieldcatalog.
    assign component is_fieldcatalog-fieldname of structure <dyn_wa> to <field>.
    check sy-subrc eq space.
    concatenante 'it_final2-' fieldname into field.
    assign (field) to <field2>.
    check sy-subrc eq space.
    move <field2> to <field>.
    ...
  endloop.
endloop.

Rgd

Frédéric

Read only

hymavathi_oruganti
Active Contributor
0 Likes
573

loop at it_final2 into WA_COUNT.

MOVE-CORRESPONDING WA_COUNT TO <DYN_WA>.

ASSIGN COMPONENT WA_COUNT-BTEXT OF STRUCTURE <dyn_wa> TO <fs1>.

<b>ASSIGN WA_COUNT-NUM TO <fs_1>.

<fs1> = <fs_1>. </b>

" above statement is moving value to the field

ABOVE CAN ALSO BE REPLACED LIKE BELOW

*********<FS1> = WA_COUNT-NUM.

append <dyn_wa> to <DYNTABLE>.

endloop.

copy and paste above, it will work.

in ur program, u r pointing field and value both to <fs_1>

thats wrong. both should be different fieldsymbols.

that is not that much confusing.

with ASSIGN COMPONENT , WE ARE POITING THE FIELD to a field symbol.

with ASSIGN we are pointing value to a field symbol.

NOW <FS1> = <fs_1>

MEANS WE ARE PASSING VALUE TO THE FIELD.

WITH ASSIGN , we are assigning

Read only

0 Likes
573

sorry small correction to the above

we cant give like this <FS1> = WA_COUNT-NUM.

give like below

*********assign WA_COUNT-NUM to <fs1>.

Read only

former_member186741
Active Contributor
0 Likes
573

sorry, but i don't understand. what is it you want to print? please give more info.

Read only

Former Member
0 Likes
573

Hi Sarangan,

Check this:

field-symbols: <dyn_table> type standard table,

<dyn_wa>,

<dyn_field>.

  • Suppose u have created the table now->

  • Select Data from table.

select * into table <dyn_table>

from (p_table).

*Print table

loop at <dyn_table> into <dyn_wa>.

do.

assign component sy-index

of structure <dyn_wa> to <dyn_field>.

if sy-subrc <> 0.

exit.

endif.

write: <dyn_field>.

enddo.

endloop.

Thanks & Regards,

Ankur