‎2005 Nov 22 11:09 AM
I have output data from a list in ABAP memory, is there a way to read data into an internal table?
‎2005 Nov 22 11:11 AM
Use the import statement, if you have already expoted it using an export statement.
examples,
TYPES: BEGIN OF TAB3_TYPE,
CONT(4),
END OF TAB3_TYPE.
DATA: INDXKEY LIKE INDX-SRTFD,
F1(4), F2 TYPE P,
TAB3 TYPE STANDARD TABLE OF TAB3_TYPE WITH
NON-UNIQUE DEFAULT KEY,
WA_INDX TYPE INDX.
INDXKEY = 'INDXKEY'.
IMPORT F1 = F1
F2 = F2
TAB3 = TAB3 FROM DATABASE INDX(ST) ID INDXKEY
TO WA_INDX.
**************************************************************
Example 2
TYPES: BEGIN OF TAB3_LINE,
CONT(4),
END OF TAB3_LINE,
BEGIN OF DIRTAB_LINE.
INCLUDE STRUCTURE CDIR.
TYPES END OF DIRTAB_LINE.
DATA: INDXKEY LIKE INDX-SRTFD,
F1(4),
F2(8) TYPE P decimals 0,
TAB3 TYPE STANDARD TABLE OF TAB3_LINE,
DIRTAB TYPE STANDARD TABLE OF DIRTAB_LINE,
INDX_WA TYPE INDX.
INDXKEY = 'INDXKEY'.
EXPORT F1 = F1
F2 = F2
TAB3 = TAB3
TO DATABASE INDX(ST) ID INDXKEY " TAB3 has 17 entries
FROM INDX_WA.
...
IMPORT DIRECTORY INTO DIRTAB FROM DATABASE INDX(ST) ID INDXKEY
TO INDX_WA.
‎2005 Nov 22 11:16 AM
I am using LIST_FROM_MEMORY FM but it is giving output in line, i require it in internal table.
It there a possibility?
‎2005 Nov 22 11:16 AM
That's it!!! 😃
- IMPORT obj1 ... objn FROM MEMORY.
- IMPORT obj1 ... objn FROM DATABASE dbtab(ar) ID key.
- IMPORT obj1 ... objn FROM LOGFILE ID key.
- IMPORT DIRECTORY INTO itab FROM DATABASE dbtab(ar) ID key.
- IMPORT obj1 ... objn FROM DATASET dsn(ar) ID key.
- IMPORT obj1 ... objn FROM SHARED BUFFER dbtab(ar) ID key.
TG - Tiago Godoy
‎2005 Nov 22 11:23 AM
after using LIST_FROM_MEMORY you need to use FM
call function 'LIST_TO_ASCI'
exporting
list_index = -1
tables
listasci = int_ascitab
listobject = int_abaplist
exceptions
empty_list = 1
list_index_invalid = 2
others = 3.
Regards
Raja
Reward points for helpful answers
‎2005 Nov 22 11:35 AM
yes, but this is giving the output in a line, not as records in the table.I want to pass this as an input to resue_alv_list_display fm to display the output in alv.it is possible?
‎2005 Nov 22 11:40 AM
yes its very much possible..
you just have to loop at list_asc, and feed the value to a corresponding internal table that you will be using for alv(say its itab).
something like..
loop at list_asc.
itab-matnr = list_asc-msg(20).
itab-matkx = list_asc-msg+20(10).
*--so on by strng offsert you hav to take it in itab
append itab.
endloop.
now use itab in your alv.
cheers.
plz reward points if it helps you
‎2005 Nov 22 11:17 AM
Hi Aruna,
Use the IMPORT statement to read into internal table.
Abdul
‎2005 Nov 22 11:22 AM
there is way..
see the follwoing report..
HERE WE DOWNLOAD O/P OF a REPORT TO TEXTPAD IN LOCAL PC.
the internal table <b>list_asc</b> containes the o/p of specified report.
i have used that content of internal table to download in c:\abc.txt file.
you can do whatever you wish, with the content of list_asc as per your requirements.
just run it once, enter the report name in caps in selection screen.
<u>plz reward points if it helps you.</u>
REPORT zanid_test4 MESSAGE-ID zz.
*
parameter: reportnm LIKE sy-repid .
DATA : list LIKE TABLE OF abaplist WITH HEADER LINE.
DATA : BEGIN OF list_asc OCCURS 0,
msg(300) TYPE c,
END OF list_asc.
DATA : wa_c_filename(30) TYPE c.
SUBMIT (reportnm) EXPORTING LIST TO MEMORY
AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = list
EXCEPTIONS
not_found = 1.
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
LIST_INDEX = -1 "LIST_INDEX SY-LSIND.
TABLES
listasci = list_asc
listobject = list.
*----downloading to local pc
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = ' '
CODEPAGE = ' '
FILENAME = 'c:\abc.txt'
FILETYPE = 'ASC'
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = list_asc
FIELDNAMES =
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10 .
‎2005 Nov 22 11:47 AM
‎2006 Feb 10 1:34 PM
I need to send the list output as a mail....can anyone help??