‎2007 Jan 19 3:31 PM
Hi experts,
I have a requirement to display a report using WRITE statements. I have an internal table that contains all the data that I will be needing for the report. Then I will loop at the internal table and display the workarea one by one. But then, I need to split the spool into different files when the customer is changed. Will it be possible to split the spool into files? What Function module should I use? I will not be using Smartforms or sapscript. This will be run every night through a batch job in background.
Any help will be greatly appreciated.
Thanks,
Lalyn
‎2007 Jan 19 3:48 PM
Hi Lalyn,
Use AT-NEW kunnr control statement for your internal table. Then perform function modules for background job scheduling.
Job Open, Job Submit & Job Close.
Ashven
‎2007 Jan 19 3:48 PM
Hi Lalyn,
Use AT-NEW kunnr control statement for your internal table. Then perform function modules for background job scheduling.
Job Open, Job Submit & Job Close.
Ashven
‎2007 Jan 19 3:49 PM
‎2007 Jan 19 3:53 PM
‎2007 Jan 19 4:08 PM
I think that FM GET_PRINT_PARAMETERS with the option 'new spool request' (PRI_PARAMS-PRNEW) should work. It would look like this:
DATA: params TYPE pri_params,
valid.
params-prnew = X.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
no_dialog = 'X'
in_parameters = params
IMPORTING
out_parameters = params
valid = valid.and then when you need to start new page:
NEW-PAGE PRINT ON PARAMETERS params NO DIALOG.Depending on your requirements you might need to populate additional fields when calling the FM (it is pretty well documented).
Note that 'no dialog' option should be selected in both places for background processing. It is also possible that params-prnew should be set up after the FM call - I haven't got a chance to test it, sorry!
Hope this helps.
‎2007 Jan 19 4:26 PM
Thanks Christian and Jelena. I'll try to make a sample code with the FM. I'll let you know what happens.
Lalyn
‎2007 Jan 19 4:33 PM
‎2007 Jan 19 4:52 PM
Maybe something could be done by manipulating different options in PRI_PARAMS (or other fields in GET_PRINT_PARAMETERS)? For example, the request can be separated by forcing the request name to be different. Here the request name is the 3-part 'Name' field that can be seen after double-clicking on the request entry in SP01. PRI_PARAMS has the field PLIST, which is labeled 'name of spool request'. I'm wondering what it would do...
Another thing just crossed my mind. If a report runs as a background job maybe there is some spool assignment linked directly to that job and maybe it is overriding whatever the report is trying to do? Just a guess though...
I'm very curious how this turns out. Please keep us posted, Lalyn.
‎2007 Jan 19 5:59 PM
Hi everyone,
Thanks for all the help. FInally, I was able to make my codes work. I just added the line NEW-PAGE PRINT OFF after the first spool.
DATA PARAMS LIKE PRI_PARAMS.
DATA: DAYS(1) TYPE N VALUE 2,
COUNT(3) TYPE N VALUE 1,
VALID TYPE C,
ARPARAMS LIKE ARC_PARAMS.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING DESTINATION = 'LP01'
COPIES = COUNT
LIST_NAME = 'TEST'
LIST_TEXT = 'Test NEW-PAGE PRINT ON'
" IMMEDIATELY = 'X'
" RELEASE = 'X'
NEW_LIST_ID = 'X'
EXPIRATION = DAYS
LINE_SIZE = 79
LINE_COUNT = 23
LAYOUT = 'X_PAPER'
SAP_COVER_PAGE = 'X'
RECEIVER = 'MSANTOS' "'SAP*'
DEPARTMENT = 'System'
NO_DIALOG = 'X'
IMPORTING OUT_PARAMETERS = PARAMS
VALID = VALID.
IF VALID <> SPACE.
NEW-PAGE PRINT ON PARAMETERS PARAMS NO DIALOG.
WRITE / 'first line..'.
NEW-PAGE PRINT OFF.
NEW-PAGE PRINT ON PARAMETERS PARAMS NO DIALOG.
WRITE / 'Second Line...!'.
NEW-PAGE PRINT OFF.
ENDIF.
Thanks,
lalyn