- Description: Sub screens normally used to do all the task in a single screen without navigating to other screens. Sub Screen normally used in the main screen. The main screen declares a dedicated sub screen area in its screen where sub screen is called and displayed in the run time. The sub screen area declared in the main screen can not be left blank. There are no user command in the sub screen.User commands can be only declared in the main screen containing the sub screen.
- Step 1. Provide the description and select the normal screen and then click on the Layout Button to design the screen in the screen painter ( SE51 ).
- Step 2. Create two input fields and two Push buttons with fcode ‘SHOW1’ and ‘SHOW2’ as shown below.
- Step 3.Select the sub screen element from the left column as marked. Drag it on the screen as per required width and height. Double click on the SUB SCREEN AREA element and provide the name as ‘SSA’.
- Step 4. Now the first screen is ready with input fields and different buttons with sub screen area. Let’s create three sub screens : first one is just a sub screen which is called only once when the program is called as the main screen contains a sub screen area which can not be left blank. Second sub screen is called when clicked on the ‘SHOW1’ button and third sub screen is called when clicked on the ‘SHOW2’ button.
- Step 5. Provide short text, select the sub screen radio button and at last click on the Layout button.
- Step 6. Just create a text field in the sub screen ‘9001’.
- Step 8. Select some fields from the VBAK table and select the attribute Output Only fro each field.
- Step 9.Lets create the final sub screen ‘9003’ for the VBRP data display. Provide the short text, select the Sub Screen radio button and then click on the Layout tab.
- Step 10. Click on the Top Red button , Provide the table name as ‘VBRP’ and then click on Get from Dictionary button. Select some fields that you want to display and at last click on the Continue Button. Set the attribute ‘Output only’ of all the fields.
- Step 11. One main Screen and three sub screens are designed .Flow Logic of screen ‘9001’.
PROCESS BEFORE OUTPUT.
MODULE STATUS_9000.
CALL SUBSCREEN SSA INCLUDING SY-CPROG SSN.
"SSA - SUBSCREEN AREA DEFINED IN THE SCREEN PAINTER
"SSN - SUBSCREEN NUMBER- DYNAMICALLY CALCULATED IN PROGRAM
"CALL SUBSCREEN -STATEMENT CALLS THE PBO OF THE SUBSCREEN
*
PROCESS AFTER INPUT.
CALL SUBSCREEN SSA.
"CALL SUBSCREEN -CALLS THE PAI OF THE CURRENT SUBSCREEN
MODULE USER_COMMAND_9000.
MODULE STATUS_9000.
CALL SUBSCREEN SSA INCLUDING SY-CPROG SSN.
"SSA - SUBSCREEN AREA DEFINED IN THE SCREEN PAINTER
"SSN - SUBSCREEN NUMBER- DYNAMICALLY CALCULATED IN PROGRAM
"CALL SUBSCREEN -STATEMENT CALLS THE PBO OF THE SUBSCREEN
*
PROCESS AFTER INPUT.
CALL SUBSCREEN SSA.
"CALL SUBSCREEN -CALLS THE PAI OF THE CURRENT SUBSCREEN
MODULE USER_COMMAND_9000.
- Step 12. .Flow Logic of screen ‘9001’.
- Step 13 .Flow Logic of screen ‘9002’.
PROGRAM SAPMZSUBCREEN.
TABLES : VBRP , VBAK.
DATA : P_VBELN TYPE VBRP-VBELN,
P_POSNR TYPE VBRP-POSNR.
DATA : SSN TYPE SY-DYNNR.
DATA : FLAG TYPE C.
TABLES : VBRP , VBAK.
DATA : P_VBELN TYPE VBRP-VBELN,
P_POSNR TYPE VBRP-POSNR.
DATA : SSN TYPE SY-DYNNR.
DATA : FLAG TYPE C.
- 9000 Output Modules
module STATUS_9000 output.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
IF FLAG IS INITIAL.
SSN = '9001'. " ASSIGN DEFAULT SUBSCREEN FOR THE FIRST TIME
FLAG = 'X'.
ENDIF.
endmodule. " STATUS_9000 OUTPUT
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
IF FLAG IS INITIAL.
SSN = '9001'. " ASSIGN DEFAULT SUBSCREEN FOR THE FIRST TIME
FLAG = 'X'.
ENDIF.
endmodule. " STATUS_9000 OUTPUT
- 9000 Input Modules.
module USER_COMMAND_9000 input.
CASE SY-UCOMM.
WHEN 'SHW1'.
SELECT SINGLE * FROM VBAK WHERE VBELN = P_VBELN.
SSN = 9002.
WHEN 'SHW2'.
SELECT SINGLE * FROM VBRP WHERE VBELN = P_VBELN AND POSNR = P_POSNR.
SSN = 9003.
ENDCASE.
endmodule. " USER_COMMAND_9000 INPUT
CASE SY-UCOMM.
WHEN 'SHW1'.
SELECT SINGLE * FROM VBAK WHERE VBELN = P_VBELN.
SSN = 9002.
WHEN 'SHW2'.
SELECT SINGLE * FROM VBRP WHERE VBELN = P_VBELN AND POSNR = P_POSNR.
SSN = 9003.
ENDCASE.
endmodule. " USER_COMMAND_9000 INPUT
Output
- Step 16. Create T-Code for the program and run it. The sub screen area ‘SSA’ defined in the main screen is filled with the default sub screen ‘9001’.
No comments:
Post a Comment