Saturday 10 August 2013

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.














_______________________________________________________________________________

9 comments:

Unknown said...

Hi Sir
Your Blog is very helpful .
Thank you .

Neha Ankush said...

Hi,

Your Blog is really awesome & helpful.

Unknown said...

Thank you. Contents are very clear and easy to understand.

Meer Hilal said...

You defined very nicely.. thanks a lot

neeraj said...

Awesome !

Unknown said...

thanks for the coding ,it make us to understand easy

Anonymous said...

Good news
This is to inform the general public that The Bill and Melinda Gates Foundation's "COVID-19 Relief Fund", in collaboration with The Asia Foundation; which was setup to help business owners and individuals during and after the corona virus pandemic.
If you want to be a part to receive this donation from Bill and Melinda Gates Foundation's "COVID-19 Relief Fund"You are to receive the sum of $1,000,000 USD,If you are interested to receive this donation,Email: (afgcare99@gmail.com) or (asiafoundationgroup@inbox.lv)
!! believe it's 100% real. and it starts now !!
Please Share !!

Sushil V. Nikam said...

Nice...!!! Very useful blog
Thanks for code to understand easily.

Maariah said...

From the botttom of my drift. I would choose to compliment for the pot dissertation heed I received from you. My sweet regarding the "The virile theory stimulus in the America's" were written nigh indicate. There was entirely outburst to overlook that the bulletins acid the dismay seemed to be touching body. Queue System

Comments system

Disqus Shortname