Dear community,
i've got a little problem and I can't fix it on my own.
Some user in our company gave me the instruction to extend an existing SAP Programmm with some defined functionalities.
They want to implement an new button for printing in the gui status and when someone uses the buttons they want to count down a number and print the generated list of the report.
I created also the new button in the gui status with a own functioncode and in the report i implemented an own AT USER-Command event:
*&----
**& Event
*&----
AT USER-Command.
CASE sy-ucomm.
WHEN 'PRVR'.
CALL FUNCTION 'PRINT_REPORT'
EXPORTING
report = sy-cprog
EXCEPTIONS
OTHERS = 99.
When I push my own print button th reports jumps in the At-user-command event.
The window for chosing the print properties will appear immediatly and I cn start printing.
But only the spool-order will only appear when I leave the list-view with the button "back", "exit", or "cancel".
Has anyone an idea why the output appears only when I go back to the selection screen?
Can anybody tell me how to create an printing function to print out the list of an abap-report? I don't wnt to use the normal print-button!
Many thanks in advance.
Michael
Try this...
NEW-PAGE PRINT ON DESTINATION P_DEST2 IMMEDIATELY ' ' KEEP IN SPOOL ' ' LINE-SIZE 100 NEW LIST IDENTIFICATION 'X' NO DIALOG. * You report NEW-PAGE PRINT OFF.
That way...You report would be printed as soon as you press the button -;)
P.S: If you wanted to keep it in Spool...KEEP IN SPOOL 'X'.
Greetings,
Blag.
Hi Michael,
i have tried it with this code:
REPORT ZGRO_TEST1.
*
TABLES: MARA.
*
START-OF-SELECTION.
*
SELECT * FROM MARA UP TO 100 ROWS.
WRITE: MARA-MATNR.
ENDSELECT.
*
AT USER-COMMAND.
*
<b> SY-LSIND = 0.</b>*
CASE SY-UCOMM.
WHEN 'PRPV'.
CALL FUNCTION 'PRINT_REPORT'
EXPORTING
NO_DIALOG = 'X'
<b> REPORT = SY-REPID.</b> ENDCASE.
Perhaps you have to set SY-LSIND = 0.
Hope it helps.
regards, Dieter
Hi Michael,
sy-lsind is the list-id. If you set it to 0 or 1 it jumps (when using BACK)
to the first output-list.
Here a short demo-code to understand it.
Make severeal time doubleclick in the outputline and
look at the changing output.
try it with:
sy-lsind = 1
and
sy-lsind = 1.
*
REPORT ZGRO_TEST1.
*
data: dc type i value 1.
START-OF-SELECTION.
*
WRITE: / 'List:', dc, 'SY-LSIND:', SY-LSIND.
HIDE: SY-LSIND.
*
AT LINE-SELECTION.
dc = dc + 1.
sy-lsind = 1.
WRITE: / 'List:', dc, 'SY-LSIND:', SY-LSIND.
HIDE: SY-LSIND.
*
Hope it helps.
Regards, Dieter
Add a comment