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

Nested screen calls issue

Former Member
0 Likes
1,886

Hi,

I am having a module pool program where in I am using call screen or leave to screen where ever I want to navigate. After 50 consecutive screen calls its giving a dump. How can I supress the screen calls.

Thanks

Venkat.

1 ACCEPTED SOLUTION
Read only

MarcinPciak
Active Contributor
1,336

Simple LEAVE TO SCREEN instead of CALL SCREEN should work. Example working code for me:


DATA: f1, f2.  "two checkboxes on screen 100 and 200 respectively with FC1 and FC2 assigned to them

CALL SCREEN 100.

MODULE pai_100 INPUT.
  IF sy-ucomm = 'FC1'.
    LEAVE TO SCREEN 200.
  ENDIF.
ENDMODULE.                    "pai_100 INPUT

MODULE pai_200 INPUT.
  IF sy-ucomm = 'FC2'.
    LEAVE TO SCREEN 100.
  ENDIF.
ENDMODULE.         

This way you avoid nestting calls. Iy first leaves current screen, than it calls new one (starts new call sequence).

Regards

Marcin

7 REPLIES 7
Read only

Former Member
0 Likes
1,336

Hi,

It means your code is running into an infinite loop. SAP handles it by throwing a run time error after 50 screen calls. Please check for infinite loop with respect to your screen calls.

Read only

0 Likes
1,336

Hi Nitwick ,

There are no such infinite loops...i got to know that its SAP standard functionality that it throws a short dump after consecutive screen calls.

Venkat

Read only

Former Member
1,336

Hi

The statament CALL SCREEN opens an internal mode, there's a limit on how many mode can be opened, if the limit is exceeded a dump occurs.

So u should replace the CALL SCREEN statament with LEAVE SCREEN.

Max

Read only

0 Likes
1,336

Hi max bianchi ,

So can use the same screen number with leave to screen xxxx. or how.

Venkat

Read only

1,336

Yes, It's right.

LEAVE TO SCREEN <screen number>.

or

SET SCREEN <screen number>.
LEAVE SCREEN.

The problema it can't use the statament LEAVE TO SCREEN 0 in order to back calling screen: the advantage of CALL SCREEN command is it concatenates the calling and called screen, so it always know which the calling screen is and called screen is, and it can back to calling screen automatically.

If it uses the command LEAVE TO SCREEN, it needs to indicate which is the calling screen, so I usually uses a variable where store the number of calling screen:

DYNPRO 100

V_CALLING_SCREEN = SY-DYNNR.

LEAVE TO SCREEN 200.

So in screen 200 the code in user_command to back to calling screen will be

LEAVE TO SCREEN V_CALLING_SCREEN.

This little trick is usefull if the module is very complex, and a certain screen can be reached from different screens.

Max

Read only

MarcinPciak
Active Contributor
1,337

Simple LEAVE TO SCREEN instead of CALL SCREEN should work. Example working code for me:


DATA: f1, f2.  "two checkboxes on screen 100 and 200 respectively with FC1 and FC2 assigned to them

CALL SCREEN 100.

MODULE pai_100 INPUT.
  IF sy-ucomm = 'FC1'.
    LEAVE TO SCREEN 200.
  ENDIF.
ENDMODULE.                    "pai_100 INPUT

MODULE pai_200 INPUT.
  IF sy-ucomm = 'FC2'.
    LEAVE TO SCREEN 100.
  ENDIF.
ENDMODULE.         

This way you avoid nestting calls. Iy first leaves current screen, than it calls new one (starts new call sequence).

Regards

Marcin

Read only

0 Likes
1,336

There is an internal stack which will overflow after 50 counts. so as a good programmer we should always keep an eye on that stack.

Use a Leave to Screen over a Call Screen.

CALL SCREEN when it is used, it inserts a set of screen sequences dynamically. The processing will return to the current screen after the task completes.

LEAVE SCREEN will leave the current processing immediately and it will leave to the processing of the next screen which is defined either statically or dynamically. In this, the processing will not return to the current screen.

LEAVE TO SCREEN will behave like a SET SCREEN + LEAVE SCREEN together.

So better go for a Leave To Screen.

Regards,

S.Dakshna Nagaratnam.