Skip to Content

Look what I’ve found.

Under the cloak of “Examples of Expression-Oriented Programming” recent versions of the Example Library of the ABAP Keyword Documentation contain three ABAP games.

Jaw Breaker

/wp-content/uploads/2016/01/jawbreaker_869549.gif

Not too demanding but colorful …

Mine Sweeper

/wp-content/uploads/2016/01/minesweeper_869551.gif

Time-honored and well known …

2048 Game

/wp-content/uploads/2016/01/2048_869552.gif

A recent smart phone game and a real challenge …

Wanna play?

    

          (The examples from the 7.50 documentation can rely on 7.50 features. For 7.40, there are 7.40 examples).

  • If you have a release older than 7.40, you can copy old fashioned 7.00 source code from the  attached text file . Maybe you also have to replace the usage of CL_DEMO_INPUT with PARAMETERS then.

Only outside working hours, of course.

Wanna Contribute?

Maybe, the pattern used in these games (usage of CL_ABAP_BROWSER etc.) motivate you to create some other games?

Note

Due to the discussion below (thanks Enno!) I adjusted the HTML output of

  • DEMO_JAWBREAKER_HTML_740
  • DEMO_JAWBREAKER_HTML_700
  • DEMO_MINESWEEPER_740
  • DEMO_MINESWEEPER_700

in Release 7.50, SP03. You find the new sources in the attached text file .

Hopefully, those run for all combinations of SAP GUI and IE. If not, next round …

To report this post you need to login first.

36 Comments

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

  1. Michael Fritz

    Horst,

    guess you compiled those games outside your working hours, too, right? Or was it just for demonstration purposes to explain new features of the ABAP language. 😉

    Michael

    (0) 
        1. Roberto Vacca

          A company can save money everytime a program becomes faster or better or deeper  in giving details or functionalities .

          Games are among first sources of alghorytm of efficiency example applications and often they’re the best way to achieve a complex result.

          So we should study Games and alghorytm and save money and time for the company or instead we should change job = GAME OVER 🙂

          (0) 
  2. Enno Wulff

    Hello Horst,

    “Click” is not working… 🙁

    at_click FOR EVENT sapevent OF cl_abap_browser IMPORTING action

    I did test it on two systems now.

    At least a fine, compact and much to small demo (on high resolution displays) 😉

    Greetings Enno 

    (0) 
    1. Horst Keller Post author

      “Click” is not working…


      Makes me wonder. Never had problems with that.


      Can you check SAPEVENT in program DEMO_HTML_BROWSER?


      CL_ABAP_BROWSER should work since 702.


      Horst

      (0) 
      1. Enno Wulff

        The Demo_HTML_Browser works. In Jawbreaker I have no pointing hand on “Mouse Over”. There is no link…

        Unless I adjust the demo and put something in the table cell:

        CONCATENATE line

                      ‘<td class=”c’ cc ‘”>’

                       ‘<a href=”sapevent:x’ xn ‘y’ yn ‘”/>X</td>’ INTO line.

        (0) 
        1. Horst Keller Post author

          Now that’s amazing …

          The Jawbreaker game seemed to work fine in the HTML control of SAP GUI since I implemented it, and now that.

          In order to check, I extracted an HTML file to the disk:

          <html>

          <head>

          <meta http-equiv=”content-type” content=”text/html; charset=utf-8″>

          <style type=”text/css”>

          a{text-decoration:none;width:18px;height:18px}

          .c1{background-color:lightblue}

          .c2{background-color:cornflowerblue}

          .c3{background-color:darkblue}

          .c4{background-color:steelblue}

          </style>

          </head>

          <body leftmargin=”35″ topmargin=”60″ scroll=”no”>

          <table border=”0″>

          <tr>

          <td class=”c1″><a href=”sapevent:x01y01″/></td>

          <td class=”c1″><a href=”sapevent:x02y01″/></td>

          </tr>

          <tr>

          <td class=”c1″><a href=”sapevent:x01y02″/></td>

          <td class=”c2″><a href=”sapevent:x02y02″/></td>

          </tr>

          </table>

          </body>

          </html>         

          And yes, it looks bad in all browsers …

          /wp-content/uploads/2016/01/small_870425.gif

          Oh my!

          Don’t ask me, why it works fine in most (?) SAP GUI controls but not in yours.

          Found a correction that works for me:

          <html>

          <head>

          <meta http-equiv=”content-type” content=”text/html; charset=utf-8″>

          <style type=”text/css”>

          .bx{text-decoration:none;width:18px;height:18px;cursor:hand}

          .c1{background-color:lightblue}

          .c2{background-color:cornflowerblue}

          .c3{background-color:darkblue}

          .c4{background-color:steelblue}

          </style>

          </head>

          <body leftmargin=”35″ topmargin=”60″ scroll=”no”>

          <table border=”0″>

          <tr>

          <td class=”c1″><a href=”sapevent:x01y01″/><div class=”bx”></div></td>

          <td class=”c1″><a href=”sapevent:x02y01″/><div class=”bx”></div></td>

          </tr>

          <tr>

          <td class=”c1″><a href=”sapevent:x01y02″/><div class=”bx”></div></td>

          <td class=”c2″><a href=”sapevent:x02y02″/><div class=”bx”></div></td>

          </tr>

          </table>

          </body>

          </html>

          Does it work for you? If this is the case, I think about adjusting DEMO_JAWBREAKER_HTML_… (and Mine Sweeper) in 751.

          Thanks for notifying!

          Horst

          (0) 
          1. Enno Wulff

            Yes, it does! Thanks. The report needs some more changes than just adding bx and div. LINE (C255) is too small to take the changes…

            I always cause trouble with my computers configuration. 🙂

            (0) 
            1. Horst Keller Post author

              It depends on the GUI version. I had to add a “;cursor:hand”  to the bx class above otherwise it would not work in recent GUIs any more!

              What SAP GUI version are you using?

              (0) 
                  1. Enno Wulff

                    Isn’t it relevant which IE version is taken by the GUI?

                    Maybe these are different?

                    I do not know how to identify the internal version…

                    (0) 
                    1. Horst Keller Post author

                      It’s both, SAP GUI and IE, because SAP GUI influences the browser’s standard CSS.

                      In order to work out right in my SAP GUI as well as other browsers, I finally will combine an a-style and an bx-style.

                      … `.bx{text-decoration:none;cursor:hand;width:18px;height:18px}` &&

                      `a{width:18px;height:18px}` …

                      Oh boy …

                      (In fact I’m fighting with that crap everyday for providing the ADT version of the ABAP Docu …)

                      (0) 
  3. Matthew Billingham

    This reminds me. 17 years ago just before Christmas 1999 things were a little slow at work, so, on a 31H system, I wrote a game in ABAP using this report’s autorefresh technique.

    There was a ship going across the top of the screen from which you could drop depth charges on the submarine moving randomly at the bottom of the screen.

    It was a rehash of a game I first wrote in 1982 for a ZX81. Autorefresh there was bit easier!

    (0) 
        1. Horst Keller Post author

          Not available up to now, APC for refreshing dynpro screens. You need user interaction on a dynpro screen in order to pass contol to ABAP.

          (0) 
  4. Peter Inotai

    Hi,

    It seems program DEMO_GAME_2048_700 has some dependencies on version of  cl_demo_input=>add_field( ). In 7.40 SP7 parameter as_checkbox is missing.

    After commenting it out, it works fine however 🙂

    Best regards,

    Peter

    (0) 

Leave a Reply