Simple Number Game
During our childhood days we used to play the number game on paper. The same thing when I played with my kids, they were happy and excited. They used to ask me, dad, how you are telling the correct answers.
The same thing I developed in SAP using Dialog program. Kids can play this on SAP. Just for fun….
Steps to be followed
- Create a program in SE80 with type Module Pool
- Create a screen with type Normal
- Go to screen layout and design the output according to the requirement
- Go to flow logic and build the query
- Create GUI Status, Title, Top include for data declaration and Transaction code
- Run the transaction
- How to Play
- How it works
Create a program in SE80 with type Module Pool
Create a screen with type normal
Go to screen layout and design the output according to the requirement
The above design has the following components
Create function codes for check boxes and push buttons
In Element list you have to define the attribute ok_code to validate the user commands
Go to flow logic and build the query
MODULE USER_COMMAND_0100 CASE OK_CODE. WHEN 'GET'. IF TICK4 = 'X' AND TICK3 = 'X' AND TICK2 = 'X' AND TICK1 = 'X'. ANSWER = 'Ten'. ELSEIF TICK4 = 'X' AND TICK3 = 'X' AND TICK2 = 'X'. ANSWER = 'Nine' . ELSEIF TICK4 = 'X' AND TICK3 = 'X' AND TICK1 = 'X'. ANSWER = 'Eight'. ELSEIF TICK4 = 'X' AND TICK3 = 'X'. ANSWER = 'Seven'. ELSEIF TICK4 = 'X' AND TICK2 = 'X'. ANSWER = 'Six'. ELSEIF TICK4 = 'X' AND TICK1 = 'X'. ANSWER = 'Five'. ELSEIF TICK3 = 'X' AND TICK1 = 'X'. ANSWER = 'Four'. ELSEIF TICK2 = 'X' AND TICK1 = 'X'. ANSWER = 'Three'. ELSEIF TICK2 = 'X'. ANSWER = 'Two'. ELSEIF TICK1 = 'X'. ANSWER = 'One'. ENDIF. WHEN 'CLEAR'. CLEAR ANSWER. CLEAR: TICK4,TICK3,TICK2,TICK1. WHEN 'BACK'. SET SCREEN 0. LEAVE TO SCREEN 0. ENDCASE. ENDMODULE. " USER_COMMAND_0100 INPUT
Create GUI Status, Titile, Top include for data declaration and Transaction code
In order to bring the GUI Status and Title in the output you have to set the PF status and Title bar in MODULE STATUS_0100
Run the transaction
How to Play
Ask your kid to remember one number from the top of the BOX.
From the four boxes below, ask them to search the number on their mind and select the corresponding check boxes
Click the GET button to know the answer
Remember the number four in your mind and it will be there in 2nd and 4th box.
Now click the button GET and you are getting answer as Four
How it works
The boxes with checkboxes are arranged in descending order.
I.e. The first box will be counted as 4 and the okcode will be TICK4 and the second will be counted as 3 and the okcode will be 3 and it will go like that. => 4 + 3 + 2 + 1
As for as the example is concerned you have chosen the 2nd and 4th box, which means actually it is 3rd and 1st . So the count will be 3 + 1 = 4.
Simple logical expression
The clear button will clear the input/output and all the check boxes. Similarly when you click the back button it will come out of the transaction.