Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Control Framework: Fatal error - GUI cannot be reached

Former Member
0 Likes
5,104

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,504

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.

4 REPLIES 4
Read only

Former Member
0 Likes
1,504

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

Read only

Former Member
0 Likes
1,505

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.

Read only

0 Likes
1,504

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

Read only

0 Likes
1,504

Thanks everyone for your really fast responses! It seems to be working so points duly awarded.

Kind regards

Andrew