Application Development 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: 

Split text to dymainc internal table

vallamuthu_madheswaran2
Active Contributor
0 Kudos

Hi Friends,

I am creating a dynamic internal table based on the condition table and downloading the internal table as Excel.

Fill in the data and upload the Excel. Now how to split the data and put it in the dynamic internal table.

The below image is uploaded excel data

I want to split the data and pass it to a dynamic internal table. Kindly find the below screen shot.

Thanks with regards,

Vallamuthu M.

8 REPLIES 8

Sandra_Rossi
Active Contributor
0 Kudos

If you don't give an example, you will receive either lots of miscellaneous answers which don't match your question, or no answer at all...

xiswanto
Active Participant
0 Kudos

you already create the dynamic itab, so just use the split ... at ... syntax. what are you confused with?

vallamuthu_madheswaran2
Active Contributor
0 Kudos

Hi Siswanto Tan.

I am using the below syntax

SPLIT lwa_data AT cl_abap_char_utilities=>horizontal_tab INTO TABLE <fs_dyn_table>.

but it gives data like this.

Thanks with Regards,

Vallamuthu M

xiswanto
Active Participant
0 Kudos

based on your data, I don't think you could split the result into the itab directly, you should split the data into the workarea.

Not sure if there is a more straightforward way to do so, but I could propose another option.

another way to do:
1. keep track of the fields in dynamic itab ( such as field 1: VKORG, field 2: VTWEG, etc ) ,preferably store the field name in a string itab ( named it_field_name ).
2. split the lwa_data into another string itab ( named it_temp_value ).
3. loop at it_temp_value, read it_field_name based on the sy-tabix of current loop ( if you don't store the field name, then hardcode the field name based on the sy-tabix position ), ASSIGN it_temp_value INTO <fs_field> ( refer to workarea name with the same structure ), and you can fill in <fs_field> value with it_temp_value. Finally, you can append work area or field symbol with same dynamic structure into <fs_dyn_table>.

Sandra_Rossi
Active Contributor
0 Kudos

To be short: use an intermediate internal table to contain only the field values, don't store directly in <fs_dyn_table>.

NB: if you search the forum concerning "dynamic internal tables", you will find ASSIGN COMPONENT everywhere. Do you understand how it works?

matt
Active Contributor

You know that in this context # means undisplayable character (and possibly #). So while it will work for your string, it won't if the string is, e.g. a horizontal tab as in the original post.

Sandra_Rossi
Active Contributor
0 Kudos

The OP has mentioned:

SPLIT lwa_data AT cl_abap_char_utilities=>horizontal_tab ...

ThorstenHoefer
Active Contributor
0 Kudos

Please check the function (sm37) GUI_UPLOAD with the parameter HAS_FIELD_SEPARATOR

Kind regards

Thorsten