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 data into a database table from a string

Former Member
0 Likes
1,476

Hi,

I am need to insert data into a table from the text file. I pull the data into an internal table using GUI_UPLoad. I read the data into an internal table and concatenate data into a string. I need to do this because the structure of the table is dynamic. it is used to upload a series of tables each with different structure, But the data is stored in the string v_tabledata. How to do that.

after uploading the data from the textt file into a table

oop at i_final.

v_tabname = i_final-table_name.

concatenate i_final-table_rec1 i_final-table_rec2 i_final-table_rec3

i_final-table_rec4 i_final-table_rec5 into v_tabledata.

from 'v_table data' i need to upload the data into a table and the structue of the table is known dynamically. Any thoughts using field symbols?

Thanks,

VG

4 REPLIES 4
Read only

Former Member
0 Likes
977

Hi,

just a follow up, i am trying something like this...

decl...

field-symbols: <fs_table> type any.

assign (v_tabname) to <fs_table>.

assign the table name to the FS and then try to modify. something on the similar lines...

modify <fs_table> from v_tabledata.

Thanks in advance,

VG

Read only

0 Likes
977

Let me see if I've understood your issue

You have a file to be uploaded into an internal table but this file has many different layouts and then you don't know how to link these fields with the internal table...is it your issue?

Then you've read the internal table, you've sent it to a string divided by space or something else and then are you trying to read this string to send it to a table?

We could read the standard tables which maintain the program names, table names etc... (DD* tables, as the DD03L table) and then create some rules...

We could create a parameter table to read your file/table dynamically...

Please, try to rewrite in other words your problem...because there are a lot of ways to achieve your issue...

Alexandre Mendes

Read only

Former Member
0 Likes
977

Hi,

Example :

TYPES : BEGIN OF TY_VALUE,

VALUE(10) TYPE C,

VALUE1(20) TYPE C,

END OF TY_VALUE.

DATA : WA TYPE TY_VALUE,

LV_VALUE TYPE STRING.

LV_VALUE = '1234567890ABCDEFGHIJKLMNOP'.

FIELD-SYMBOLS :<FS> TYPE C .

ASSIGN WA TO <FS> CASTING.

<FS> = LV_VALUE.

IF <FS> IS ASSIGNED.

WRITE : WA-VALUE,

WA-VALUE1.

UNASSIGN <FS>.

ENDIF.

With Regards,

Sumodh.P

Read only

0 Likes
977

Hi,

I tried something like this and worked fine..

assign v_tabledata to <fs_string>.

assign <fs_string> to <fs_table>.

modify (v_tabname) from <fs_table>.

Dynamically passing the table layouts and passing the data from a string worked perfectly.

Hope this helps,

VG