+ All Categories
Home > Documents > 602d7851-e944-2f10-55b9-b9befbba0b05

602d7851-e944-2f10-55b9-b9befbba0b05

Date post: 25-Oct-2014
Category:
Upload: sameer-sawant
View: 12 times
Download: 0 times
Share this document with a friend
Popular Tags:
22
© 2012 by SAP AG. All rights reserved. SAP and the SAP logo are registered trademarks of SAP AG in Germany and other countries. Business Objects and the Business Objects logo are trademarks or registered trademarks of Business Objects Software Ltd. Business Objects is an SAP company. Sybase and the Sybase logo are registered trademarks of Sybase Inc. Sybase is an SAP company such products and services, if any. Nothing herein should be construed as constituting an additional warranty. BUILDING AND CUSTOMIZING A MOBILE APPLICATION USING THE SYBASE UNWIRED PLATFORM 2.1.2 SUP DEVELOPER CENTER TUTORIAL #2 BUILDING A HYBRID APPLICATION USING THE SAP ERP BACKEND VIA JCO
Transcript
Page 1: 602d7851-e944-2f10-55b9-b9befbba0b05

© 2012 by SAP AG. All rights reserved. SAP and the SAP logo are registered trademarks of SAP AG in Germany and other countries. Business Objects and the Business Objects logo are trademarks or registered trademarks of Business Objects Software Ltd. Business Objects is an SAP company. Sybase and the Sybase logo are registered trademarks of Sybase Inc. Sybase is an SAP company such products and services, if any. Nothing herein should be construed as constituting an additional

warranty.

BUILDING AND CUSTOMIZING A MOBILE

APPLICATION USING THE SYBASE UNWIRED

PLATFORM 2.1.2

SUP DEVELOPER CENTER TUTORIAL #2

BUILDING A HYBRID APPLICATION USING THE

SAP ERP BACKEND VIA JCO

Page 2: 602d7851-e944-2f10-55b9-b9befbba0b05

EXERCISE #1 – CREATE A SIMPLE HYBRID WEB APP (WORKFLOW)

1. START THE SYBASE UNWIRED PLATFORM SERVICES

Optional Step if SUP wasn’t already started in Workshop #1

Run the “Start Sybase Unwired Platform Services” shortcut on the desktop

2. CREATE A NEW MOBILE APPLICATION PROJECT

Launch Sybase Unwired WorkSpace from the shortcut on the desktop

(If prompted) Select the default location for your Workspace

(If prompted) Select “Start Development” on the Welcome Screen

(Optional) Select “Window-Reset Perspective…” (you can do this at anytime to set your workspace windows and view back to default)

File -> New -> Mobile Application Project

Name it “Flights” and click “Finish”

Switch Developer Profile to Advanced Optional Step if SUP wasn’t already started in Workshop #1

Right click on any white space in the “CustomerList – Mobile Application Diagram” window and choose “Switch Developer Profile” from the context menu

Make sure the Advanced developer profile is selected

3. INITIALIZE YOUR SAP ERP ACCOUNT

Run “SAP Logon” from the Desktop

Page 3: 602d7851-e944-2f10-55b9-b9befbba0b05

Log On to the “SUP Developer Center ERP System” connection using the “User” and initial “Password” which was provided to you during the Developer Center cloud invitation.

You will be asked to reset your ERP user password. Enter a new 6-character password and record it so

you can use it later.

4. (OPTIONAL) TEST THE SAP BAPI WE WILL BE USING

If you would like to test the BAPI we will be using for this workshop you can execute it from within the SAP GUI.

Make sure you are logged into “SAP Logon”

Enter in “/n se37” into the SAP GUI command line (upper left) and hit the green check mark icon (enter).

Enter “BAPI_FLIGHT_GETLIST” in the Function Module field which is the name of the BAPI we are going

to use in this Workshop and click on the Test/Execute icon (looks like a wrench) or F8.

Page 4: 602d7851-e944-2f10-55b9-b9befbba0b05

This BAPI will return all the flight entries in this SAP ERP system. You can filter the result set using Import

parameters. Put the two letter abbreviation of one of the below airlines in the “AIRLINE” field and click on the “Execute” icon (looks like a clock with a green check mark) (F8) to see the return values. AA = American Airlines (~84 entries) AZ = Alitalia Airlines (~140 entries) DL = Delta Airlines (~81 entries) JL = Japan Airlines (~56 entries) LH = Lufthansa Airlines (~351 entries)

Note: You can click on the result “Entries” value to view the individual records

5. CONFIGURE YOUR SUP TO SAP CONNECTION

In the “Enterprise Explorer” window (bottom left) expand your “SAP Servers“ connections and right-click on the “SUP DevCenter ERP” connection and select “Properties”

Page 5: 602d7851-e944-2f10-55b9-b9befbba0b05

Under “SAP Connection Properties Page” enter your SAP ERP “User name:” and “Password:” values in

the “Login information” section, check the “Save password” box and click on the “Test Connection” button. Note: If your ping didn’t succeeded, you will need to resolve this issue before you continue.

“OK” out of the configuration

Page 6: 602d7851-e944-2f10-55b9-b9befbba0b05

6. CREATE YOUR APPLICATIONS MOBILE BUSINESS OBJECT (MBO)

In the “WorkSpace Navigator” window (top left) expand your “Flights“ application and right click on ”Mobile Business Object”, select “New->Mobile Business Object”

Name it “FlightList” and click “Next”

Select the “SAP” Data source type with “SUP DevCenter ERP 6.0 EhP5” Connection profile and click next

In the Method Definition section click on the “Browse…” button

In the “Search BAPIs/RFCs” field enter “BAPI_FLIGHT_GETLIST”

Select the “GetList” BAPI and click on “OK”

Page 7: 602d7851-e944-2f10-55b9-b9befbba0b05

Select “AIRLINE” as the “In” parameter and “FLIGHT_LIST” as the “Out” parameter and click “Next”

Input “JL” as the Default Value in the Parameters screen and click “Finish” (No changes needed on the

Attributes Mapping or Role Assignments screens)

Optional: You can test your new MBO by right clicking on the object and selecting “Preview…”. In the Preview screen click on the “Preview” button, you should get return records

Page 8: 602d7851-e944-2f10-55b9-b9befbba0b05

7. ADD LOAD PARAMETERS TO THE MOBILE BUSINESS OBJECT

Create a “Personalization Key” that will be used to take a parameter passed from the device and be used as a Load Parameter for our MBO. Right click on the “Flights” project in WorkSpace Navigator and select “New->Personalization Key”

Call it “AirlinePK” and set the type to “STRING(3)” (select STRING(%n) then change it from 20 to 3), uncheck the “Nullable” box and set its Storage to “Transient”, then click “Finish”

Page 9: 602d7851-e944-2f10-55b9-b9befbba0b05

Now map the AirlinePK to the MBO Load Parameter by selecting the MBO object in the “Flights – Mobile Application Diagram” and under the “Properties-Attributes-Load Arguments” tab(s) select the “AirlinePK” as the Personalization Key value in the AIRLINE Load Parameter.

8. DEPLOY YOUR MOBILE BUSINESS OBJECT

Right click on any white space in the “Flights – Mobile Application Diagram” window and choose “Deploy Project…” (always say yes to saves..;)

Select “Next” on the Deploy Mode and Target Version screen

“Next” on Contents screen

“Next” on Package User-defined Classes screen

Double click on the “My Unwired Server” on the Target Server screen and click “Next”

“Next” on the Deploy Application to Server screen

Select “<New Server Connection…>” from the Server connection field on first MBO deployment, and ok to create the “SUPDevCenterERP6.0Ehp5” server connection

Click “Next” on the Server Connection Mapping” Screen

“Finish” on “Save as a Deployment Profile” screen

Make sure you see the “Success” window

9. CREATE YOUR HYBRID WEB APP (WORKFLOW)

Right click on your “Flights” project in the WorkSpace Navigator window and select “New -> Mobile Workflow Forms Editor”

Call it “Flights from SAP.xbw” and click on “Next”

Check the box “Can be started, on demand, from the client” and click “Finish” (this will be a client initiated app)

Switch from the “Introduction” tab to the “Flow Design” tab

Page 10: 602d7851-e944-2f10-55b9-b9befbba0b05

Expand the Mobile Business Object folder in your project and click and drag your “FlightList” MBO to white

space on the Flow Design window of your application Note: You can have eclipse auto arrange your Flow Design screens buy clicking on the “Arrange All” icon

Double click on the “Start Screen” in the Flow Design window

Add a “Choice” control to your mobile start screen

Set the Label to “Please Select Airline”

Change the Label position from “Left” to “Top”

For the Input Data Binding click on the “New key…” button and name it “AirlineKY” as Type “string”

Now add the 5 Airline Static options for the choice control Display Name: American Airlines Value: AA Display Name: Alitalia Airlines Value: AZ Display Name: Delta Airlines Value: DL Display Name: Japan Airlines Value: JL Display Name: Lufthansa Airlines Value: LH

Page 11: 602d7851-e944-2f10-55b9-b9befbba0b05

Add a “MenuItem” to your “Menu” screen on your app (click once, then click again under the Cancel

Screen button that was added by default, no click and drag…)

Name it “Get Flights”

Make sure you have the “Properties” tab selected in the bottom right window and change the “Type” of this menu item from “Save Screen” to an “Online Request”

Search and find the Mobile business object you created “FlightList” and select for it to “Invoke object query” -> “findAll”

Enter whatever “Submit error message” you want displayed if it doesn’t work (you’ll never see this..;)

Click on the “Generate Error Screen” button to have it auto generate error screens for your app

Have it move to the “FlightList” screen on “Success screen”

Page 12: 602d7851-e944-2f10-55b9-b9befbba0b05

Now select the “Personalization Key Mappings” tab to map the user’s Control (Airline) selection to the

Personalization Key which will be used as the MBO Load Parameter. Select “Add” and map the AirlinePK to AirlineKY.

Switch to the “Flow Design” view and remove some unnecessary fields from the Listview in the FlightList

Screen. Open the “FlightList” screen, select the Listview, in the “Properties-Cell” tab, remove cells 0,1,5,7,10,11,12,13

Switch back to the “Flow Design” screen and pat yourself on the back for your great work in creating an SAP application that will run on Widows Mobile, iPhone, iPad, Android, and BlackBerry devices Note: “Arrange All” to make it look pretty and save your work

Arrange All icon in eclipse toolbar

10. CONFIGURE HYBRID WEB CONTAINER ON BB SIMULATOR

Page 13: 602d7851-e944-2f10-55b9-b9befbba0b05

Optional Step if your device wasn’t already configured in Workshop #1 Note: For instructions on how to use Android Emulator or iOS device, see Appendix A & B

Start the BlackBerry simulators o Run the “MDS” application from the desktop shortcut (or Start -> Programs - > Research In Motion

-> BlackBerry Email and MDS Services Simulators 4.1.1 -> MDS) o Run the “9800” application from the desktop shortcut ( or Start -> Programs -> Research In Motion

-> BlackBerry Smartphone Simulators 6.0.0 -> 6.0.0.141 -> 9800) Note: If the BlackBerry simulator is not pre installed, they can be downloaded using the following links: https://swdownloads.blackberry.com/Downloads/entry.do?code=996009F2374006606F4C0B0FDA878AF1 - Download and install the “BlackBerry Email and MDS Services Simulator Package” http://us.blackberry.com/developers/resources/simulators.jsp - Download and install the “BlackBerry Torch 9800” – “6.0” Generic OS – “6.0.0.141” simulator.

Once the BB simulator loads, make sure it is running in “Graphics Acceleration” -> “Off” mode

Show “All” applications and open the Sybase “Workflow” application

Page 14: 602d7851-e944-2f10-55b9-b9befbba0b05

Note: If the “Workflow” application isn’t pre-installed you will need to copy all .cod files from \Sybase\UnwiredPlatform\MobileSDK\HybridWeb\BB to the \Program Files (x86)\Research In Motion\BlackBerry Smartphone Simulators 6.0.0\6.0.0.141 (9800) directory and close and re-load the simulator.

Check the “Enable Automatic Registration” box and enter connection information to the server: Server Name: The unique IP Address of your Dev Center Image (Start->Run->ipconfig) Note: If you plan

to use a real device this needs to be the Public IP Address of your server (see Appendix B)

Server Port: 5001 Farm ID: 0 User Name: supAdmin (this is the default SUP Admin account) Password: s3pAdmin (this is the default SUP Admin password)

Note: This is why you want to use Afaria as the Mobile Device Management solution for SUP, it will do all this configuration for the user…

Select “Save” from the menu to begin connecting to the server

You can see the progress on the Device log by selecting “Show Log” from the menu, make sure you see “Connected to Server” that’s a good sign…

Page 15: 602d7851-e944-2f10-55b9-b9befbba0b05

11. GENERATE AND DEPLOY WORKFLOW APPLICATION

Back in the Sybase Unwired Workspace Eclipse tool right click on some white space in the Flow Design tab and select “Generate Mobile Workflow Package…”

Make sure the “Assign workflow to user(s)” box is checked and your user is there (Get Users) and click “Finish

Page 16: 602d7851-e944-2f10-55b9-b9befbba0b05

12. RUN WORKFLOW APPLICATION

Access your application from the Workflows application or from the menu item in the Inbox (BB, Windows Mobile Only). Note: It can take a few minutes for the Workflow application to come down the first time.

Test your application

Page 17: 602d7851-e944-2f10-55b9-b9befbba0b05
Page 18: 602d7851-e944-2f10-55b9-b9befbba0b05
Page 19: 602d7851-e944-2f10-55b9-b9befbba0b05
Page 20: 602d7851-e944-2f10-55b9-b9befbba0b05

APPENDIX A – USING ANDEROID EMULATOR

Important Remarks: The Android emulator requires you to use the IP Address of your server for the Dev Center image. Also, the Android Emulator can be VERY slow.

1. LOAD ANDROID EMULATOR

Run the “Android AVD Manager” from the desktop shortcut

Select the “SUPDevCenterDemo” Android 2.2 AVD and click “Start…” then “Launch”

2. CONFIUGRE SUP WORKFLOW CLIENT

Run the “Workflow” application on the Android emulator home screen, or from the all applications screen

Note: If the “Workflow” application isn’t pre-installed you will need to install it. With the emulator running, run the following 2 commands from a windows command prompt (cmd.exe): “c:\android-sdk-windows\platform-tools\adb install c:\Sybase\UnwiredPlatform\MobileSDK\HybridWeb\Android\SybaseDataProvider.apk”

Page 21: 602d7851-e944-2f10-55b9-b9befbba0b05

“c:\android-sdk-windows\platform-tools\adb install c:\Sybase\UnwiredPlatform\MobileSDK\HybridWeb\Android\Workflow.apk”

Setup your “Workflow” application password. This password is independent of any other authentication. It is used to provide a extra level of application protection (sandboxing). It needs to be at least 6 characters so create a password you will remember (e.g. sup4sap). Note: If you forgot this application password you will have to uninstall/re-install the client application.

Use the “Automatic Registration” process (Important: Remember to use the IP Address of your server).

To Enable Automatic Registration simply check the box and enter in the following settings: o Server Name: Unique IP Address of your Server (Start->Run->”cmd.exe”->”ipconfig”) o Port: 5001 o Farm ID: 0 o User Name: supAdmin (default admin account) o Password: s3pAdmin (default admin account)

Then click “Menu” – “Save” – You can make sure you client is connecting to your SUP Server by checking the client side log “Menu” – “Show Log”

To assign an Application/Workflow to your client go to the Sybase Control Center, select your user/device

under “Applications->Application Connections” and select the “Workflows…” button (3rd

for the far right) and “Assign workflow…”

Page 22: 602d7851-e944-2f10-55b9-b9befbba0b05

APPENDIX B – USING A PHYSICAL IOS OR ANDROID DEVICE

Important Remarks: If you are using a physical device, it needs an Internet connection that doesn’t block port 5001 and you must use the public IP Address of your server for the Dev Center image.

Download the Sybase Mobile Workflow 2.1.2 client from Apple’s App Store or from Android’s Market Place

Configure client as described in (Exercise #1 Step #6) and/or Appendix A using the Public IP Address of your server (you can find the Public IP Address of your server by opening up http://whatismyipaddress.com on your Dev Center Image Internet browser).


Recommended