10-06-2008 12:46 PM
Hi,
I got the following error message while running the job in background.
"Step 001 started .
Control Framework: Fatal error - GUI cannot be reached.
ABAP/4 processor: RAISE_EXCEPTION
Job cancelled"
What is the reason for this error and how to correct it?
10-06-2008 12:50 PM
ALV Grid control is based on the custom controls on the screen. When the program is scheduled in background, it tries to create GUI related front-end objects and hence the error u201CFatal Error u2013 GUI cannot be reachedu201D. This type of problem is common with all the programs that use the ALV grid control to display the output.
Solution:
Whenever we execute this type of programs in background, we should be passing a blank docking container instead of the custom container as parent to our grid control.
The docking container doesnu2019t need any of the custom controls on the screen; instead it attaches an area to any or all of the four edges of the screen (top, left, right or bottom). The behavior of the areas in the container is determined by the sequence in which they are initialized. Docking Containers are attached to the screen from the inside out. This means that when you create a second container, it is attached to the edge of the screen, and the container that was already there is pushed outwards.
Let us modify the standard program (by taking a copy of it) to enable it to execute it in background.
Following modifications have to be made:
· Define a docking container in the program
data: or_doc type ref to cl_gui_docking_container .
· At the time of creating a custom container, check if the program is being executed in background or foreground. If the program is scheduled in background, then create a docking container instead of custom container.
if cl_gui_alv_grid=>offline( ) is initial.
create object or_custom_container
exporting container_name = c_container.
create object or_grid
exporting i_parent = or_custom_container.
else .
create object or_grid
exporting i_parent = or_doc .
endif .
Now test executing the program in background. The report would be generated.
10-06-2008 12:50 PM
ALV Grid control is based on the custom controls on the screen. When the program is scheduled in background, it tries to create GUI related front-end objects and hence the error u201CFatal Error u2013 GUI cannot be reachedu201D. This type of problem is common with all the programs that use the ALV grid control to display the output.
Solution:
Whenever we execute this type of programs in background, we should be passing a blank docking container instead of the custom container as parent to our grid control.
The docking container doesnu2019t need any of the custom controls on the screen; instead it attaches an area to any or all of the four edges of the screen (top, left, right or bottom). The behavior of the areas in the container is determined by the sequence in which they are initialized. Docking Containers are attached to the screen from the inside out. This means that when you create a second container, it is attached to the edge of the screen, and the container that was already there is pushed outwards.
Let us modify the standard program (by taking a copy of it) to enable it to execute it in background.
Following modifications have to be made:
· Define a docking container in the program
data: or_doc type ref to cl_gui_docking_container .
· At the time of creating a custom container, check if the program is being executed in background or foreground. If the program is scheduled in background, then create a docking container instead of custom container.
if cl_gui_alv_grid=>offline( ) is initial.
create object or_custom_container
exporting container_name = c_container.
create object or_grid
exporting i_parent = or_custom_container.
else .
create object or_grid
exporting i_parent = or_doc .
endif .
Now test executing the program in background. The report would be generated.
10-06-2008 1:38 PM
10-06-2008 1:45 PM
DATA :
C_CONTAINER TYPE SCRFNAME VALUE 'SCREENNAME ',
OR_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
10-06-2008 1:49 PM
10-06-2008 1:53 PM
DATA : or_grid TYPE REF TO CL_GUI_ALV_GRID,
or_doc type REF TO CL_GUI_DOCKING_CONTAINER .