I did create a ABAP report to print some ZPL which works fine. Now my goal is to transfer that logic into a FM to be able to call it wherever and however I want. Problem is that doing so causes my SAPGUI to deadlock itself for like 10 minutes and show me a message saying "rolling area is to small".
In order to print the ZPL I used this guides:
This is the most stripped down code I tested:
call function 'GET_PRINT_PARAMETERS'
exporting
destination = 'WA06'
copies = 1
list_name = 'TEST'
list_text = 'Test NEW-PAGE PRINT ON'
immediately = 'X'
release = ' '
new_list_id = 'X'
expiration = 2
layout = 'G_RAW'
sap_cover_page = 'X'
receiver = sy-uname
department = 'System'
no_dialog = abap_false
line_count = 60
importing
out_parameters = params
valid = valid.
if valid <> space.
new-page print on parameters params no dialog.
format color off intensified off.
print-control function 'BCPFX'.
write: / ' :NEW-PAGE'.
write: / ' ^XA ' .
write: / ' ^FO040,040^A0N,40,40^FDHello World^FS '.
write: / ' ^XZ ' .
write: / ' ^FX End of Job'.
endif.
It basically just calles GET_PRINT_PARAMETERS, does some printer control voodoo and then writes the lines. This works perfectly fine when I execute that out of a SE38 report. But does absolutly nothing past showing me the printer settings windows and entering it. It just runs for like 10 minutes and then shows me the scrolling area is too small error which just goes away as soon as I try to hit F1 for help.
I managed to debug that FM to an extent so that I understand now that the problem lies not in my program but somewhere in the the surrounding SFCS_FA_TEST_FUNCTION
FM or to be more precise, the deadlock occures on line 271 when executing SFCS_FA_OUTPUT_LIST
, which consequently has a check from line 48 onwards
* Und dann das Ganze ausgeben
IF rseumod-fbalv_grid = space.
CALL SCREEN 500.
ELSE.
CALL SCREEN 800. " ec: ALV-Darstellung
ENDIF.
Here the CALL SCREEN 500 gets called over and over and over.
Has anyone experienced the same problem and can help me solving it?
The problem seems to be the SE37 environment. The fact that I try to write to a printer in a FM. If I call the FM from a normal report then all works out as expected.