Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
horst_keller
Product and Topic Expert
Product and Topic Expert

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

Not too demanding but colorful ...

Mine Sweeper

Time-honored and well known ...

2048 Game

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.wulff!) 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 ...

38 Comments
MichiFr
Participant
0 Kudos

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. :wink:

Michael

horst_keller
Product and Topic Expert
Product and Topic Expert

Once my boss explained to me, that I'm working in the moment I'm doing something that is related to ABAP or SAP ...

MichiFr
Participant
0 Kudos

That's a good reason and explanation :cool:

nikolayevstigneev
Contributor
0 Kudos

Time to brush up JavaScript? :smile:

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Copy&Paste ... :wink:

nikolayevstigneev
Contributor
0 Kudos

Woo-hoo, next time I need to do a copy-paste I'll explain that Horst advised me to do that :lol:

horst_keller
Product and Topic Expert
Product and Topic Expert

Only for HTML/JS of course, in ABAP we're good enough :twisted:

ennowulff
Active Contributor
0 Kudos

Hello Horst,

"Click" is not working... :sad:


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) :wink:

Greetings Enno 

ennowulff
Active Contributor
0 Kudos

Waiting for the day the canteen will offer ABAP noodles with SELECTed dressing... :wink:

roberto_vacca2
Active Contributor
0 Kudos

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 :smile:

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos
"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

ennowulff
Active Contributor
0 Kudos

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.


...

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

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 ...

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

ennowulff
Active Contributor
0 Kudos

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. :smile:

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

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?

Former Member
0 Kudos

Thanks for the correction. Got the same Problem with jawbreaker and minesweeper, too.

With the correction it works fine 😉

ennowulff
Active Contributor
0 Kudos

740 Final Release

Dateiversion 7400.1.4.1106

Build 1598106

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Same as I :neutral:

ennowulff
Active Contributor
0 Kudos

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...

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

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 ...)

former_member185171
Participant
0 Kudos

Nice,

I copied the code but get an error during activation:

I didn't change anything in the declarations ...

Regards.

Kris

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hey, some 7.50 features crept in ...

Object Component Selector After Table Expressions


In the 7.40 documentation, there's a 740 runnable code.


:razz:


former_member185171
Participant
0 Kudos

OK.

Problem solved!

Kris

matt
Active Contributor
0 Kudos

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!

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Missing (and not in action): Classical Dynpro as APC-client.

Former Member
0 Kudos

"Missing (and not in action)"?

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

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.

Former Member
0 Kudos

Oh, that minor issue.

Who uses classic SAP GUI anyway? :wink:

0 Kudos

Once a User requested a report ALV, the result should be updated without user action.

Immediately I used the functionality of my ZTETRIS.

Former Member
0 Kudos

did you thought about putting it on GitHub?

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

SCN should be sufficient ...

Former Member
0 Kudos

Nice stuff :smile:

Thanks for sharing it.

Peter_Inotai
Active Contributor
0 Kudos

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 :smile:

Best regards,

Peter

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Yes, its all about demos and games, delivered, but not under the constraints for productive coding ...

former_member625950
Discoverer
0 Kudos
I cannot access the code for systems below 7.4. Would you be so kind and update the link, or upload the code somewhere else?
0 Kudos
Among Us is a game that is being played by a lot of people today. The game is easy to play with beautiful and funny graphics that attract a lot of users. I think you will like it.
horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

REDUCE was introduced with 7.40, SP08

Peter_Inotai
Active Contributor
0 Kudos

Thanks for the info.

Sorry, meanwhile I deleted my comment regarding REDUCE, because I realized that I have to implement the *_700 versions, not the *_740 in our system. I was blind :sad:

Peter

Labels in this area