Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Error while running a job in background

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?

Tags:
Former Member
Former Member replied

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.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question