Usually in Input screen, whenever the user gives an input and their is no record present in the DB, users’ input is restricted by an error message. This error message disables the input screen & now the user cannot provide correct values in the input field as it is disabled by the message. To over rule this issue, Chain And EndChain Statement comes into the Flow Logic of the screen where the input fields are validated.
Step 1. Open SE38 , give Program name and click on Create.
Step 2. Give a valid title description & choose Type M(Module pool) Program and click on Save.
Step 7. Give short description & choose Normal screen and then click on the Layout Button.
Step 8. Enter table name as ‘SPFLI’ & then click on the ‘Get from Dictionary’ button. Select required fields that you want to display in the screen and then click continue.
Step 9. Now create a push button ‘Back’ with the properties as shown below.
Step 13. Now create T-Code.
Step 14. Give name of T-Code, short text & choose the first radio button as it is a Dialog (screen) program and click on continue. Save
Step 15. Open a new session, give the t-code name and execute it. Check the DB table ‘SPFLI’ and provide the carrid and connid & then click on the Show button.
Step 16. Enter carrid and connid input, one record is selected and displayed in the next screen ‘0002’ . At last click on the Back button to go back to the input screen.
Step 17. Give some carrid and connid value for which no database record exists in the DB Table ‘SPFLI’ & click on the show button.
Step 18. Here No record is selected for the given Input still we are navigated to the next screen.
Click on the Back button.
Step 19. Now validate the input fields. If there is no record, the control should not pass to the Next screen. Go to the Flow logic of the screen no 0001. Insert a new module ‘Input_Validation’ in the PAI and define it.
Step 20. GIve the below code.
Step 21. Give 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 22. Insert 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 23. Lets again give input values & then we got a validation error due to the addition of the chain and endchain statement.