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

saving data to database table using dynamic sql

former_member232092
Participant
0 Likes
681

hi all,

Is there a way to modify database table dynamically from work area using dynamic sql.

regards

ramesh

Moderator message: please search for available information/documentation before asking.

Edited by: Thomas Zloch on Nov 26, 2010 1:31 PM

4 REPLIES 4
Read only

Former Member
0 Likes
631

tables: mara.

data: tablename type tabname,

fname type fieldname,

fieldnames type fieldname occurs 0.

field-symbols : <fs_tableline> type any,

<fs_fieldval> type any.

initialization.

tablename = 'MARA'.

assign (tablename) to <fs_tableline> .

fname = 'MATNR'.

append fname to fieldnames.

fname = 'MTART'.

append fname to fieldnames.

select (fieldnames)

from (tablename)

up to 20 rows

into corresponding fields of <fs_tableline>.

loop at fieldnames into fname.

assign component fname of structure <fs_tableline> to <fs_fieldval>.

write : <fs_fieldval>.

endloop.

new-line.

endselect.

Also Refer http://www.abapcode.info/2007/12/how-to-use-dynamic-sql-in-abap-report.html

Edited by: Rahul Babukuttan on Nov 26, 2010 11:33 AM

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
631

Its possible . Try it once.

Read only

0 Likes
631

I do hope it's not on standard SAP tables.

If it is: looking forward to your next threads...

Read only

0 Likes
631

Not standard ones .... Z and Y