2015 Feb 06 11:06 AM
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...
2015 Feb 06 11:25 AM
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.
2015 Feb 06 11:55 AM
Check this blog if your output is a ALV ---http://scn.sap.com/community/abap/blog/2011/07/07/gain-programmatic-access-to-data-of-sapgui-alv-rep...
2015 Feb 06 12:38 PM
You could look at Convert Spool List to ALV Grid, and for an ALV look for cl_salv_bs_runtime_info
Regards,
Raymond
2015 Feb 09 7:38 AM
Thanks for your replies....
But I am getting data as shown below screen
how get this into an internal table ?
Regards,
Raj,,,
2015 Feb 09 7:49 AM
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.
2015 Feb 09 8:02 AM
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.
2015 Feb 09 8:08 AM
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.
2015 Feb 09 8:37 AM
Hi ,
You can use
data : lt_itab type TABLE OF string.
SPLIT string(your string) at '#'(your separator) INTO TABLE lt_itab.