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

call subscreen from main screen

Former Member
0 Likes
4,003

Dear all,

I have a subscreen and from that subscreen i am calling another normal screen using 'call screen' statement. After doing some manipulation in the normal screen i want to go back to the subscreen on clicking 'BACK' button. i tried 'leave to screen' and 'call screen' in PAI of normal screen but it is not working. how to come back to the subscreen again?

Thanks in advance,

Aswin.

6 REPLIES 6
Read only

Former Member
0 Likes
1,582

>

> Dear all,

> I have a subscreen and from that subscreen i am calling another normal screen using 'call screen' statement.

First use "Leave to screen" from sub screen than for go back to normal screen use "Set screen" if you not sppose to go back to normal screen screen again.

For more info use F1 help on each statement for knowing the difference all these commands.

Read only

praveen_kumar132
Participant
0 Likes
1,582

hi ,

if you want to go back to the subscreen againg . just call subscreen <number>again or write leave to screen <number>. in PAI .. if your subscreen is initial one. you can write call screen 0. it will also work out

Regards,

Praveen.

Read only

Former Member
0 Likes
1,582

Hi,

for this use you can have Two approaches:

1. set statically in the Attributes of the screen in "Next Screen" the Screen no which you want to call. OR

2. you can enter the subsequent number dyanamically by using "SET SCREEN <screen no>".In this case the statically set screen number will not have any effect then.

Regards,

Neha

Read only

Former Member
0 Likes
1,582

Hi Aswin,

Subscreens can not be called directly by using KEY words CALL SCREEN or SET SCREEN.

When you come back to the normal first screen from normal second screen it will automatically take you to the subscreen provided on the first screen. just say LEAVE TO SCREEN 0

instead of calling the screen from subscreen CALL it from first NORAML SCREEN the effect is same.

unless you use a dummy subscreen on the first normal screen the LEAVE TO SCREEN 0 will take you back to the FIRST noraml screen ( any how you are calling the CALL SUBSCREEN statement in the PBO of first NORMAL SCREE )

hope this is clear to you

Regards

Ramchander Rao.K

Read only

Former Member
0 Likes
1,582

Hi Aswin,

Subscreens can not be called directly by using KEY words CALL SCREEN or SET SCREEN.

When you come back to the normal first screen from normal second screen it will automatically take you to the subscreen provided on the first screen. just say LEAVE TO SCREEN 0

instead of calling the screen from subscreen CALL it from first NORAML SCREEN the effect is same.

unless you use a dummy subscreen on the first normal screen the LEAVE TO SCREEN 0 will take you back to the FIRST noraml screen ( any how you are calling the CALL SUBSCREEN statement in the PBO of first NORMAL SCREE )

hope this is clear to you

Regards

Ramchander Rao.K

Read only

Former Member
0 Likes
1,582

Dear Friend,

You include a subscreen screen using the CALL SUBSCREEN statement in the flow logic of the main screen.

To include a subscreen screen in the subscreen area of the main screen and call its PBO flow logic, use the following statement in the PBO event of the main screen:

This statement assigns the subscreen screen with number <dynp> to the subscreen area called <area>. With <prog> you must specify the ABAP program in which the subscreen screen is defined. If it does not find a corresponding subscreen screen, a runtime error occurs. The PBO flow logic of the subscreen screen is also included at the same point. This can call PBO modules of the ABAP program in which the subscreen screen is defined. At the end of the subscreen PBO, the global fields from the program are passed to any identically-named screen fields in the subscreen screen. The PBO flow logic of the subscreen screen can itself include further subscreens.

The name <area> of the subscreen area must be entered directly without inverted commas. You can specify the names <prog> and <dynp> either as literals or variables. If you use variables, you must declare and fill identically-named variables in the ABAP program. The screen number <dynp> must be 4 characters long. If you do not assign a subscreen screen to an area, it remains empty.

PROCESS BEFORE OUTPUT.

...

CALL SUBSCREEN <area> INCLUDING <prog> <dynp>.

...

find the Below Example Code.

DATA: ok_code TYPE sy-ucomm,

save_ok TYPE sy-ucomm.

DATA: number1(4) TYPE n VALUE '0110',

number2(4) TYPE n VALUE '0130',

field(10) TYPE c, field1(10) TYPE c, field2(10) TYPE c.

CALL SCREEN 100.

MODULE status_100 OUTPUT.

SET PF-STATUS 'SCREEN_100'.

ENDMODULE.

MODULE fill_0110 OUTPUT.

field = 'Eingabe 1'(001).

ENDMODULE.

MODULE fill_0120 OUTPUT.

field = field1.

ENDMODULE.

MODULE fill_0130 OUTPUT.

field = 'Eingabe 2'(002).

ENDMODULE.

MODULE fill_0140 OUTPUT.

field = field2.

ENDMODULE.

MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE save_ok INPUT.

save_ok = ok_code.

CLEAR ok_code.

ENDMODULE.

MODULE user_command_0110 INPUT.

IF save_ok = 'OK1'.

number1 = '0120'.

field1 = field.

CLEAR field.

ENDIF.

ENDMODULE.

MODULE user_command_0130 INPUT.

IF save_ok = 'OK2'.

number2 = '0140'.

field2 = field.

CLEAR field.

ENDIF.

ENDMODULE.

MODULE user_command_100 INPUT.

CASE save_ok.

WHEN 'SUB1'.

number1 = '0110'.

WHEN 'SUB2'.

number1 = '0120'.

CLEAR field1.

WHEN 'SUB3'.

number2 = '0130'.

WHEN 'SUB4'.

number2 = '0140'.

CLEAR field2.

ENDCASE.

ENDMODULE.

The screen flow logic for screen 100 is as follows:

PROCESS BEFORE OUTPUT.

MODULE status_100.

CALL SUBSCREEN: area1 INCLUDING sy-repid number1,

area2 INCLUDING sy-repid number2.

PROCESS AFTER INPUT.

MODULE cancel AT EXIT-COMMAND.

MODULE save_ok.

CALL SUBSCREEN: area1,

area2.

MODULE user_command_100.

The screen flow logic of subscreen screens 110 and 130 is:

PROCESS BEFORE OUTPUT.

MODULE fill_0110|0130.

PROCESS AFTER INPUT.

MODULE user_command_0110|0130.

The screen flow logic of subscreen screens 120 and 140 is:

PROCESS BEFORE OUTPUT.

MODULE fill_0120|0150.

PROCESS AFTER INPUT.

When you run the program, a screen appears on which subscreens 110 and 130 are displayed. The pushbuttons on the main screen allow you to choose between two subscreen screens for each screen area. The pushbuttons on the subscreens allow you to transfer the data from subscreens 110 and 130 to subscreens 120 and 140.

Since the same field name FIELD is used on all subscreens, the identically-named ABAP field is transferred more than once in each PBO and PAI event of the main screen. For this reason, the values have to be stored in the auxiliary fields FIELD1 and FIELD2 in the ABAP program.

The pushbuttons on the subscreen screens have different function codes, and they are handled normally in an ABAP field. If the function codes had had the same names, it would again have been necessary to use auxiliary fields.