outputabapforeground

In ABAP, when in foreground, how do I tell the program to send output to spool vs display


I have a program that is running in foreground, with simple WRITE statements. When List Processing is complete, the program displays the contents of the output. When I run this program in background, the output from the WRITE statements generates a spooled file. I want to do the same when this program is running in foreground. This is exception output that I need to log somewhere, but not on the display.

How do I code the output to go to spool for a program running in foreground?

I have not tried anything that I can describe here. I do not want to create an ALV because the contents of the WRITE statements vary based on the data.


Solution

  • In general the NEW-PAGE PRINT ON statement can be used for this:

    NEW-PAGE ABAP Help