martes, 14 de agosto de 2012

SUP on AWS - A better Flights example


I have dealt with this problem before, but never really spend time trying to solve it, until someone ask for it on the forums...

When we create an SUP application, most of the time we use text boxes to send the information and retrieve some data, or maybe we can use a choice control with some hardcode values.

What if for example, we want to have a better Flights example, one that will show us a choice already populated with all the available airlines...that would be cool, right? And actually...it's easier than it sounds...

For this to work, we need to first log into our ERP system and create an structure called ZFLIGHT_DETAILS.


Then, a Table Type based on that structure.


Finally...a really simple RFC Function Module...too simple if you ask me...


This FM will simply return all the Airlines along with their codes.

With that ready, we can move into our Unwired Workspace and create a project. In this new project create two MBO's. One related to our FM ZGET_AIRLINES and the other related to BAPI_FLIGHT_GETLIST.


Here, it's important to create a Personalization Key just for the GetFlightsMBO and of course, don't forget to link it.



After saving and deploying the server, we need stablish our Starting Points. And here comes the exciting part...as we're going to choose not only the first option, but the third one as well.


When we double click on the "Activate" screen, we will have an empty window with a link saying "Submit Workflow"...here, you can get creative and use your company logo...write a message...and of course, change "Submit Workflow" to "Start" or "Begin the journey"...anyway...my job is not build commercial software, so I leave it just like that...


When we click on the "Submit Workflow" link, can establish it's properties, and here we're going to call our FM. Keep in mind that it's very important that the Default Success Screen is set to "Start"


Now, we have to move to the "Start Screen", and add a Choice control and link with the name "Get Flights".


When we set the properties for the Choice control, you will see where the magic comes from.


Don't forget to link the Personalization Key.



Finally, our model should look like this one...


We must save and generate our project in order to see it of the mobile device of our choice.






I hope you like this blog and I hope you already have your own SUP server on Amazon Web Services...otherwise...go and do it! In the meantime you can create your own SAP HANA and R servers as well...

Greetings,

Blag.