Sunteți pe pagina 1din 32

SUBSCREEN

It is the screen which will be called into another screen area of the Normal screen
Each screen area can hold only one sub screen.
Syntax to call the sub screen:
CALL SUBSCREEN
number>.

<Name of the sunscreen>

INCLUDING

<prog name>

Note: Above syntax will not be written inside the module------endmodule,


And need to be written below the PBO.

Steps work with subscreen


1)
2)
3)
4)

Create the program of type Module pool(not mandatory)


Create the required number of Normal screens
Create the required the number of Subscreens
Create the T.code to attach to the program
Step1 Create the program
Goto SE38

<Screen

Click on Create and provide the description

Click on SAVE(Local object)

Step2 Create the screens(Normal&subscreen)


Goto SE51
Provide the program name, screen number and click on CREATE

Click on LAYOUT tab

Goto----Secondary window------Dictionary

Provide the Table name(kna1)-----click on Enter------select the required fields

Click on enter to reflect in layout


Now align the field

Click on pushbutton and drag into the lay out to provide the Display push button

Click on box button to provide the box around the screen

SAVE---back(to create the another normal screen)


Now create screen 200

Click on Create
Provide the description and click on Layout tab and provide the customer field like above
Now click on subscreen area button and drag into the screen(For customer address)

Double click on screen area(highlighted) and provide the required information

Now create one more screen area to call the second subscree(for customer company details

Save-----Back
Now create the subscreens

Now click on layout tab and create the screen with required fields like above

Now change the field name to WA_KNA1-KUNNR(for easy mapping in program ) and also for all the
fields

Provide the box-----save----back


Now create second subscreen to display the customer company details

Click on Create

Click on Enter

Change the field name to WA_T001-BUKRS and for all other fields also

Now provide the box


Double click on box and provide the information as below

Click on Save------Back

Now provide the logic for above screens


Now goto first screen 100

Click on change

Uncomment MODULE STATUS_0100 below PBO and save and double click on it

Click on ENTER-----Now control will go to se38


Uncomment set pf status

Provide the pf-status name(Ex:ZBACK )

Double click on ZBACK

Click on YES

Provide the description and click on Enter


:

Now the control will go to MENU PAINTER(SE41)

MENU PAINTER : it is used to create the required menu items,toolbar item and function keys.
SE41 is the t.code to create the above.
Expand function keys

Provide the function code above Back symbol

SAVE-----Check----Activate
Click on BACK---------se38--click on BACK(se51)
Some of the function codes
Fucnction

functioncode

BACK

BACK

SAVE

SAVE (or) =UPDA

ENTER

/00

CANCEL

CANCEL

PRINT

PRINT

Now uncomment MODULE USER_COMMNAD_0100 -----save------Double click on it

Provide the below logic for first screen in PAI

Save ----Click on BACK


Now provide the logic for second screen

Double click and follow the steps like above

SAVE-----F3
Now provide the logic to call the subscreens into screen 200 under PBO

Save-----F3
Now provide the logic for screen 30 to display the customer address

Save---f3

Now provide the logic for subscreen 40

Double click

Save-----Check------Activate the program


Click on f3
Now activate all the screens in SE51

Activate all the remaining screens 200,30,40

All the code for the program


PROGRAM ZMODULEPOOL_SUBSCREEN.
Tables kna1.
*wa for customer address
DATA:BEGIN OF wa_kna1,
kunnr type kunnr,
name1 type name1_gp,
ort01 type ort01_gp,
pstlz type pstlz,
END OF wa_kna1.
*WA for customer company address
DATA:BEGIN OF WA_T001,
bukrs like t001-bukrs,
butxt like t001-butxt,
ort01 like t001-ort01,
END OF WA_T001.
DATA: V_bukrs type bukrs.
*&---------------------------------------------------------------------*
*&
Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
module STATUS_0100 output.
SET PF-STATUS 'ZBACK'.
* SET TITLEBAR 'xxx'.
endmodule.
" STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*&
Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
module USER_COMMAND_0100 input.
IF SY-UCOMM = 'DIS'.

if kna1-kunnr is NOT INITIAL.


CALL SCREEN 200.
else.
Message 'Please enter the customer' type 'S'.
endif.
ELSEIF SY-UCOMM = 'BACK'.
LEAVE TO SCREEN 0.
ENDIF.
endmodule.
" USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*&
Module STATUS_0200 OUTPUT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
module STATUS_0200 output.
SET PF-STATUS 'ZBACK'.
* SET TITLEBAR 'xxx'.
endmodule.
" STATUS_0200 OUTPUT
*&---------------------------------------------------------------------*
*&
Module STATUS_0030 OUTPUT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
module STATUS_0030 output.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
if kna1-kunnr is NOT INITIAL.
SELECT single kunnr name1 ort01 pstlz from kna1 into wa_kna1
where kunnr = kna1-kunnr.
if sy-subrc <> 0.
MESSAGE 'Cusomers address was not found' type 'S'.
endif.
ENDIF.
endmodule.
" STATUS_0030 OUTPUT
*&---------------------------------------------------------------------*
*&
Module STATUS_0040 OUTPUT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
module STATUS_0040 output.
* SET PF-STATUS 'xxxxxxxx'.

SET TITLEBAR 'xxx'.


if kna1-kunnr is NOT INITIAL.
select single bukrs from knb1 INTO v_bukrs where kunnr = kna1-kunnr.
if sy-subrc = 0.
select SINGLE bukrs butxt ort01 from T001 INTO WA_T001 WHERE BUKRS = V_B
UKRS.
IF SY-SUBRC <> 0.
MESSAGE 'Company address was not found' type 'S'.
ENDIF.
endif.
ENDIF.
endmodule.
" STATUS_0040 OUTPUT
*&---------------------------------------------------------------------*
*&
Module USER_COMMAND_0200 INPUT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
module USER_COMMAND_0200 input.
if sy-ucomm = 'BACK'.
LEAVE TO SCREEN 100.
ENDIF.
endmodule.

" USER_COMMAND_0200

Step4 Now create the T.code for the above program


Goto SE93

Click on CREATE

INPUT

Click on ENTER

Click on SAVE.

Testing
Execute the t.code ZTC_SUB

Enter the Customer or Browse the customer from F4 help

Creating the SELECTION-SCREEN with SELECT OPTIONS & PARAMENTER using Modulepool
Step 1: Go to SE38------provide the program name-------Click on Create
----- provide the required details

Step2: Go to SE51-----Provide the above program name and Screen number(Ex:100)

Click on Create

Click on Create-----Provide the Sub screen Area

Provide the subscreen area name SEL-SCN

Click on SAVE---------Click on Flow logic tab


Uncomment PBO ------Double click on it to provide the Tool bar item(Back)
Uncomment Set-pf status -----Provide status name(ZBACK) and double click on it

NOTE: Now the control goes to SE41

Provide the function code for BACK

Save----check-----activate

Click on Back-----F3
Now uncomment PAI-----Double click on it to provide the logic for back

Now control goes to SE38

Also provide the deceleration and sub screen design for selection screen

Provide the text element for getting the field descriptions

Click on Save-check----activate
Now click on Back to call the sub screen 200 into the sub screen area (SEL-SCN) in 100.

Save--check----Activate

Program
REPORT

ZMODULE_DEMO.

data:Begin of wa_kna1,
kunnr like kna1-kunnr,
land1 like kna1-land1,

end of wa_kna1.

SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.


SELECT-OPTIONS S_KUNNR FOR WA_KNA1-Kunnr. TO PROVIDE SELECTION OPTIONS
SELECTION-SCREEN SKIP 2.
PARAMETERS P_LAND1 LIKE WA_KNA1-LAND1.
SELECTION-SCREEN END OF SCREEN 200.

"TO PROVIDE THE PARAMETERS

START-OF-SELECTION.
CALL SCREEN 100.

*&---------------------------------------------------------------------*
*&
Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
module STATUS_0100 output.
SET PF-STATUS 'ZBACK'.
* SET TITLEBAR 'xxx'.
endmodule.
" STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*&
Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
module USER_COMMAND_0100 input.
IF SY-UCOMM = 'BACK'.
leave to SCREEN 0.
endif.
endmodule.

Testing
Execute the program (F8)

" USER_COMMAND_0100

INPUT

S-ar putea să vă placă și