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

How to convert String data to Internal table data?

former_member220941
Participant
0 Likes
8,790

Dear All,

I am submitting a standard report with EXPORTING LIST TO MEMORY AND RETURN.

My issue is I am getting data from FM : 'LIST_TO_ASCI  in vlist table as a string. I want to convert that data into an internal table.

If you have any idea please let me know .

    

Code :

DATA : BEGIN OF vlist OCCURS 0,

             f1    TYPE  char255,

             END   OF vlist.



SUBMIT rmcbuh30  WITH werke      IN t_rg

                    WITH vondatum   EQ im_date_low

                    WITH bisdatum   EQ im_date_high

                    EXPORTING LIST TO MEMORY AND RETURN.

   CALL FUNCTION 'LIST_FROM_MEMORY'

     TABLES

       listobject = itab_list

     EXCEPTIONS

       not_found  = 4

       OTHERS     = 8.

   CALL FUNCTION 'LIST_TO_ASCI'

     EXPORTING

       list_index         = -1

     TABLES

       listasci           = vlist

       listobject         = itab_list

     EXCEPTIONS

       empty_list         = 1

       list_index_invalid = 2

       OTHERS             = 3.



Regards,

Raj...

8 REPLIES 8
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
2,785

Hi,

If it is pipe delimited, loop at internal table and split it at '|'.

Declare new internal table as required and while splitting, put it into its work area.

You may need to do it from record 3 or 4, if there is header.

loop at old_itab into wa.

..

split wa at '|' into wa_new-f1 wa_new-f2.

append wa_new to itab_new.

endloop.

Read only

SharathYaralkattimath
Contributor
Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,785

You could look at Convert Spool List to ALV Grid, and for an ALV look for cl_salv_bs_runtime_info


Regards,

Raymond

Read only

0 Likes
2,784

Thanks for your replies....

But I am getting data as shown below screen

how get this into an internal table ?

Regards,

Raj,,,

Read only

0 Likes
2,784

Hi Raj,

Is there any delimited exist in the string data ? Based on this we can move string data to the internal table.

Thanks,

Aarti.

Read only

0 Likes
2,784

HI,

You can use offset for splitting based on value.

Sample code:

data var1(20) type c value 'ABC DEF GHI'.
data : v1(5), v2(5).
v1 = var1+0(4).
v2 = var1+4(4).
write v1.
uline.
write v2.

Read only

0 Likes
2,784

you have to use the following logic to separate them.

loop at itab.

split itab-data at CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB into itab1-field1 itab1-field2 itab1-field3.

append itab1.

clear itab1.

endloop.

Read only

nagarjun_kalletla
Participant
0 Likes
2,784

Hi ,

You can use

data : lt_itab type TABLE OF string.

         

SPLIT string(your string) at '#'(your separator) INTO TABLE lt_itab.