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

simple program to the gurus.

Former Member
0 Likes
607

hello sap gurus,

i am a beginner in sap and still trying to get a hang of all the syntax..

i am trying to write a program which would display first 10 rows of any table choosen by the user at selection screen.selection screen will have a parameter field to contain name of database table.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
582

see this blog by rich heilman

<a href="/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap:///people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap

regards

shiba dutta

5 REPLIES 5
Read only

Former Member
0 Likes
582

Below is the generic program for ur requirement.

PARAMETER : p_table like dd02l-tabname.

Field-symbols : <fs_tab> type table, <wa> type any.

DATA : v_ref type ref to data, v_ref2 type ref to dat, str type sting.

create data v_ref type table of ( p_table ).

Assign v_ref->* <fs_tab>.

Create data v_ref2 type ( p_table ).

Assign v_ref2->* <wa>.

Select * into <fs_tab> from ( p_table ) up to 10 rows.

Loop at <fs_tab> into <wa>.

MOVE <wa> to str.

Write 😕 str.

Endloop.

Please check the syntax

<b>Reward if its useful.</b>

Regards,

Sail

Read only

0 Likes
582

hai aarun,

i tried with your code...no it doesnt help..i think there is type conflict when u r assaigning the parameter the field symbol of type table .

pls let me know if i am wrong..

thanks

Read only

0 Likes
582

Just look at the blog by Rich, suggested by Shiba. it will solve your problem.

Regards,

Atish

Read only

Former Member
0 Likes
583

see this blog by rich heilman

<a href="/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap:///people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap

regards

shiba dutta

Read only

0 Likes
582

sheeba thanks so much..i am trying to follow the code in the blog...looks like i have to make some minor changes for getting values of any table(eg mara)..

anyway thanks a ton