Chain-EndChain In Module Pool


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.


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s