Build a Mobile App with PowerBuilder (or at least try it…)
Disclaimer: This blog is just a test. An attempt to build something that doesn’t represent SAP or Sybase in any way.
While I was on SAP TechEd Las Vegas, someone asked me if he could use PowerBuilder to build Mobile Applications…at that time I sincerely replied him that I didn’t had idea, but I was going to work on it as soon as I had some time. This blog is a product of that…
I first start doing some research on the web, and I found that Pocket PowerBuilder was used for this purpose, but now it’s discontinued. So I kept looking…
Then I found Appeon Mobile for PowerBuilder, but it’s a not free product and I didn’t really want to make any marketing pitch, so I choose to do something else…
PowerBuilder now provides .NET Web Forms Applications which basically turns our application on a ASP.NET webpage, that could be rendered on a mobile device, so that’s the approach I chose for this blog.
Before we start, let’s make clear that I’m not a Web Developer nor a PowerBuilder developer so my experience in both is kinda limited.
When I first start doing my testing, I really had a lot of troubles and headaches, so here’s what I did so you don’t need to suffer the same way I did…
If is not already activated, we need to activate some services, so let’s go to Control Panel –> All Control Panel Items –> Programs and Features and then Turn Windows features on or off.
From the Application Development Features choose .NET Extensibility, ASP, ASP.NET, ISAPI Extensions and ISAPI Filters.
Then go to Run –> inetmgr and do the following.
Double click on ISAP and CGI Restrictions and allow everything.
Now, we’re ready to move to PowerBuilder. For this, we will need a connection to an SAP HANA system. If you don’t know how to do this, please refer to my blog PowerBuilder – The new kid on Developer Center’s block.
Create a new application and choose .NET Web Forms Application. The application is going to be called web_pb_hana.
Choose Grid and then SQL Select.
On the screen, simply choose CARRID and then Design –> Disctinct.
Call this one dg_carrid.
Next, create a another one but this time choose External and call the parameter Carrid.
On the screen we need to tell that the DataWindows is going to be dg_carrid (so it knows from where to fetch the data) and also specify carrid as both Display and Data Columns. One important thing is to check the options Always Show Arrow, Vertical Scroll Bar and AutoRetrieve.
Call this one ff_params.
Next, create one last DataWindow, Grid again and SQL Select again.
Select MANDT, CARRID, CONNID, COUNTRYFR and COUNTRYTO.
Choose Design –> Retrieval Arguments (This is very important as it will allows us to pass the values of the Drop Down control to our report). Name it Carrid.
In the Where tab fill in the parameter and the argument. Call this one dg_report.
Now, we can go and create a Window.
On the Layout we might to simply drag and drop the dd_report and the ff_params.
Call this dg_window. The button will be called btnreport.
Now that we’re ready with our Layout, we need to go back to our Database Painter and copy the Preview generated by the SAP HANA connection.
Double click on the application icon and copy the following code (the first part is done by pasting the Preview the copied before).
Now, double click on dg_window and then double click on btnreport.
Go back to the dg_window layout and right click to choose Script.
We now can run it and it will of course open a browser.
Next job, is to open it on an emulator, so let’s grab the Android Emulator and instead of passing the localhost address, use 10.0.2.2/web_bp_hana.
For some reason…it will ask as to open a new window.
Actually…this doesn’t work…when you choose the Carrid and press the Show Report button, you will see some loading, but then nothing…I guess it has to do with the rendering as we’re passing an ASP.NET page.
Anyway…I tried with the BlackBerry emulator and it was even worse…it didn’t even wanted to connect to the main page…so…I think to myself…ASP.NET? Windows Phone should work fine…
For the Windows Phone, you can keep passing localhost, which is a good thing.
As you can see…it really looks small…but at least it works…
As I already said…I’m not a Web Developer…so I don’t know if this can be fixed on the generated ASP.NET page or not…so I simply went back to PowerBuilder and make everything bigger…Font 24 was my key….
So…at least it looks a little bit more descent…
Anyway…here you have an application build on PowerBuilder that run on a Windows Phone and read data from SAP HANA
Great blog Alvaro! I interest in PB but waiting for next version!
Me too man...me too 🙂
Hi Blag. There is nothing more interesting as reading try/fail/success blogs with new things! Kudos!
Would be great to get some more comments from core PB developers as well.
Thanks for the comment 🙂 For sure it would be great...I actually don't see many PB people here, which is sad...we should have more blogs and experiments around PB...some people ask..."Isn't PB dead?" I'm sure it's not...it's just need more people to show what can be achieved and why it's more alive than ever 😉
I'm trying to do very similar things to you using PB and HANA with JDBC. I noticed in your connection string "...amazonaws.com:30015...". Where is the 30015 from? Is that something unique to the AWS connection?
I am so far unable to connect via jdbc to HANA running on AWS.
3XX15 is HANA db's port to for calls. XX is the HANA db instance number, in the Blag's case it was system 00, but you need to use your HANA instance number.
Vitaliy is right. You need to pass the full address to make it work. Have you also assigned the JDBC library in PowerBuilder? http://scn.sap.com/community/developer-center/hana/blog/2012/08/24/powerbuilder--the-next-kid-on-developer-centers-block
The only way I could get past the error was to modify the classpath to include the full folder/filename ie, "C:\Program Files\SAP\hdbclient\ngdbc.jar". Putting "C:\Program Files\SAP\hdbclient" in PB did not work when I attempted a connection.
I'm still getting errors with the connection even with the full path. The message is "No Suitable driver found for jdbc:sap//xxxxxx.compute-1.amazonaws.com:30015" I'm trying to find something else I can test JDBC connections other than PowerBuilder.
That's weird...I have neved specified the full path...anyway...can you validate that you're using the right version of the SAP HANA Client? 32bits vs. 64 bits. In my case I used the 64bits one.
I had similar problems when I was writing my blog on SAP HANA and .NET
I made sure I used the 64 bit driver in my CLASSPATH designation but it still doesn't work. Is there some way to tell if I'm running 64 bit java (if that even matters)?
I'm dead in the water if I can't connect PowerBuilder to my HANA AWS instance.
Well...when I go to CDM and type "java -version' I got the following:
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
Not sure if it has something to do or not...like I told you...I only pass C:\Program Files\sap\hdbclient as the Java Classpath, the driver com.sap.db,jdbc.Driver as the Driver Name and my AWS SAP HANA path as the URL and that's it...I have never had a problem with it...
This is the document that I read when I first was trying to connect PB with SAP HANA
http://www.scribd.com/doc/96729799/35/Integration-of-the-JDBC-Driver hopefully it might help...
FYI: The PowerBuilder Webforms feature - that this article was based on - has been discontinued as of PB 12.5.2!
Great info! thanks Alvaro!
I'd like to know if it is possible to develop android application with powerbuilder.
I'm not a PowerBuilder expert...so I really don't know...I assume you can as PB runs on .NET and with xamarin you can create Android apps...it would be just a matter of trying yourself 🙂 and sharing your results of course 😉
Yes I can develop application to .NET and run it on IIS, but it is better if it is android native application. That's why I ask it.
A1: Just PB Classic or PB.Net ...... NO
A2: Using Appeon that installs into the PB Classic IDE .... YES 😉
Appeon Mobile - Appeon - PowerBuilder Tools, Native Mobile & Web Development platform, Professional Service
Regards ... Chris
Thank's I'll try it and say here my advanced
Could you post a version of this for Appeon Mobile