Saturday, 10 August 2013

Sub Screen Use in Module Pool Program

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. Lets create a module pool program (Type - M). Right click on the Program name and select Create and then click on the screen .














Step 2.Provide the screen number '0001' and then click on the Tick button to Continue.














Step 3. 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 4. Create two input fields and two Push buttons with fcode 'SHOW1' and 'SHOW2' as shown below.


















Step 5.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 6. 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 'SPFLI' button and third sub screen is called when clicked on the 'SFLIGHT' button.














Step 7. Provide the screen number and click on the continue button.

















Step 8.  Provide short text, select the sub screen radio button and at last click on the Layout button.

















Step 9. Just create a text field  in the sub screen '0002'.

















Step 10. Create another sub screen '0003'. Provide short text and click on the  Layout tab.















Step 11. Select some fields from the SPFLI table and select the attribute Output Only fro each field.
Add caption






























Step 12.Lets create the final sub screen '0004' for the SFLIGHT data display. Provide the short text, select the Sub Screen radio button and then click on the  Layout tab.






















Step 13. Click on the Top Red button , Provide the table name as 'SFLIGHT' and then click on Get from Dictionary button. Select some fields that you want to display and at last click on the Continue Button.























Step 14. Set the attribute 'Output only' of all the fields.





























Step 15. One main Screen and three sub screens are designed .Flow Logic of screen '0001'.





















Step 16. .Flow Logic of screen '0002'.
















Step 17. .Flow Logic of screen '0003'.
















Step 18. .Flow Logic of screen '0004'.















Step 19. Define all the modules  in the flow logic of screens.




















Step 20. 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 '0002'.






















Step 21. Provide some input and click on 'Spfli' button.





















Step 22. Based on the input, a record is selected from the SPFLI table and it is displayed in the sub screen '0003' which is placed in the sub screen area 'SSA' of the main screen '0001'.


































Step 23. Change the input and click on the Sfflight Button.















Step 24. Now sflight data is displayed in the subscreen '0004' which is placed in the sub screen area 'SSA' of the main screen '0001'.

























_________________________________________________________________________________

Chain - EndChain In Module Pool Program

-----------------------------------------------------------------------------------------------------------------------------------
Description - Generally in  input screen, when the user gives the input and their is no record present in the database, the user input is restricted by a error message. This error message disables the input screen and now the user can not provide correct values in the input field as it is disabled by the error message. To overcome this problem Chain And EndChain Statement is used in the Flow Logic of the screen where Input fields are validated.

Step 1. Go to SE38 , Provide Program name and click on Create Button.






















 

Step 2. Provide the title description and choose Type M Program and click on Save Button.


























Step 3.  Declare some variables and tables statement in the program . Activate the program and then Right Click on the Program name, Go to Create and then click on Screen.


















Step 4. Provide the Screen Number '0001' and then click on the Tick button.
























Step 5. Provide The Description, choose Normal Screen and then click on Layout button.


















 

Step 6. Create two input fields with one push button as per shown below.
















 


Step 7. Let's create another screen for displaying the result.


















Step 8. Provide the screen number '0002' and then click on the Tick button to continue.



















 


Step 9. Provide short description and select Normal screen and then click on the Layout Button to design the screen.
















 


Step 10. Click on the Top Red button and provide the table name as 'SPFLI' and then click on the 'Get from Dictionary' button. Select the fields that you want to display in the screen and then click on the Tick button to continue.






















 


Step 11. The selected fields are shown in the screen and now create a push  button 'Back' with the properties as shown.



















 


Step 12. Go to the flow logic of the screen '0001' and define the modules under PBO & PAI.














 


Step 13. Go to the flow logic of the screen '0002' and define the modules under PBO & PAI.
















 


Step 14. Provide the below code in the PAI modules  of the both screens as per shown below.






















 


Step 15. Lets Create A T-Code for the Module pool Program.
















 


Step 16. Now provide the T-Code, short text and choose the first radio button as it is a Dialog (screen) program and then click on the Tick button to continue.






















 


Step 17. Provide the Program name, the screen to be called first and then click on the Save button  provide the Package and save it.


























 


Step 18. Lets open a new session, provide the program t-code and run it. Please check the data base table 'SPFLI' and provide the carrid and connid and then click on the Show button.




















 

Step 19. Based on the carrid and connid input one record is selected and displayed in the next screen '0002' . At last click on the Back button to go the input screen.


















 


Step 20. Provide some carrid and connid value for which no database record is exist in the data base table 'SPFLI' and click on the show button.




















Step 21. Though No record is selected for the given Input still we are navigated to the next screen.

Click on the Back button.























 


Step 22. Lets validate the input fields. If for the user input no record is selected, the control should not pass to the Next screen. Go to the Flow logic of the screen '0001'. Add a new module 'Input_Validation' in the PAI and define it.
















 

Step 23. Provide the below code as shown below.
















 


Step 24. Provide input field values and if based on the input fields no record is selected then as per the program validation an error message is displayed which restricts the navigation to the next screen but also at the same time all input fields are disabled. To avoid this problem we use chain and endchain statement in the flow logic of the screen.





















 


Step 25. In the flow logic of the first screen, add chain and endchain statement and inside it put all the fields that you want to enable again if they are disabled with validation error within the module.
















 


Step 26. Lets again provide some input values and we got a validation error and due to the addition of the chain and endchain statement in the flow logic of the screen the input fields are again in the input mode to accept the user input again.














_______________________________________________________________________________

Comments system

Disqus Shortname