Skip to Content

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

STEP 1

Create a program in SE80 with type Module Pool

 

STEP2

Create a screen with type normal

STEP3

Go to screen layout and design the output according to the requirement

The above design has the following components

1.Box

2.Text field

3.Input/Output field

4.Check box

5.Push button

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

STEP4

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

STEP5

Create GUI Status, Titile, Top include for data declaration and Transaction code

GUI Status

GUI Title

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

TOP INCLUDE

Data Declaration

TRANSACTION

STEP6

Run the transaction

STEP7

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

For example

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

STEP8

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.

 

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Jelena Perfiljeva

    Isn’t this pretty much the same thing as your blog from few days ago? Module pool, basic algorithm implementation with IF… ENDIF and some buttons. Or am I missing something?

    If the goal of this post is to educate the beginners then wouldn’t it make sense to present increasingly complex scenarios? Or even take the same scenario and see how it can be improved or implemented differently.

    Before posting a new blog, please consider checking for existing posts in Google using “abap games site:sap.com”.

    Thank you.

    (2) 

Leave a Reply