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

insert into database table dynamically

Former Member
0 Likes
856

Hi

My requirement is i have one table with 4 userdefined fields. In future there may be a chance of adding few more userdefined fields. So each time whenever they are changing the table i have to change the RFC so for avoiding this i am creating one RFC for inserting datas into DB table. Two import parameters are field name & field value. So based on the fieldname that value should be added in that place of the DB table. How can i write code for that. please help me.

7 REPLIES 7
Read only

Former Member
0 Likes
756

Hi

You can achieve this using Field symbols

assign component 'field1' of structure <fs_dynamic_tab> to <fs_field1>

then assign the value to the FS and update the table.

Read only

Former Member
0 Likes
756

it can easly get by using field symbols

Read only

Former Member
0 Likes
756

Yes you can do like that.

Selection parameters, select options will be changed to IMPORTING PARAMETERS.(all these parameters should be pass by value).

And If your report contains some Output. then You have to use export or Table parameters For Output table parameters.

and write your code in source code tab.

Read only

0 Likes
756

In RFC's can we use field symbols..

can u give me small example. i never worked on field symbols.

Read only

0 Likes
756

Hi

try this

create data ls_tabn like line of <dbtab>.

assign ls_tabn->* to <ls_final>.

concatenate lw_tabn va_vbeln into lw_fname separated by '-'.

assign component lw_fname of structure <ls_final>

to <ls_fieldval>.

if sy-subrc = 0.

<ls_fieldval> = (value).

endif.

Insert into <dbtab> from <ls_final>

Read only

0 Likes
756

i am not clear.. i have to declare field symbol na

Here what is ls_final & ls_fieldval.

Edited by: Hima on Jul 29, 2008 1:55 PM

Read only

0 Likes
756

Hi,

field symbol is nothing but workarea.

u need not to clear the fieldsymbols.