Application Development 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: 

How to call the screen

Former Member
0 Kudos

Hello Friends,

Please give me some of the example, how to call another screen in module base programming.

Regards,

Amol

5 REPLIES 5

Former Member
0 Kudos

HI,

u can use call screen/set screen or leave to screen

see these links for more info.

http://help.sap.com/saphelp_nw70/helpdata/en/9f/dbab1c35c111d1829f0000e829fbfe/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/10/e7dbde82ba11d295a40000e8353423/content.htm

see this example.

REPORT ZBHMOD1 .

DATA:OKCODE1 LIKE SY-UCOMM,

OKCODE2 LIKE SY-UCOMM.

DATA:N1(10) TYPE N,N2(10) TYPE N,RES(12) TYPE N.

MODULE USER_COMMAND_1000 INPUT.

CASE OKCODE1.

WHEN 'NEXT'.

RES = N1 + N2.

<b> SET SCREEN 1001.</b>

WHEN 'CLEA'.

CLEAR:N1,N2.

WHEN 'BACK'.

<b> SET SCREEN '0'.</b>

ENDCASE.

ENDMODULE. " USER_COMMAND_1000 INPUT

MODULE STATUS_1000 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

SET TITLEBAR 'TIT1'.

ENDMODULE. " STATUS_1000 OUTPUT

MODULE USER_COMMAND_1001 INPUT.

CASE OKCODE2.

WHEN 'BACK'.

<b> SET SCREEN 1000.</b>

ENDCASE.

ENDMODULE. " USER_COMMAND_1001 INPUT

MODULE STATUS_1001 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

SET TITLEBAR 'TIT2'.

ENDMODULE. " STATUS_1001 OUTPUT

<b>

FLOW LOGIC:</b>

PROCESS BEFORE OUTPUT.

MODULE STATUS_1000.

*

PROCESS AFTER INPUT.

MODULE USER_COMMAND_1000.

PROCESS BEFORE OUTPUT.

MODULE STATUS_1001.

*

PROCESS AFTER INPUT.

MODULE USER_COMMAND_1001.

rgds,

bharat.

Former Member
0 Kudos

Hello Amol,

U can call other screen using

For example.

call screen 200

set screen 200

leave to screen 200.

Regards

Srimanta

mahaboob_pathan
Contributor
0 Kudos

Hi,

check this code.

MULTIPLE SCREENS

IN SE 51 FOR SCREEN 100

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

PROCESS AFTER INPUT.

MODULE USER_COMMAND_0100.

IN SE 51 FOR SCREEN 200

PROCESS BEFORE OUTPUT.

LOOP AT IT_VBAK WITH CONTROL TABCTRL.

MODULE STATUS_0200.

ENDLOOP.

PROCESS AFTER INPUT.

MODULE USER_COMMAND_0200.

LOOP AT IT_VBAK.

ENDLOOP.

IN FLOW LOGIC ( FLOW LOGIC IS COMMON FOR BOTH THE SCREENS

i.e , CLICKING ON PAI ON ANY SCREEN GOES TO

COMMON PROGRAM )

PROGRAM YMODULE_PR6 .

TABLES : KNA1, VBAK.

DATA : BEGIN OF FS_KNA1,

KUNNR LIKE KNA1-KUNNR,

LAND1 LIKE KNA1-LAND1,

NAME1 LIKE KNA1-NAME1,

ORT01 LIKE KNA1-ORT01,

END OF FS_KNA1,

BEGIN OF IT_VBAK OCCURS 0,

VBELN LIKE VBAK-VBELN,

ERDAT LIKE VBAK-ERDAT,

ERNAM LIKE VBAK-ERNAM,

NETWR LIKE VBAK-NETWR,

END OF IT_VBAK,

BEGIN OF ITVBAP OCCURS 0,

POSNR LIKE VBAP-POSNR,

MATNR LIKE VBAP-MATNR,

NETPR LIKE VBAP-NETPR,

END OF ITVBAP.

CONTROLS: TABCTRL TYPE TABLEVIEW USING SCREEN 200.

&----


*& Module USER_COMMAND_0100 INPUT

&----


MODULE USER_COMMAND_0100 INPUT.

CASE SY-UCOMM.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN 'DISPLAY'.

SELECT KUNNR LAND1 NAME1 ORT01

FROM KNA1

INTO FS_KNA1

WHERE KUNNR = KNA1-KUNNR.

ENDSELECT.

WHEN 'SALES'.

SET SCREEN 200.

SELECT VBELN ERDAT ERNAM NETWR

FROM VBAK

INTO TABLE IT_VBAK

WHERE KUNNR = KNA1-KUNNR.

  • CALL SCREEN 200.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module STATUS_0100 OUTPUT

&----


MODULE STATUS_0100 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

MOVE-CORRESPONDING FS_KNA1 TO KNA1.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0200 INPUT

&----


MODULE USER_COMMAND_0200 INPUT.

DATA : FNAM(20) TYPE C,

FVAL LIKE VBAK-VBELN.

IF SY-UCOMM = 'BACK'.

LEAVE TO SCREEN 100.

ELSEIF SY-UCOMM = 'ITEMS'.

GET CURSOR FIELD FNAM VALUE FVAL.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = FVAL

IMPORTING

OUTPUT = FVAL .

SELECT POSNR MATNR NETPR FROM VBAP

INTO TABLE ITVBAP

WHERE VBELN = FVAL.

IF SY-SUBRC EQ 0.

LEAVE TO LIST-PROCESSING. ## TAKES THE PROCESS FROM DIALOG TO LIST SCREEN

LOOP AT ITVBAP.

WRITE 😕 ITVBAP-POSNR, ITVBAP-MATNR, ITVBAP-NETPR.

ENDLOOP.

ENDIF.

ENDIF.

ENDMODULE. " USER_COMMAND_0200 INPUT

&----


*& Module STATUS_0200 OUTPUT

&----


MODULE STATUS_0200 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

MOVE-CORRESPONDING IT_VBAK TO VBAK.

ENDMODULE. " STATUS_0200 OUTPUT

Reward if usefull.

Former Member
0 Kudos

Hi,

The screen can branch out to new screen depending upon user selection. Following command in module pool program can do this:

• SET SCREEM

• CALL SCREEN

• LEAVE TO SCREEN <NUMBER>

All these commands override the specifications given in the attributes. This overriding is temporary. The values stored in the attribute are not changed.

<b>Set Screen</b>

Syntax

Set screen <number>.

In module pool program

Case okcode.

When ‘DISP’.

Set screen 200.

When ‘LIST’.

Set screen 300.

Endcase.

In this case, the entire processing of current screen takes place and then the system branches out to next screen. If you want to branch out to the next screen without processing the current screen, LEAVE SCREEN should be used along with the SET SCREEN.

For Example:

Case okcode..

When ‘DISP’.

Set screen 200.

Leave Screen.

When ‘LIST’.

Set screen 300.

Leave Screen.

Endcase.

When SET SCREEN is used, control cannot be transferred to the main screen or previous screen, unless you write code for the same.

<b>Call Screen</b>

Usually used for pop up screens. Many times, there is a need for user to enter additional information or secondary information on another screen or pop up screen. Once the user enters the data, he should be able to go back to main screen or to the screen where he started. This is not possible by using SET SCREEN. CALL SCREEN achieves this functionality.

<b>Syntax</b>

Call Screen 200.

Will simply call a screen number 200 from a main screen. Once the screen is displayed the user can enter all the data and return to the main screen by clicking BACK button.

To call screen as pop up screen the syntax is

Call screen starting at <col.no.> <line no>

Ending at <col no> <line no>.

In this case window will be popped as window and user can close it by using BACK button.

<b>Leave to screen</b>

To SET a new screen without processing current screen, you need to use the following two statements together:

SET SCREEN 200.

LEAVE SCREEN.

Or a Single statement

LEAVE TO SCREEN 200.

Ex.

MODULE USER_COMMAND_100.

SAVE_OK = OK_CODE.

CLEAR OK_CODE.

IF SAVE_OK = 'CARRIER'

AND NOT DEMOF4HELP-CARRIER2 IS INITIAL.

LEAVE TO SCREEN 200.

ELSE.

SET SCREEN 100.

ENDIF.

ENDMODULE.

Regards,

Bhaskar

Former Member
0 Kudos

in your module simply use call screen.

like

when condition.

call screen 'screen number'.

data ok_code type sy-ucomm,

save_ok like ok_code.

module 9000_pbo.

save_ok = ok_code.

clear ok_code.

case save_ok.

when 'fc1'.

call screen '9001'

when 'fc2'.

call screen '9003'.

endcase.

endmodule

please reward points if useful.