04-21-2006 2:59 PM
Hi Everyone
I have written a program that uses the cl_gui_alv_grid class to display data. The program works fine when run in the foreground but if a user tries to run it in the background they get the above error.
I understand that this is because the program is unable to access gui components when running in the background. I therefore need to test for background processing and either:
1. terminate the program
2. have some fallback procedure within the program to deal with background processing.
My question is therefore in two parts:
1. How do I find out if the program has been set to run in the background?
2. What do I need to do to allow my program to work in the background? i.e. is there a function/class that I can pass the data to that will do this or do I have to re-write the report in full as if I wasn't using the grid viewer at all?
Kind regards
Andrew
04-21-2006 3:08 PM
Hi,
Do this,
CREATE the container only upon the following condition.
IF CL_GUI_ALV_GRID=>OFFLINE IS INITIAL
CREATE THE CONTAINER
ENDIF.
Continue with creating the grid, field catalog etc etc.
Regards,
Ravi
Note :Please close the post, if the issue is answered.
04-21-2006 3:05 PM
Hello Andrew,
to 1.) If SY-Batch is initial.
" it's dialog.
ELSE.
" it's batch
ENDIF.
to 2.) Display data in batch in an old fashioned way, e.g.
using FM 'REUSE_ALV_LIST DISPLAY' .
Regards Wolfgang
04-21-2006 3:08 PM
Hi,
Do this,
CREATE the container only upon the following condition.
IF CL_GUI_ALV_GRID=>OFFLINE IS INITIAL
CREATE THE CONTAINER
ENDIF.
Continue with creating the grid, field catalog etc etc.
Regards,
Ravi
Note :Please close the post, if the issue is answered.
04-21-2006 3:16 PM
Hi
You should check the CL_GUI_ALV_GRID=>OFFLINE as Ravi said and the force the print.
You can do it setting the IS_PRINT-PRINT of method SET_TABLE_FOR_FIRST_DISPLAY.
In this way you program should generate a spool.
Max
04-21-2006 3:59 PM
Thanks everyone for your really fast responses! It seems to be working so points duly awarded.
Kind regards
Andrew