‎2006 Nov 23 1:30 AM
Hi, I am new to ABAP and now customizing a report that need to use <b>SUBMIT (report) Exporting List To Memory. </b>But I do not understand what is being exported to the called program. Internal table? Therefore, I always encounter <i>NOT_FOUND error</i> in <b>FM LIST_FROM MEMORY</b>.
I need to use this because I want to download the result on screen to excel file during background job. (otherwise, only last page of the screen is converted to excel).
please help.. thanks.
____________________________________________________________________
REPORT ZTEST_01 NO STANDARD PAGE HEADING.
"selection screen declaration
" ....
" ....
START-OF-SELECTION.
* submit this report with seltab and export to memory
* seltab store all variants i enter in report ZTEST_01
* and pass to ZTEST_02 to fill in. (seltab is not empty)
SUBMIT ZTEST_02 WITH SELECTION-TABLE seltab
EXPORTING LIST TO MEMORY AND RETURN.
END-OF-SELECTION.
PERFORM display. " Loop itab and write result on screen
PERFORM download_to_excel. " if convert result on screen
" and download to excel file.
ENDIF.
____________________________________________________________________
"ZTEST_02 is used to get data and process.
REPORT ZTEST_02 NO STANDARD PAGE HEADING.
TOP-OF-PAGE.
PERFORM header.
START-OF-SELECTION.
GET pernr.
PERFORM get_data.
END-OF-SELECTION.
PERFORM calculation.
___________________________________________________________________
<b>After report ZTEST_02 is processed, ZTEST_01 will perform display to loop a
internal table and display on screen.
On Selection Screen of ZTEST_01, if user check a checkbox
to download result on screen to excel file, perform download will be run.</b>
PERFORM download_to_excel.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = abaplist
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF SY-SUBRC <> 0. " i always get not_found error.
write: / 'error in LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
list_index = 0
TABLES
listasci = record
listobject = abaplist.
IF sy-subrc = 0.
......
ENDIF.
ENDFORM.
‎2006 Nov 23 2:32 AM
Hi
Hope below code can give you some idea to handle you scenario.
DATA: PRIPAR TYPE PRI_PARAMS,
ARCPAR TYPE ARC_PARAMS,
LAY TYPE PRI_PARAMS-PAART,
LINES TYPE PRI_PARAMS-LINCT,
ROWS TYPE PRI_PARAMS-LINSZ.
DATA: VAL(1).
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
DESTINATION = 'LOCL'
NO_DIALOG = 'X'
IMMEDIATELY = ' '
IMPORTING
OUT_ARCHIVE_PARAMETERS = ARCPAR
OUT_PARAMETERS = PRIPAR
VALID = VAL
EXCEPTIONS
ARCHIVE_INFO_NOT_FOUND = 1
INVALID_PRINT_PARAMS = 2
INVALID_ARCHIVE_PARAMS = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
IN_ARCHIVE_PARAMETERS = ARCPAR
IN_PARAMETERS = PRIPAR
NO_DIALOG = 'X'
* LIST_NAME = 'TESTING PURPOSE ONLY' "L_LIST
IMPORTING
OUT_ARCHIVE_PARAMETERS = ARCPAR
OUT_PARAMETERS = PRIPAR
VALID = VAL
EXCEPTIONS
ARCHIVE_INFO_NOT_FOUND = 1
INVALID_PRINT_PARAMS = 2
INVALID_ARCHIVE_PARAMS = 3
OTHERS = 4.
IF SY-SUBRC EQ 0.
NEW-PAGE PRINT ON
NEW-SECTION
PARAMETERS PRIPAR
ARCHIVE PARAMETERS ARCPAR
NO DIALOG.
ELSE.
WRITE:/ 'UNABLE TO CREATE SPOOL'.
ENDIF.
WRITE:/ 'FIRST LINE'.
WRITE:/ 'SECOND LINE'.
NEW-PAGE PRINT OFF.
DATA: L_SPOOL LIKE TSP01-RQIDENT.
DATA: BEGIN OF BUFFER OCCURS 10000,
TEXT(255) TYPE C,
END OF BUFFER.
DATA: STARTLINE TYPE I, ENDLINE TYPE I, FNSTR TYPE STRING.
STARTLINE = 1. L_SPOOL = SY-SPONO.
REFRESH BUFFER.
ENDLINE = STARTLINE + 9999.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
RQIDENT = L_SPOOL
FIRST_LINE = STARTLINE
LAST_LINE = ENDLINE
DESIRED_TYPE = 'RAW'
* IMPORTING
* REAL_TYPE =
TABLES
BUFFER = BUFFER
EXCEPTIONS
NO_SUCH_JOB = 1
JOB_CONTAINS_NO_DATA = 2
SELECTION_EMPTY = 3
NO_PERMISSION = 4
CAN_NOT_ACCESS = 5
READ_ERROR = 6
TYPE_NO_MATCH = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.Now internal table BUFFER holds the data in output, you can use the same to download to an excel file.
Kind Regards
Eswar
‎2006 Nov 23 3:30 AM
Hi Eswar,
thanks for your prompt reply.
Will this Buffer stores all the data, excactly like on the screen?
Should I use FM <b>LIST_TO_ASCI </b> and <b>GUI_DOWNLOAD</b> to convert it to excel?
‎2006 Nov 23 6:47 AM
Hi Eswar,
I can download a complete result to excel. thanks
and then i use FM <b>MONI_CALL_SPOOLSHOW</b> in order to display the spool on screen. However, I found that the New-page on my report is no longer work.
for example:
__________________________________________________________________
Section: HOTEL
Position H/C as at H/C During
28.02.2003 Period
ADMINISTRATION
HOTEL MANAGER 1 2
ASST. MANAGER 1 1
SECRETARY 1 2
Total by Department 3 5__________________________________________________________________
Before sending as spool, I can display result according to new section such as HOTEL, CLUB, DECK and ENGINE in new page.
But, when I use FM <b>GET_PRINT_PARAMETERS</b> and followed by <b>NEW-PAGE PRINT ON</b>. All new section is no longer separated to new page.
May I know how to solve it?
‎2006 Nov 23 7:47 AM
Hi Huai Ying Tan
We can still use NEW-PAGE to split within a spool.
So use this in event like:
AT NEW SECTION..
NEW-PAGE.
ENDAT.This will display the list in separate pages.
Hope this helps you.
Kind Regards
Eswar
‎2006 Nov 23 4:24 AM
hi
good
go through these links and use accordingly
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dba50d35c111d1829f0000e829fbfe/content.htm
http://abap4.tripod.com/Output_List_Manipulation.html
http://www.sapdevelopment.co.uk/reporting/rep_submit.htm
thanks
mrutyun^