1 2 3 15 Previous Next

SAP Mobile Platform Developer Center

214 Posts

All.

 

I have done some findings in the area of JVM memory analysis and adjustment that I wanted to share.

 

Background

 

In the Agentry Server prior to SMP one had the option to adjust the JVM heap memory size of each Agentry Server by adjusting the corresponding parameters of the Agentry.ini file.

 

The parameters were:

[Java-1]

initialHeapSize=

maxHeapSize=

 

Now on SMP 3.0 the Agentry Server(s) are using the same runtime as the SMP, and you can no longer set memory allocation in the Agentry.ini (as it no longer exist). And you cannot set it in the Management Cockpit either, eventhough you have the [Java-1] section in your Backend configuration part of your Application definition.

 

So how do you analyse and adjust the JVM heap memory of the SMP 3.0 ?

 

Analyze

 

Please note that the SMP 3.0 is using the SAP Java runtime JVM.

Fortunately a simple Analyzer tool is included in the SMP installation.

The tool is located in <SMP_HOME>\sapjvm_7\bin\jconsole.exe

 

If you start the tool directly, it will display Java processes executing in your user, and you can connect directly. Normally you would have to start the SMP by Go.bat.

If your SMP server is running as a service it will normally be executing under a different user (smpServiceUser), and you will need to start jconsole a little differently.

 

Start the Task Manager, and determine the process ID of the java.exe process hosting your SMP platform.

 

TaskManager.jpg

In my case the SMP java.exe is executing under process ID 1632.

 

Now open a command prompt and navigate to the folder where jconsole is located.

 

Command.jpg

Issue the command "jconsole <PID>", where <PID> is the process ID of the SMP java process.

Warning.png

You will get this warning, but just click "Insecure connection".

You are located directly on the host so I don't see any problem in this.

 

 

jconsole1.jpg

You will now get an overview, and you can navigate to multiple tabs for various information.

 

jconsole2.jpg

On the "VM Summary" tab, you can find info of the current and maximum heap size, as well as all kinds of other info regarding the VM.

 

 

Adjusting memory

 

If your server is running out of heap memory (java.lang.OutOfMemoryError), you may want to increase the heap memory allocation on the SMP.

 

Startup parameters for the JVM is set in the file: <SMP_HOME>\Server\props.ini

 

Default memory parameters are:

-Xms1024m                          Initial Heap size

-Xmx2048m                          Max Heap size

-XX:PermSize=256M             Initial memory allocation for permanent objects

-XX:MaxPermSize=512M       Max memory allocation for permanent objects

 

 

By adjusting the value of Xmx you can change the max allowed memory allocation for the JVM.

It is good practice to set Xms to 50% of the Xmx value (as far as I know).

 

A restart of the SMP server is needed for the changes to take effect.

 

 

I hope this is helpfull.

 

 

Søren Hansen

Now that we have the SODataEntitySet instance, we pick up each entity out of the entityset.

01  id<SODataEntity> entity = [entityset.entities objectAtIndex:row];

Obtaining the value out of the entity is demonstrated here:

01  NSString *propValue = (NSString *)[(id<SODataProperty>)entity.properties[propName] value];

Question - how do we pick up the value out of the complex type? - Here's the answer.

01  NSDictionary *details = (NSDictionary *)[(id<SODataProperty>)entity.properties[detailsName] value];
02  NSString *propValue = (NSString *) [(id<SODataProperty>)details[propName] value];

So the complex type gets returned as the NSDictionary object.

 

Okie, so far we have done pretty much about Read operation. Let's move on to the CUD scenario.

 

First thing we need to understand is how we construct an entity. Here's the code snippet:

01  NSMutableArray *properties = [NSMutableArray array];
02  id<SODataProperty> prop = [[SODataPropertyDefault alloc] initWithName:@"myKey1"];
03  prop.value = @"My prop value";
04  [properties addObject:prop];
05  prop = [[SODataPropertyDefault alloc] initWithName:@"myKey2"];
06  prop.value = @"Another prop value";
07  [properties addObject:prop];
08  // goes on and on..
09  SODataEntityDefault *entity = [[SODataEntityDefault alloc] initWithType:@"MyEntity"];
10  for (id<SODataProperty> prop in properties) {
11    [entity.properties setObject:prop forKey:prop.name];
12  }

#02, #03, and #04 are creating key/value pair of each property. We'll repeat until we set all the property values for the entity. And #09, #10, 11, and #12 is iterating through to set the SODataEntity properties.

 

Now that you got an idea about how to work with an entity object, let's take a look at the CUD methods. As you have understood the Read operation, they should be very straightforward.


Create operation (= HTTP POST)

01  [onlineStore scheduleCreateEntity:entity collectionPath:@"CollectionName" delegate:self options:nil];

Update operation (= HTTP PUT)

01  [onlineStore scheduleUpdateEntity:entity delegate:self options:nil];

Delete operation (= HTTP DELETE)

01  [onlineStore scheduleDeleteEntity:entity delegate:self options:nil];

One coding remark about Update and Delete. Before invocation of the methods, make sure you set ResourcePath for the entity. The url value would be something like "TravelagencyCollection('00000105')" - something you can identify the entity in OData convention. In most case the setResourcePath: and editResourcePath: should set the same value but it depends on how your OData service is implemented.


Tip: If you already get the entity with the store, the entity should already contain these resourcePaths.

01  [entity setResourcePath:url editResourcePath:url];

And - Read operation (= HTTP GET)

01  // if you want to refresh/reload an entity
02  [onlineStore scheduleReadEntity:entity delegate:self options:nil];
03  // or..specify the resource path
04  [onlineStore scheduleReadEntityWithResourcePath:resourcePath delegate:self options:nil];

That's pretty much all I want to share about the online scenario. You can be confident you got a solid fundamental about how OData online API works. Next blog will introduce you the onboarding API. I know - everyone is interested in offline API, but let me quickly cover the onboarding first.



See you in the next blog,

Ken

This guide will give a clear understanding on how to create an OData service for a given SAP Gateway data source. Here, i am using publicly available demo gateway service : Flight example

 

Service URL : https://sapes1.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/

 

Note: To access this URL, you must have an account on SAP Gateway Demo system. How to get access

 

Now,to make this service available through SMP 3.0 server, i am going to import it in eclipse and then will deploy to SMP server.

 

Tools Used: Eclipse Kepler, SAP Mobile Platform 3.0 SP04 PL01, Advanced REST Client

 

Steps:

 

Prerequisite: Installing "SAP Mobile Platform Tools" in Eclipse Kepler  Reference Document

 

  1. Create a new project in Eclipse Kepler, make sure to select proper "Target Runtime"

 

               1.PNG

 

2. Select Model Content as "OData Service URL"  , Click "Next"

 

               2.PNG

 

3. Provide the service URL https://sapes1.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/ and click "Go". Enter correct credentials to connect to sapes1.sapdevcenter.com server

 

               3.PNG

Note: Not able to retrieve the service details? Look at Troubleshooting #1.

 

4. Once done, you can see the automatic creation of OData entities.

 

           

          completeprojc.PNG

 

5. Next task is to assigning data sources to each and every Entitysets.

 

    • Right click> FlightModel.odatasrv >Select Data source
    • Name : RMTSAMPLEFLIGHT
    • Make sure you specify Namespace as "IWBEP" (not SAP as always)

 

                    datasource.png

 

Note: How to identify what is the correct Namespace for a particular SAP gateway service? I generally prefer to a cross-check from step #9.

         odatasrv.png

6. Right click project > Generate and Deploy Integrate Content

 

          deploy.PNG

 

7. Now, i have to register RMTSAMPLEFLIGHT service in Gateway cockpit

 

 

          destinations.PNG

               

KeyValue
Destination NameES1
Destination TypeHTTP
Destination URLhttps://sapes1.sapdevcenter.com:443/sap/iwbep?sap-client=520
Authentication TypeBasic Authentication

User Name

SAP Gateway Demo system usename
PasswordSAP Gateway Demo system password

 

 

8. Select the "ES1" destination, click on "Test Connection". You should see a SUCCESS message.

 

          test.png

Note: Not able to ping successfully? Look at Troubleshooting #2

 

9. Register Back-End service from ES1 sever

 

    • Click on "Register a New Service" under SERVICES
    • Select Destination as "ES1"
    • Type RMTSAMPLEFLIGHT in search
    • Click on "Register"

 

          registerService.PNG

This is how it should look like:

 

     15.png

Note: As you can see the "IWBEP" is the namespace of the service coming directly from server "ES1" and "SAP" is the namespace of the service deployed through Eclipse.

 

10. Add destination "ES1" to the service "SAMPLEFLIGHT" by clicking on it.

 

          addDestination.PNG

 

Note: I didn't find assigning a destination (ES1) to the deployed OData model (SAMPLEFLIGHT) since backend service (RMTSAMPLEFLIGHT) has already been registered in gateway cockpit. But for best practices it is good.

 

You should see that "ES1" destination has been mapped to service "SAMPLEFLIGHT".

 

          servicedoc.png

 

11. Open "Service Document" as highlighted above. (Assuming you have created a security profile named "SAP" in admin cockpit)

 

           https://jk:8084/gateway/odata/SAP/SAMPLEFLIGHT;v=1

          This URL will return all entity sets contained in the service

               servDoc.PNG

12. To test each Entityset details, just add the Entityset name at the end of above URL.

 

e.g.

a. http://smpserverip:8080/gateway/odata/SAP/SAMPLEFLIGHT;v=1/CarrierCollection('AA')

     This URL will return carrier CARRIER NAME, CURRENCY CODE, URL for Carrier ID "AA"

 

          carrierCollection.PNG

b.  http://smpserverip:8080/gateway/odata/SAP/SAMPLEFLIGHT;v=1/TravelagencyCollection

 

       This will return all Travel Agencies details available in ES1 system.

 

c. http://smpserverip:8080/gateway/odata/SAP/SAMPLEFLIGHT;v=1/SubscriptionCollection

d.  http://smpserverip:8080/gateway/odata/SAP/SAMPLEFLIGHT;v=1/FlightCollection

 

Troubleshooting:

 

If you are using any proxy setting to access any external network, you may encounter below issues:

 

1. Connection timed out: connect

 

                         t1.PNG

Resolution: Go to Windows>Preferences>Network Connections. Select Active provider as 'Manual' and provide proxy details for HTTPS. Check Reference Document for more details.

 

2. Connection has Failed: Connection to https://sapes1.sapdevcenter.com:443 refused

 

          connectionFailed.PNG

Resolution:


a. Set HTTP/HTTPS proxy settings in Admin cockpit. > SETTINGS>SYSTEM

 

               proxysettigns.PNG

 

 

 

b. Add the HTTPS certificate to the SMP Keystore. Reference Document


3. Could not retrieve services from the destination ES1


          destinationFetch.PNG


Resolution: 


Set the proxy server details for the destination ES1. Go to path:C:\SAP\MobilePlatform3\Server\config_master\service.destinations\destinations

               Open ES1. And proxy details.

e.g. Proxy=proxyserver:80


save the file and NO need of restarting SMP server.


 

 

4. When you try to access any entityset information, you are encountered with message saying "Error in Getting the service",


          errorInGettingService.PNG


  Check if you have missed registering the service as mentioned in step #9.

 

 

Follow these forums for latest update on SAP Mobile Platform 3.0 : SAP Mobile Platform Developer Center, SAP for Mobile

 

Note: Big thanks to Bjoern Woppmann for helping me in writing this blog.

Let's read the entityset.


01  [onlineStore scheduleReadEntitySet:oDataQuery 
02                            delegate:self 
03                             options:nil];

03.jpg

The oDataQuery is OData query string such as "CarrierCollection?$top=10..", something you should be already familiar with as the OData rule in general.


The delegate: methods requires another new delegate protocol named SODataRequestDelegate. This delegate has two mandatory callback methods:

  • requestServerResponse:    HTTP 2**, give back the result payload.
  • requestFailed:    HTTP 4** or 5**, give back an ODataError when the server replied with it.

And three optional callback methods:

  • requestStarted:    called when the OData request execution starts.
  • requestFinished:    called every time after the odata requestExecution finished  (no matter that it failed or succeeded).
  • requestCacheResponse:    called when the Store found entities for the current request in the cache. (not used in SP5 version, will be supported in SP6)

For this code snippet, SODataRequestDelegate is declared in the same class. (For the relatively complex app, which has many view controllers, you might want to declare it in another central data controller - but I think you get the idea.)

 

So the scheduleReadEntitySet: method will trigger those callbacks. Let's take a look at how we typically write the logic in the callback.

01  - (void) requestServerResponse:(id<SODataRequestExecution>)requestExecution
02  {
03      id<SODataRequestParam> requestParam = requestExecution.request;
04    
05      if ([requestParam conformsToProtocol:@protocol(SODataRequestParamSingle)]) {
06          id<SODataRequestParamSingle> request = (id<SODataRequestParamSingle>)requestParam;    
07          if (request.mode == SODataRequestModeRead) {
08              id<SODataResponseSingle> responseSingle = (id<SODataResponseSingle>)requestExecution.response;
09              if ([responseSingle.payload conformsToProtocol:@protocol(SODataEntitySet)]) {   
10                  id<SODataEntitySet> myEntityset = (id<SODataEntitySet>)responseSingle.payload;
11              } else if ([responseSingle.payload conformsToProtocol:@protocol(SODataEntity)]) {
12                  id<SODataEntity> myEntity = (id<SODataEntity>)responseSingle.payload;
13              }
14          }
15      }
16  }

#05 checks if the request is general OData request (potentially the values could be others like batch request) and #07 checks if it was Read (= HTTP GET). #09 and #11 examine if the OData is either the entityset or entity type. #10 and #12 are demonstrating how you obtain the returned payload value as the object.


And here's a typical implementation example for requestFailed: callback method.

01  -(void)requestFailed:(id<SODataRequestExecution>)requestExecution error:(NSError *)error
02  {
03      NSString *msg1 = [NSString stringWithFormat:@"Request failed: %@", error.description];
04      if ([requestExecution.response conformsToProtocol:@protocol(SODataResponseSingle)]) {
05          id<SODataResponseSingle> response = (id<SODataResponseSingle>)requestExecution.response;
06          if ([[response payload] conformsToProtocol:@protocol(SODataError)]) {
07              NSString *msg2 = [(id<SODataError>)[response payload] message];
08          }
09      }
10  }

#03 is the error description from the callback method. #06 checks the payload is SODataError and #07 obtains the error message string from the payload.


That's all to request and response the entityset. You went through lots of new important things :-) and the next blog will talk about how we work with returned entityset or entity - together with CUD methods.



See you in the next blog,

Ken

02.jpg

Hi everyone,

 

Let's start with the "store" object.

 

Store (or more precisely, "ODataStore") is the common interface and acts as a central access point of the OData service.

 

In a formal description,

 

quote_start.pngThe ODataStore is covering exactly one OData service (service document and metadata). It shall be possible for an application to create multiple ODataStores (also in combination on- and offline) at the same time, which shall be completely independent from the API perspective and have own life cycles.quote_end.png

 


So in a nutshell, you have to create the store object in order to CRUD the OData. How do we do it?


Here's a typical code snippet for online store:


01  SODataOnlineStore *onlineStore = [[SODataOnlineStore alloc] 
02                              initWithURL:smpOdataUrl              
03                  httpConversationManager:myConversationManager];
04  [onlineStore setOnlineStoreDelegate:self];
05  [onlineStore openStoreWithError:&error];

 

Note: I'll talk about how we create for offline store in later blogs, as the online store is simpler than offline and easier to understand as a first step.


You see the first method name initWithURL:, which is the OData Endpoint URL in SMP server. SMP works as the OData content proxy so once the app gets onboarded to SMP server, SMP should know which URL you need to use. (I'll also cover the onboarding APIs in another blog)


The second method httpConversationManager: is another interesting new object from the new SDK. While onboarding, we create the HttpConverstationManager, which hides the complexities of HTTP communication - such as headers and credentials.


Once you create the SODataOnlineStore, we need to set the callback methods via SODataOnlineStoreDelegate protocol. For this case, the SODataOnlineStoreDelegate is declared in its own class, so simply set as self.


Okie now we can open the store. Invoke openStoreWithError: and either


  • onlineStoreOpenFinished:

Or

  • onlineStoreOpenFailed: 

 

Will be called back.


Congratulations, now you have successfully obtained the online store. What's next...? Yes, CRUD OData.



See you in the next blog,

Ken


01.png

Hello World, Hello Everyone.

 

Thanks for stopping by, and please let me commence the new blog series "SMP3 OData SDK - Tips & Tricks".

 

As you might already know, sets of SMP3 SP4 and OData SDK SP5 have been released. This blog series would like to help you understand better about the new SDK, also internally known as "Harmonized SDK".

 

The name "Harmonized" came from the concept that the developers can use the very similar APIs across different platforms - iOS, Android, Windows, and Cordova-based Kapsel - and they run on either on-premise version or HANA Cloud Platform Mobile Services. We have different programming languages but ideally we want to use the very similar APIs - hence the name of "Harmonized".

 

This blog will focus on iOS (just because I've been working on recently) but other platform should have very similar APIs.

 

Another cool update is the APIs have been "Simplified". I'm planning to discuss the details as "Tips & Tricks" in upcoming blogs.

 

I had tried to count the line numbers of code - a quick and dirty way to gain a rough idea that how much we can shrink down the logic with the new API, comparing with the old one. According to my quick measurement, the total sum of the DataController and ViewControllers in the same iOS app functionality:

 

The code with the old API - 1255 lines

The code with the new API - 689 lines

 

Excited? :-)

 

The upcoming blogs will introduce you to the practical tips and tricks!

 

 

See you in the next blog,

Ken

In my earlier blogs http://scn.sap.com/community/interoperability-microsoft-net/blog/2014/01/17/sap-and-xamarin-for-c-mobile-cross-platform-development-tutorial I have mentioned in details of application development using Xamarin.

 

In the blog http://scn.sap.com/community/developer-center/mobility-platform/blog/2014/07/31/c-cross-platform-mobile-application-using-xamarin-form I covered the Procure to Pay process. In this blog I would like to Cover the order to Cash Process using Xamarin Forms.

 

The Order to Cash Mobile Application has the following flow - Login - List of Sales org - List of Distribution Channels for Selected Sales org - List of Division for the selected distribution channel -( At this point you have a sales Area ) - List of Customers for the Selected Sales Area - List of Sales Orders for the Selected Customers ( on the Screen you can swipe the screen for Options - Options are Create Sales Order (VA01), Create Delivery(VL01N) and Billing (VF01). In addition you can drill down on Sales orders and then menu options allow you list Deliveries and Billings documents for the Selected Sales order. For Each of the Options A REST Service is invoked which In turn calls ABAP Function which returns the list to be displayed on the screen.  Xamarin Forms improves the efficiency of the mobile phone app development.

 

For the Order Creation I use the BAPI  BAPI_SALESORDER_CREATEFROMDATA, for Delivery I use BAPI_OUTB_DELIVERY_CREATE_SLS.  For Billing I tried to use BAPI_BILLINGDOC_CREATEFROMDATA - This was generating a Kernel dump. I'am using IDES 7.31 with Service Pack 6(Latest IDES), I also tried to Billing using VF01 - This dumped as well (Internal Kernel Error DDIC_TYPE_REF_ACCESS_ERROR). I was told by Basis people that we should back Service Pack 5 to resolve this.  So I decided to complete my app expect for billing as this process could a lot time. The Image Below show the screens flow

 

 

Picture1.png

 

From The options page you can choose Create Order, Then do Delivery - If you double click on the order the order lines summary is displayed with options to see the List of Deliveries for the Sales order Line or List of Billing Documents for the Sales order line as shown below

 

picture2.png

 

 

In addition I have added Barcoding Support for Material as explained in my blog using Xamarin Component.

http://scn.sap.com/community/developer-center/mobility-platform/blog/2014/08/03/c-mobile-application-using-xamarin-forms--add-barcoding-support

 

I posted the recording for the Order to cash process on youtube

https://www.youtube.com/watch?v=1yIQQv6abNE&feature=youtu.be&hd=1

As I did not have printed barcode to test for my article - I create another video just to show barcoding from Android phone

https://www.youtube.com/watch?v=fdz8aEp7CRQ&feature=youtu.be&hd=1

 

As these mobile Phone applications have been developed using Xamarin Forms ( as explained in my earlier blogs  they work on IPhones and Windows Phones as well.

When I got an O Level (yes an O Level, not a GCSE) in Computer Science, thanks to my BASIC skills and expertise on an ICL (yes ICL)1904, the thoughts of SAP and developing Apps were nowhere to be found.

When I finally graduated with a degree in Mathematics and Computing I entered the fast moving dynamic world of COBOL programming, initially on a Data General (yes Data General) MV10. The word Apps and SAP were nowhere to be heard but the replacement of flat files with databases was the chat of the day.

So moving on some 30 years with numerous COBOL programs written which are now probably in the computer rubbish bin of time and 20 years of SAP experience in business process design, project management and that never forgotten technical itch driving me into writing ABAPs, the world of Apps caught up with me. The statement ‘Consumer User Experience is the new standard for enterprise applications…’ is being bandied around and SAP are getting in on the act.

Mobility and User Experience are high on SAP’s agenda. With Fiori and Personas becoming a free part of the SAP Licence there is a higher uptake on the offerings. In an earlier blog SAP UX: Managing the User Experience I drew a quick guide on how to initially decide on what tools to use based on the requirements the use case presents.

Fiori is a good tool and basically does what it says on the tin. If you are using standard SAP with little or no bespoke developments, Fiori will probably have a solution. You can also develop your own Apps and this is done with the tools available through SAPUI5 which is a collection of technologies which use HTML5.

Most of the customers Absoft deal with are upstream oil and gas companies. They have, like a lot of companies in other industries, well-developed SAP systems with a large number of bespoke developments. A number of them also run RLM. There are only a few Fiori RDS which fit some of their use cases. So putting my techie hat on I had a go at developing some of the Apps customers were interested in with Neptune Software. Neptune claim that it was developed by developers for developers. So I thought I would give it a test drive.

The first thing to do was to install Neptune. Our BASIS guys did it within 10 minutes of downloading the software. Neptune claims to run on anything from SAP 4.7 and above. We are running ECC 6.0 EHP 7 on our demo system so I had no chance to check any lower.

I dreaded the thought of developing the screens on the web for my precious Apps, having not used any web based development tools before. However, Neptune has an Application Designer within SAP which allows easy development of the required screens.

Pi 1.png

Through this tool you can create your screens and bind them to the required class in SAP to run the application. You can preview these screens without exiting SAP by clicking on the 'preview' button in the screen above. Your work of genius then appears on the screen.

pic2.png

Clicking on one of these tiles executes the ABAP code developed in the Class Builder. The Class Builder is accessed via the button in the Neptune Application Designer screen or SE24.

pic3.png

The method with the description Handle OnAjax is the code for binding the screens developed above and the friendly ABAP world. The key is the Ajax ID and the Model Source which you have defined against the list you are processing.

pic4.png

The above List is to display Purchase Requisitions ready to be converted. The Model Source is defined as an attribute to the class and the Ajax ID is the guidance on which method to execute in the Handle OnAjax method as shown below.

pic5.png

To develop the purchasing screens above and the methods behind it took just over a day with a little help from a colleague. We have developed a few more Apps in Neptune since with developments in HR, Plant Maintenance and Inventory with some Apps being developed to replicate parts of the RLM functionality.

Neptune works efficiently offline by creating a data cache on the device. With Neptune you write once, deploy everywhere, online and offline.

I was impressed with Neptune and how I, putting on my techie hat, could develop Apps with little HTML5 knowledge. I would recommend this tool to any die hard ABAP’ers who want to further their company’s mobility and user experience.

Neptune works well for bespoke applications and is relatively inexpensive to install. Fiori might be the tool for you as it may fit your use case perfectly but do not forget the cost of upgrading to the correct ERP level which may be required to implement.

Neptune and Fiori should not be considered as competitors because they could work well together with Neptune being the easier to use to develop home-grown Apps and Fiori the stronger for SAP RDS.

But as a techie by heart, Neptune certainly made my ABAP juices flow.

Find out more about Absoft's Custom Apps capabilities.

by Gareth Petherick, Principal SAP Consultant

We got a requirement where we have to fetch all registered device details from SMP 3.0 Admin cockpit those have been registered for push notifications (GCM, APNS, BES,WNS, MPNS). We have got access to Derby DB tables where required information is available.

 

This database stores information about the data that passes through the SAP Mobile platform system like execution requests between client and server, information about native and hybrid applications, back-end notification requests, and usage statistics.

 

Note: This write-up is only for SMP 3.0 development edition where Derby Database is get installed by default. For SMP 3.0 Production, you can find SMP related information in other database (either Oracle DB, ASE, DB2) that has been chosen while SMP installation.

 

     There is a table name SMP_NOTIFICATION_TARGET that has all required details.

               table.PNG

 

Tools & Platform Used: SQuirreL SQL Client v.3.5.3, Eclipse Kepler 4.3, SMP 3.0 SP03, Windows

 

Pre-requisite:

 

Note: If you are trying to install "Integration Gateway plugins" in eclipse juno, you may not find it. This tool will not be available for Eclipse juno, as SAP has official ended the support of Eclipse Juno in the end of June 2014. See this announcement.

 

Steps:

 

1. In Eclipse Kepler, Go to File>New>SAP Mobile Platform OData Implementation Project

               

               newProj.png

 

2. Give any project name. Make sure to select proper server as Target Runtime. (I have installed SMP 3.0 SP03 on my machine so i have chosen respective option).

 

          name.png

 

3. Give a Model name and click>Finish.

 

4. Create a new Entity>Give some name.

 

5. Make sure EntitySet should have same name as Table name > SMP_NOTIFICATION_TARGET

     And its properties name should match as above table's column names. (as per first screenshot)

 

          ODatamodel.PNG

 

Note: There is no need of implement the OData service (as in Eclipse JUNO) since odatasrv has already been generated at the time of project creation.

 

6. Right click DerbyModel.odatasrv> Select Data source> select JDBC>Finish

 

          jdbc.PNG

 

7.  Right Click project>Generate and deploy Integration content

 

Note: There is no need to deploy the JDBC driver for apache derby, because it is already on the build path (by SMP system). So do not deploy again the jdbc driver inside the pickup folder..

 

8. Logon to Gateway cockpit: https://smpserverip:8083/gateway/cockpit

    • Create a new destination under DESTINATIONS tab>Create a new Destination
    • Provide below details:

                    uploadedimage.png

 

 

PropertyValue
Destination NameDerbyDB
Destination TypeDATABASE
Destination URLjdbc:derby://localhost:1527/F:\SAP\MobilePlatform3\Server\db\derby\smp3
Database Driverorg.apache.derby.jdbc.ClientDriver
Authentication TypeBasic Authentication
User Namegomobile
Passwordsecret

 

9. Switch to "SERVICES" tab, Click the deployed OData service and then Click on "Add Destinations"

 

          addDestination.PNG

 

10. Click on "Open service document"

 

http://localhost:8080/gateway/odata/SAP/DERBYDBODATA;v=1

 

     serviceDoc.PNG

 

11. To get EntitySet details, add SMP_NOTIFICATION_TARGET at the end of above URL.

 

     http://localhost:8080/gateway/odata/SAP/DERBYDBODATA;v=1/SMP_NOTIFICATION_TARGET

 

To get the list of device id and Device notification key against an application id

 

http://localhost:8080/gateway/odata/SAP/DERBYDBODATA;v=1/SMP_NOTIFICATION_TARGET?$filter=CONFIGID%20eq%20%27com.mycompan…

 

          details.PNG

 

To get list of all Application Connection ids against all Application IDs registered in admin cockpit then look for SMP_APPLN_CONNECTION_INFO table. It will also show if Application connection status is ACTIVE or DELETED.

 

Tips: When an entity type is created in an OData implementation project, there is one property key parameter gets created by default. Make sure to remove/rename it. Otherwise you may encounter with below error while opening EntitySet URL. As this key parameter is not present in database table.

 

          "An exception occurred".

 

               exception.PNG

       

 

Big thanks to Marvin Hoffmann for his valuable inputs.

This write-up is an extension to this blog How to connect SOAP WebServices with Integration Gateway in SMP3 written by Marvin Hoffmann

 

As you can see for the given SOAP WS, http://www.predic8.com:8080/material/ArticleService?wsdl there are 4 different methods. As we have already seen how to do OData modeling for get, getAll methods, now its time for other methods Create & Delete.

 

     1.png

 

 

 

Note: If you have already added "Integration gateway (GWPA) plugin" in Eclipse JUNO, then you can directly start OData modeling for those methods otherwise you have to use Eclipse Kepler to add "SAP Mobile Platform Tools" as Eclipse JUNO support has officially been ended by SAP. Then how to do?

 

Note: This below steps are done in Eclipse juno with the help of GWPA plugin.

 

Assuming you have already created entity type and one complex type and then implement the OData service. Next task is to select Data Source.

 

CREATE:

 

1. Right click DataModel.odatasrv > select Data source

 

          2.png

 

 

2. Select "Create" as operation type and as data source "SOAP Service"

 

               3.png

 

3. Provide following connection details:

 

    

ProepertyValue
Endpointhttp://www.predic8.com:8080/material/ArticleService
Namespacehttp://predic8.com/wsdl/material/ArticleService/1/
Operationcreate
Port TypeArticleServicePT

 

 

          4.png

 

 

4. Right click on Create> Define Request mapping

    • point to WSDL file

 

  5.                   5.png

               42.png

 

6. Similarly, right click on create> Define Response Mapping

 

          21.png

 

 

DELETE:

 

 

7. Repeat step #1.

8. Select "Delete" as operation type and as data source "SOAP Service".

 

               22.PNG

 

9. Provide following connection details:

 

ProepertyValue
Endpointhttp://www.predic8.com:8080/material/ArticleService
Namespacehttp://predic8.com/wsdl/material/ArticleService/1/
Operationdelete
Port TypeArticleServicePT

 

 

          23.PNG

 

10. Request mapping:

 

          43.png

 

11. Response Mapping:

 

   

          26.png

 

Note: Since ArticleID is a key in the EntitySet so in the response mapping it can not be left unmapped. It has to be mapped otherwise you will get an error and so won't be able to deploy the project.

 

12. Once done, right click on project > Deploy and Generate the project

 

13. To test service document for the newly added methods create & delete,first we need to get CSRF-TOKEN using GET method. So, make a GET request first as below:

 

13.png

 

14. For creating a record, we have to call POST method. Pass the returned CSRF-TOKEN in the header section with below body section.

 

 

          14.png

 

<?xml version="1.0" encoding="UTF-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
   <atom:content type="application/xml">
      <m:properties>
         <d:ArticleID />
         <d:Name>Ginger tea</d:Name>
         <d:Description>Good for health</d:Description>
         <d:Price m:type="ArticleServiceModel.price">
            <d:Amount>10</d:Amount>
<d:Currency>EUR</d:Currency>
         </d:Price>
      </m:properties>
   </atom:content>
</atom:entry>


 

     You must get "Status 201 Created" in the response.

 

          44.png

 

15. For Deleting an existing record, select DELETE as below. You must get "Status 204 No Content" in the response.

 

          12.png

 

Tips:

 

1. For Payload, it is always recommended to follow parameters data types and values as per service metadocument.

 

     http://localhost:8080/gateway/odata/sap/ArticleService;v=1/$metadata

          tip1.PNG

 

2. If you are encountered with "Status 400 Bad Request" message in response then it might be of because of payload syntax missing/mismatch.

 

     27.png

 

Use Xml formatter  http://www.freeformatter.com/xml-formatter.html for assistance.

Hi All,

 

If you are trying to install "Integration Gateway plugins" in eclipse juno, you may not find it. This tool will not be available for Eclipse juno, as SAP has official ended the support of Eclipse Juno in the end of June 2014. See this announcement.

 

So what is next? Now, SAP has come up with new SAP Mobile Platform tools in Eclipse Kepler. How to add it?

 

Steps:

 

  1. Make sure you have downloaded and installed latest Java (JDK or JRE - 32 bit/64 bit based on your OS configuration)

          Java-Downloads für alle Betriebssysteme

 

   2. Download and extract latest Eclipse Kepler (32 bit/64 bit based on your OS configuration)

     Eclipse IDE for Java EE Developers | Packages

 

Note: If you are accessing external URL using any proxy server, make sure to set those settings in eclipse kepler as well. Check "How to resolve this issue?" section in this blog. Do it for both HTTP & HTTPS.

 

  3.  Start Eclipse > Help>Install New Software

    

                         1.png

    • Make sure on your selection, click on "Next"

 

               2.png

 

    • Accept License Agreement, Click on "Finish"

 

               3.png

    • Restart the eclipse.

             

4.    Go to Preferences>SAP Mobile Platform Tools

 

 

          4.png

 

Note:

 

1. To Crate a OData project, select File>New>SAP Mobile Platform  OData Implementation Project

 

              5.png

2. To create an OData model, select "OData Model" available under "SAP Mobile Platform" as below

 

          6.png

Tips:

 

1. While setting up SMP server settings in Preferences, If i pass URL as https://smpserverIPAddress:8083 (even SMP server complete host name) it gives an error saying "Error during processing request on Operations server".

 

   

                              connection.png

Resolution:

 

Seems network proxy issue. Make sure to change proxy settings under Windows>Preferences>Network Connections How to bypass proxy settings in SMP workspace for connecting any public Web Service within corporate Network

 

 

Major Issues:

 

1. If a project name is like "ICRA_V1.1" then you can not deploy it to SMP server. As it says "Special Characters are not allowed in the Name". But if i replace 1.1 as 11, it works.

 

issu1.png

 

Note: There is no issue like that in Eclipse JUNO.

 

 

Hope you will find it useful.

 

Regards,

JK (@jkkansal1987)

In my recent blog

http://scn.sap.com/community/developer-center/mobility-platform/blog/2014/07/31/c-cross-platform-mobile-application-using-xamarin-form

I had written about SAP Mobile(Cross Platform) application in Purchasing using C# and Xamarin.  In this blog I would like to show how easy it is

to develop a mobile application (the code will run on  3 devices and runs natively - code generated by Xamarin).  Many SAP Client use HR and Expense processing. For Such Clients if we can provide a mobile app by which employees can post expenses directly to SAP and send paper receipt to their approver by SMS can significantly improve the efficiency expense process.

The SAP Transaction by which we Create Expenses is PR05.  The BAPI I used is BAPI_TRIP_CREATE_FROM_DATA. In my earlier blogs on Xamarin I have explained in great detail the process of Creating ABAP REST service which can be invoked from Mobile device.  I have written wrapper on this BAPI so that

the mobile device passes a subset of information that is required to Post Expenses. The images below show screen shots of the mobile app by which you can enter header(Employee Perner, date times, cost Center,company,bus area etc) and post an Expense

Image1.pngImage2.png

We have message on the device that we have posted trip 30077 .

Now we login in to check up SAP - Tcode PR05 for employee 100004 (IDES System)

 

flig5.png

 

Having Posted the expenses we would like to send the Image of the paper receipt to the approver by SMS. The images below show the screen

flig7a.png

 

 

 

By clicking the Button you can use the Camera on the device to take photograph of the recpit and send it to your

 

Sending SMS - Involves writing Dependency Service for each of the devices - You have create An interface in the PCL project and invoke that using code line shown below

 

var x = await DependencyService.Get().SendSMS("Kindly Approve My Expense ", Mobile);

 

In each of the device specific project you have implement the interface. In the header of this platform Specific program you have to have a line of code

[assembly: Dependency(typeof(SMSTask))]

This will ensure linking of the SMS call between the PCL Project and the platform specific project so the device specific SMS facility can used.

Hi All,

 

We have been knowing that SMP 3.0 is based on OData. To access any SAP & NON-SAP Backend (SOAP WS, Database & JPA) data services in SMP for developing any hybrid/native application there is a provision in SMP to convert those services into OData services with the help of SMP tool - Integration Gateway (GWPA). For example, I have created 3 different OData services with the help of below details:

 

 

Connection DetailsURLReference
SOAP WShttp://jk:8080/gateway/odata/sap/ArticleService;v=1Guide
Databasehttp://jk:8080/gateway/odata/sap/DeptHSQLDB;v=1Guide
SAP System (ODC)http://jk:8080/gateway/odata/sap/Bjoern_ODataProj;v=1Guide

 

 

Now i want to incorporate all above mentioned OData services in a single application id. How to do this? How to access information from all services? Here you go.


  1. Login to "Admin cockpit" https://jk:8083/Admin/
  2. Create a new application id: New>

    

     appIDCreation.PNG    

3. Under BACKEND tab, copy of the mentioned above URL. This URL would act as a PRIMARY Back-end Connections URL.


backEnd.PNG

4. To add another two URLs, Click on NEW button under Back-end Connections and provide connection name and respective URLs for both.

 

dB_connection.PNG

Note: If you are accessing any external resources through a proxy network, make sure to configure proxy settings in SMP server and select "Use System Proxy" option. Check this.

 

5. Under AUTHENTICATION tab, provide a security profile as per your wish. I have selected admin under EXISTING PROFILE

6. Once done, make sure connection to these services are successful from SMP server.

 

     ping.PNG

 

7. Open a REST Client. Next task is to register the application id. How to do that? You must get a "201 status code" on success.

 

       applicationIdCreation.PNG

8. Lets take some example for accessing data from different URLs.

 

8.1 From SOAP WS: ArticleService

 

    • As I have set ArticleService a primary URL so i can get it directly by calling a GET method as below.
    • For getting entity set "ArticleSet" details, replace URL with http://jk:8080/com.test.demo/ArticleSet
    • For POST, PUT, DELETE refer this blog. Make sure SMP 3.0 SP03 PL02 for doing these transactions.

 

GET.png

 

    8.2 To access database information

 

    • Since i have already added DATABASE connection details as one of the back-end connections so i have to add one more header X-SMP-BACKEND-URL to get its information,

                    GET.png  

    • At right hand side, DEPARTMENT is the only ENTITY SET for given database URL. To access its information add this at the end of backend URL.

 

               GET.png           

 

8.3 To access SAP netweaver gateway information

 

          GET.png

 

For POST, PUT, DELETE: Make sure you get a X-CSRF-TOKEN value in GET request and pass this value along with returned cookie values(in same GET method) for doing any transactions. For more info check : SMP 3.0 : REST API Application Development


NOTE: X-CSRF-TOKEN value is needed for the Odata services (have been converted using Integration Gateway) for doing any transactions.



I hope this blog will help you.Your comments and suggestions are most welcome.

 

Rgrds,

JK (@jkkansal1987)

Some times when we are setting up and testing a Odata service using Integration Gateway we may see the following error "Cannot load JDBC driver class 'com.microsoft.sqlserver.jdbc.SQLServerDriver'". Here is a workaround to resolve the issue.

 

Follow the below steps.

 

Step 1 : Create a SMPRun.bat file with the following steps

 

  net stop SAPSMP3Service

 

  taskkill /IM java.exe

 

  del C:\SAP\MobilePlatform3\Server\work\org.eclipse.virgo.nano.deployer\staging\com.microsoft.sqlserver.jdbc_1.0.0.jar

 

  del C:\SAP\MobilePlatform3\Server\pickup\.state\com.microsoft.sqlserver.jdbc_1.0.0.deploy.ok

 

  net start SAPSMP3Service

 

  pause

 

 

Step 2 : Save the SMPRun.bat file

 

Step 3: Right click SMPRun.bat file and Run the same. This will delete the existing jar file from staging folder and "com.microsoft.sqlserver.jdbc_1.0.0.deploy.ok" file from the .state folder

 

Step 4: Now test your web service, That will work.

 

Note: If you use MySQL or Oracle Database pls remove the respective files instead of sqlserver files mentioned in the above steps.



Cheers

Dear All,

 

There were a lot of speculation of that POST was not supported with SMP 3.0.3 and will be supported with PL02.

I with my friend, jitendra kansal figured out that it even works with SMP 3.0.3

 

The scenario we are testing are using SOAP Web Services.

 

Step 1.

 

Create an OData Model of your name choice.

Thing to note here is that we need to define all the input parameters of the Web Services as Keys.

 

This can be done by selecting a particular entity field and click on Properties tab and make Key as true.

It would be something like this

 

Screen Shot 2014-08-06 at 11.47.12 PM.png

 

Step 2 : Implement the service by right clicking on the Yourname.odata file and select Implement Service. This will create Yourname.odatasrv file.

Right click on the Yourname.odatasrv and choose Select Datasource. From the EntitySet select your Entity Set and choose operation as Create. Select the type of Datasource. Since we are using a Soap Service we choose SOAP Service as the Data source.

 

Screen Shot 2014-08-06 at 11.52.20 PM.png

Add the properties for the Operation like Endpoint, Port name, Operation name etc and click finish.

 

Step 3. Right Click on the Create Operation and choose Define Request Mapping

Map your entity sets with the fields.

 

Screen Shot 2014-08-06 at 11.56.09 PM.png

Similarly do the Response mapping and deploy the project on the SMP Server.

 

Step 4.  Go to the Advanced Rest Client on Chrome

 

give your url http://localhost:8080/gateway/odata/sap/NameofProject;v=1/MethodName

 

Choose GET

 

In the header section add a new header

x-csrf-token and value as fetch

 

Screen Shot 2014-08-07 at 12.00.16 AM.png

 

Click on Send. It will get you a X-CSRF-TOKEN in the response header.

 

Screen Shot 2014-08-07 at 12.01.13 AM.png

 

Copy this token.

 

Now click on the POST Radio button

 

For the x-csrf-token paste the value returned from the previous operation

Add a new header value Content-Type and choose value as application/xml

Screen Shot 2014-08-07 at 12.07.08 AM.png

 

 

In the Payload section add the below body

 

<?xml version="1.0" encoding="UTF-8"?>

<atom:entryxmlns:atom="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

<atom:content type="application/xml">

<m:properties>

<d:firstname>value</d:firstname>

<d:lastname>value</d:lastname>

<d:agriculturecardno>value</d:agriculturecardno>

<d:veterinarycardno>value</d:veterinarycardno>

<d:username>value</d:username>

<d:mobileno>value</d:mobileno>

<d:emailid>value</d:emailid>

<d:preferlang>value</d:preferlang>

<d:notificationflag>value</d:notificationflag>

<d:notes>value</d:notes>

<d:deviceType>value</d:deviceType>

</m:properties>

</content> </entry>

 

To verify if the payload is properly formatted or not go to the below site and paste your payload and check.

 

Free Online XML Formatter - FreeFormatter.com

 

Once its successful, paste the properly formatted payload and click on Send.

 

It will post the record in the database.

 

I hope this helps,

 

Thanks,

Best Regards,

Rakshit Doshi

Actions

Filter Blog

By author:
By date:
By tag: