Quantcast
Channel: SCN : All Content - SAP for Mobile
Viewing all 6147 articles
Browse latest View live

Error IPH6035 after upgrade to Afaria 7 SP5

$
0
0

HI!
I just upgraded our Afaria7SP4HF6 server to SP5.

Now, even all services are running fine, i am not able anymore to communicate with our iOS devices.

In the server log i can see folloging fault message whenever i try to send something (e.g."Lock Device"):

IPH6035: PutMDM Message Signing Validation Failure. UDID: xxx.

Also the afaria app on the ipones says communication established, the "last connection"-time of any device is from before the upgrade.

I applied sp5hf6 without any change.

I reverted the machine back to sp4 and applied lates sp4 hotfix (hf13), with same resulat.

When i restore the snapshot to previous version sp4hf6, everything runs fine again.

 

I guess it is somehow related to the communication with the ca-server.

Does anybody have a idea, what was changed in SP4HF14 and SP5 and causes our installation to stop working?


Overlay Screen is getting closed

$
0
0

Hi all,

 

I am trying to open an overlay screen just after when I click on finish button of an transaction screen. Now what is happening, when I click on finish an overlay screen appears and immediately gets closed along with the transaction screen. When I chose an normal detail screen instead overlay, it is working fine.

Can anybody tell me how to overcome this ?

 

Thanks in advance,

Sujit Ghanti

Fiori Theme : Unable to get theme parameters after theme customization in UI theme designer

$
0
0

Hi Experts,

 

I would like to customize the theme for my FIORI application. I followed the steps described in the document and applied all the specified SAP notes :

 

How to setup your company logo in SAP Fiori launchpad

 

After editing the logo when I build and saved it is saving properly as below:

 

 

img1.jpg

when I am trying to get the theme parameters from the t-code /n/UI5/THEME_TOOL, its not displaying the customized theme here :

 

img 2.JPG

And one more thing, if I opened the theme designer again its not showing the customized new theme in the available list :

img 3.JPG

 

As its not showing any parameters, I am unable to see the changes, Please help me out......

 

Regards,

Prasanna

Work Manager 6.1 for Android - Display notification pictures fetched during the transmit

$
0
0

Hi,

 

The standard solution only gets the list of attached pictures without the content. When the user taps on one entry, a push notification is created and the user will receive the picture data later on.

 

But this requires to be online, so I want to fetch the notification pictures during the transmit and then be able to display them without the need of push requests.

 

Overriding the Notification.java object addDocumentArrayList(ArrayList<DocumentLink> linkedDocuments) method, I'm able to read each picture binary content. I created a Z BAPI, calling the already existing BAPI wrapper /SMERP/CORE_DOBDSDOCUMENT_GET and I get the content for each document link existing for each notification.

 

My problem is that I don't know how exactly I should store this binary data and other attributes in the Agentry DocumentLink Object in order to be able to display the picture.

 

Having already the basic DocumentLink properties set by the standard, I just set the picture field with the contents read from SAP with the method setPicture() in base64. Something like this:

 

byte[] fileDataFromBAPI = getDataAsByteArray(documentBAPI.getBinaryContent());

String fileDataInBase64 = dl.encodeBase64(fileDataFromBAPI);

dl.setPicture(fileDataInBase64);

 

I also modified the rules in Agentry to not create the push request for the already read document.

 

But when I try to open this picture, I just get the following error, is like the client is trying to access to the picture physically in the device, where it is not:

 

 

Do you have any ideas of what should I do when I store the picture data to the document link object and then how should I display the picture in the Agentry client?

 

Thank you in advance.

 

- Marçal

Want to add header in the detail screen (Syclo agentry)

$
0
0

Hello experts,

 

Can a header be added in the detail screen?

I have used list tile view to display the customers list and tile display to display the customer details.

I want to add a header displaying the label as 'Total Customers' and the number of total customers available.

I have to display it for android platform.

Can anyone help me on this?

 

I am using Agentry 6.0.

P.S Everything has been done on detail screen and not on list screen.

 

Regards,

Bino

Agentry - Preload Child Collection Before Add Transaction

$
0
0

I want to preload a child collection before the parent object's add transaction.  I'm using this preloaded child collection to create a checkbox list in a list tile control.  Is there a way to execute a read step before the add transaction?

Cannot Generate SRA002_TIMESHEET_SRV time entry

$
0
0

Hi All,

 

   I am trying to enhance the Time Entry SRA002_TIMESHEET_SRV service. When I click the Generate button I am getting an error as below.

"Property 'Counter' is a key and must set nullable to false".  Can you please suggest how to resolve it.

 

Timeentry.PNG

 

Thanks,

Gopi Nidjelli

Fiori Leave Request - No Workflow

$
0
0

Hello,

 

Our scenario is this: We do not use Workflow for Leave Requests. Currently we use CATS2(GUI) to enter Leave and the manager assigned through OM approves the leave request through CATS_APPR_LITE or CATS_DA. 

 

We have installed and tried to configure Fiori My Leave Requests without workflow. The user can enter leave, but the approver is unable to see the request in CATS_APPR_LITE or CATS_DA.

 

Any ideas?


Fiori: Customizing My Leave Requests App (Field/Button Removal)

$
0
0

Hello,

 

I have been tasked with working on our fiori deployment with one of our Basis admins and have started to get my feet wet with customizing apps. Currently, I am looking at the My Leave Requests App, and performing some simple extensiblity in order to gain some understanding. With the standard My Leave Requests, there are Start/End Time fields that we do not require, and will replace these with a simple duration field (number of hours requested).

 

I am attempting to make these form fields not visible through the Component.js file. I have downloaded the original hcm_lr_cre application locally, and renamed it to zhcm_lr_cre for customer namespace purposes.

 

In the component.js file, I have added the following block of code:

 

Capture1.png

 

Here, I am trying to hide a couple of fields: The entitlements button (in retrospect, I may have to re-visit and do a custom view to show account banks in the manner our current Portal Time Off From Work app does), and the start/end time labels and datetime inputs.

 

After making the following changes, I have uploaded the application back up. In the launchpad designer, i created a Tile and Mapping that points to this new application:

 

Capture2.png

 

Capture3.png

 

Lastly, I have went into LPD_Cust, and created a new Launchpad to house our customized applications, and have registered the application within this launchpad:

 

Capture4.png

 

As far as my understanding goes, I shouldn't have to do anything model/service related, as it should use the standard deployment, as these have not changed in the file itself, correct?

 

The problem that I am having here is that when i run this application, the fields still persist.

 

Capture5.PNG

As far as i can tell, the correct application is being called, as this screen indicates my url for the customized application in Google Developer Tools Console.

 

Any insight that can be provided regarding this issue would be greatly appreciated!

 

Brian

Getting Started with Kapsel - Part 16 -- End-to-End Trace

$
0
0

          sap-logo.png

End-to-End Trace (New in SP05)

This plugin enables the tracing of HTTP calls made within a Kapsel application.  This trace information is updated to the SMP server which then forwards it on to a Solution Manager installation specified in the management cockpit under Settings > System > Solution Manager URL.  See also End-to-End Analysis Overview.  For additional details on the cache manager plugin see the JavaScript file in a project that includes this plugin at

project_name\plugins\com.sap.mp.cordova.plugins.etetrace\www\etetrace.js

or the JS Documentation at Kapsel End-to-End Trace Plugin API Reference. The following steps will demonstrate how to modify the sample used in the Logon section to enable and disable the capturing of the Kapsel End-To-End Trace plugin.

  • Add the e2etrace plugin.
    cordova -d plugin add com.sap.mp.cordova.plugins.e2etrace
  • Add a the following HTML just above the table tag in
    C:\Kapsel_Projects\LogonDemo\www\index.html
    This will add ability to start, stop, set the trace level and upload the trace log to the SMP server.
    <br><button id="start" onclick="sap.E2ETrace.startTrace('DansETEKapselTrace');">Start Trace</button><button id="stop" onclick="sap.E2ETrace.endTrace();">End Trace</button><br><button id="upload" onclick="sap.E2ETrace.uploadTrace(uploadTraceSuccess, errorCallback);">Upload Trace</button>
    Add the following JavaScript method used by the uploadTrace method.
    function uploadTraceSuccess() {    alert("Trace successfully uploaded");
    }
  • In the management cockpit, Under Settings > System > Solution Manager Settings, specify the URL to the Solution Manager where the captured trace information will be sent and check Enabled for End to End Tracing.
    image1.PNG

    The XML file can be captured by using a program like TcpTrace if you do not have access to Solution Manager.

  • Copy the files to the platform directory by running
    cordova -d prepare
  • Use the Android IDE or Xcode to deploy and run the project. 

  • The following is the captured XML that would be sent to Solution Manager after pressing Start Trace, Read, End Trace, Upload Trace.
    Note that the log level is increased to debug after starting a trace and is returned to the previous log level when the trace is ended.
    <?xml version="1.0" encoding="UTF-8"?>
    <BusinessTransaction clientType="Mobile" id="946c1ae53e64437f8ce4679801f3248f" name="DansETEKapselTrace" time="20.08.2014 14:57:11.977 UTC" xmlVersion="7.1.10">
        <ClientInformation>SMPClientSDK 3.5.0-sap-07 Android</ClientInformation>
        <TransactionStep id="946c1ae53e64437f8ce4679801f3248f-1" name="Step-1" reqType="http" time="20.08.2014 14:57:11.977 UTC" traceflags="0d9f">
          <Message dsrGuid="f51f88a04195404cb2d3d73e6abc29d1" id="1" name="Message-1">
              <duration>1357</duration>
              <firstByteReceived>20.08.2014 14:57:16.615 UTC</firstByteReceived>
              <firstByteSent>20.08.2014 14:57:15.258 UTC</firstByteSent>
              <lastByteReceived>20.08.2014 14:57:16.615 UTC</lastByteReceived>
              <lastByteSent>20.08.2014 14:57:15.258 UTC</lastByteSent>
              <rcvd>12289</rcvd>
              <requestHeader>GET
    http://10.7.171.196:80/com.mycompany.logon/CarrierCollection?$format=json
                SAP-PASSPORT: 2A5448...
                  MaxDataServiceVersion: 3.0
                  Authorization: Basic ***************
                  Accept: application/atomsvc+xml;q=0.8, application/json;odata=fullmetadata;q=0.7, application/json;q=0.5, */*;q=0.1
                  X-CorrelationID: f51f88a04195404cb2d3d73e6abc29d1-1-1
                  X-SMP-APPCID: d903c252-8d59-4355-8c2c-98415be34f28
              </requestHeader>
              <requestLine>GET
    http://10.7.171.196:80/com.mycompany.logon/CarrierCollection?$format=json</requestLine>
              <responseHeader>server: SAP
                ntcoent-length: 12289
                dataserviceversion: 2.0
                etag: version 01
                Date: Wed, 20 Aug 2014 14:57:48 GMT
                Transfer-Encoding: chunked
                Content-Type: ap
                ab
                plication/json;charset=utf-8
              </responseHeader>
              <returnCode>200</returnCode>
              <sent>0</sent>
          </Message>
        </TransactionStep>
    </BusinessTransaction>



Back to Getting Started With Kapsel

 

 

Mobile/Fiori application for MMBE transaction

$
0
0

Hi All,

 

We are looking for any standard mobile app (ios/android) to display the material stock as displayed via transaction MMBE. We have tried using the Fiori app "Check Price and Availability" we are able to see the products for the desired customer and while checking the availability it is always displaying available, immaterial of the quantity we are checking. It seems this app is simulating SO creation in backend for the defined product and quantity and if it is successful to simulate the SO it displays it as available. As per the system configuration there is no quantity control check at time of SO creation, thus we are not getting what was intended.

 

Can any one please suggest if there is any standard app for transaction MMBE or is it possible to extend the Check Price and Availability to include the quantity check and display availability based on plant and storage locations.

 

Regards,

Rahul

Fiori My Pay stubs app

$
0
0

Hello Experts,

 

Out of the box, what is the date displayed on the Fiori My Paystubs app ? Is it payment date (on which the employee's bank account is deposited) or the pay period end date ? (Please refer to the screenshot attached)

 

These dates can be different in certain scenarios.

 

Capture.JPG

Thank you,

Nagur Kanna

Getting Started with Kapsel - Part 15 -- Offline OData (New in SP05)

$
0
0

http://scn.sap.com/servlet/JiveServlet/downloadImage/333927/sap-logo.png

 

 

Offline OData

The Kapsel Offline OData plugin enables an OData version 2.0 based application to be used when a device or emulator is offline by creating a store on the device.

store = sap.OData.createOfflineStore(properties);
store.open(openStoreSuccessCallback, errorCallback);

Once the store is open and the custom OData client is applied with the following call, all calls made using the datajs library are routed to the offline store.

sap.OData.applyHttpClient();

A set of defining requests specify the data that will populate the offline store.

definingRequests : {  contacts     : "/ContactSet?$expand=ToContactDetails",  customers    : "/CustomerSet",  regions      : "/RegionSet",  departments  : "/DepartmentSet",  countries    : "/CountrySet",  jobfunctions : "/JobFunctionSet"
}

The data that will be updated when a device is offline should ideally be data that multiple offline users are not simultaneously updating.  If possible, partition the data to the subset required by each user.  Technically, the offline store has a 16 GB limit but the initial download time, database size and refresh times can be affected by the amount of data being stored on the device.  Adding OData filters to the defining requests to limit the data on the device to the subset of data required is one technique to do this.

 

An offline store can only be used with one OData service.  For example, one offline store could be associated with one service such as http://services.odata.org/V2/OData/OData.svc/ or http://services.odata.org/V2/Northwind/Northwind.svc/ but not both.

 

Once the offline store has been created, changes made to it can be sent to the SMP server via a call to store.flush().  The offline store can update its copy of the data by calling store.refresh().  These calls are independent of each other and are asyncronous calls so they could be run at the same time.  The offline store files can be seen at \data\data\com.mycompany.offline2\files when running in an Android emulator as shown below.image9.PNG

 

 

 

All datajs calls are redirected to the offline store after sap.OData.applyHttpClient() is called.  The customHttpClient can be removed by calling sap.OData.removeHttpClient().

 

In SMP 3.0 SDK SP06, $value requests which are used for binary data are not supported.  OData function imports are also not supported as the service metadata document does not describe what changes occur as a result of calling them.  See also Offline OData Version Support for further details on supported features.  For additional details on the Offline OData plugin see the JavaScript file in a project that includes this plugin at

project_name\plugins\com.sap.mp.cordova.plugins.odata\www\OData.js

or the JS Documentation at Kapsel Offline OData Plugin API Reference.

 

The following samples will help demonstrate the Kapsel Offline OData plugin.

 

OData Based App
This is a simple OData based app that demonstrates how it cannot read data while the device is offline.

 

OData Based App with the Kapsel Offline OData Plugin
The Offline OData plugin is added to the project to enable the accessing of OData when device is offline.

 

Offline enabled App with Create, Update, Delete, Access to the Error Archive
Adds CRUD operations (create, update, delete) and how failed updates are recorded in the ErrorArchive.

 

Sample that Switches to Offline Usage once the Network is Unavailable and uses Logon Plugin
This sample shows how an application may switch to using an offline store automatically when network connectivity is lost.

 

Sample that Defines Relationships using $expand
How to use $expand to define relationships between entities when the OData service does not make use of referentialcontraint.

 

Additional Settings
Demonstrates encryption of the offline store, refreshing a subset of data and use of refresh interval.

 

Troubleshooting

OData Based App

The following steps will create a simple OData based app that does not use the Kapsel Offline OData plugin.

  • Create the project.
    cordova -d create C:\Kapsel_Projects\OfflineDemo com.mycompany.offline OfflineDemo "{\"plugin_search_path\":\"C:/SAP/MobileSDK3/KapselSDK/plugins/\"}"
    cd C:\Kapsel_Projects\OfflineDemo
    cordova -d platform add android
    
    cordova -d create ~/Documents/Kapsel_Projects/OfflineDemo com.mycompany.offline OfflineDemo "{\"plugin_search_path\":\"/Users/i826567/SAP/MobileSDK3/KapselSDK/plugins/\"}"
    cd ~/Documents/Kapsel_Projects/OfflineDemo
    cordova -d platform add ios
  • Replace C:\Kapsel_Projects\OfflineDemo\www\index.html with the sample code for products.html from the OData appendix.
    Download the latest datajs file (datajs-1.1.2.min.js) from datajs and place it in the www folder.

  • Modify the variable smpServerHost in index.html to point to your SMP server.

  • Copy the files to the platform directory by running
    cordova -d prepare
  • Use the Android IDE or Xcode to deploy and run the project.
    image1.PNG

    Notice that the application displays products data from the OData producer at http://services.odata.org/V2/OData/OData.svc/Products.

    To see additional details of this service, examine the service metadata document at http://services.odata.org/V2/OData/OData.svc/$metadata.

    Now turn on Airplane mode, close the app and reopen it.
    After the default timeout period, an error will appear.
    image2.PNG

    Airplane mode can be turned on in the following manner.
    On Android choose Settings > More > Airplane mode.
    On an iOS device choose Settings > Airplane Mode.
    On an iOS simulator, unplug the Ethernet cable or turn off the WI-FI for the Mac hosting the simulator.

OData Based App with the Kapsel Offline OData Plugin

The following steps will enable the app to be used when the device or simulator is online or offline.

  • Add the Kapsel Offline OData plugin and the Cordova network information plugin.
    cordova -d plugin add com.sap.mp.cordova.plugins.odata
    cordova plugin add org.apache.cordova.network-information
  • The Offline OData plugin requires that the OData source is proxied through the SMP server.  Follow the steps shown in Configuring a Kapsel App in the Management Cockpitto create an Application with the application ID of
    com.mycompany.offline
    Set the endpoint to be the following URL
    http://services.odata.org/V2/OData/OData.svc
    Choose the default authentication profile for the app.

  • Replace www/index.html with the contents of index1.html.

  • Modify the variable smpServerHost in index.html to point to your SMP server.

  • Copy the files to the platform directory by running
    cordova -d prepare
  • Use the Android IDE or Xcode to deploy and run the project.

    Note that the Offline OData plugin does not support Android Intel Atom (x86) emulators.

    Turn off airplane mode and click on Register, Open Offline Store.
    Exit the app.
    Place the device back into airplane mode.
    Reopen the app and click on Open Store, and then Read.
    image3.PNGimage4.PNG

    Notice that the app now returns the results using the data retrieved from the local store and does so much quicker since a network request is not needed to retrieve the results.

Offline enabled App with Create, Update, Delete and Access to the Error Archive

The following steps will extend the app to enable create, update and delete operations and will also display the contents of the ErrorArchive which contains any error that occurred during a flush which attempts to send locally made changes on the device to the OData producer.

Note, there is an incompatibility around escaping backslashes in a JSON payload that causes the flush operation against services.odata.org to fail.  This issue will be fixed in SMP 3.0 SDK SP05 PL03 patch or SP06.

Note, that this example uses a partial service endpoint in the management cockpit.  IE, the endpoint specified is http://services.odata.org instead of http://services.odata.org/V2/(S(readwrite))/OData/OData.svc/.  The full URL causes a redirect to a new URL that contains the URL with a session id in it.

Note, that the temporary OData session ID can be reset in this example by clicking on Clear Offline Store, Unregister, Register, and then Read or Open Store.

  • http://services.odata.org provides an updateable service. Enter the following URL into a browser to generate a temporary link to the updateable service.
        http://services.odata.org/V2/(S(readwrite))/OData/OData.svc/
        Notice that it has S(session_id) and it is V2 for OData version 2.0.

  • In the management cockpit create a new application with an ID of com.mycompany.offline2, an endpoint of http://services.odata.org

  • Create the project.
    cordova -d create C:\Kapsel_Projects\OfflineDemo2 com.mycompany.offline2 OfflineDemo2 "{\"plugin_search_path\":\"C:/SAP/MobileSDK3/KapselSDK/plugins/\"}"
    cd C:\Kapsel_Projects\OfflineDemo2
    cordova -d platform add android
    
    cordova -d create ~/Documents/Kapsel_Projects/OfflineDemo2 com.mycompany.offline2 OfflineDemo2 "{\"plugin_search_path\":\"/Users/i826567/SAP/MobileSDK3/KapselSDK/plugins/\"}"
    cd ~/Documents/Kapsel_Projects/OfflineDemo2
    cordova -d platform add ios
  • Add the Kapsel Offline OData plugin and the Cordova network information plugin.
    cordova -d plugin add com.sap.mp.cordova.plugins.odata
    cordova plugin add org.apache.cordova.network-information
  • Replace C:\Kapsel_Projects\OfflineDemo2\www\index.html with the contents of index2.html.

  • Modify the variable smpServerHost in index.html to point to your SMP server.

  • Copy the files to the platform directory by running
    cordova -d prepare
  • Use the Android IDE or Xcode to deploy and run the project.

    Note that the Offline OData plugin does not support the Android Intel Atom (x86) emulators.

    Select Register and then Read to get a new temporary URL for  the OData service.
    Note products can now be added to the list, removed or modified.  This can occur when the device is online or if it is offline, then when the device is online and the Flush button is pressed, the changes are sent to the OData producer.
    image5.PNG

  • Details of any problems sending the changes made when the device was offline to the OData producer can be viewed in the ErrorArchive.  The following steps can be followed to introduce an error.
    With the offline store open, perform a read.  Update the price of bread from 2.50 to 2.99.
    Close the offline store.
    Perform a read and notice the price of bread is 2.50 since the change made with the store closed was not flushed.
    Delete bread from products.
    Open the offline store and perform a read.  Notice that bread appears in products and the price is 2.99.
    Flush the offline store which will cause an error as the previously deleted product bread cannot have it price updated.
    Click on Check Errors to view the contents of the ErrorArchive.  On this screen, the ability to remove the error is provided. 
    image6.PNG

    Additional functionality could be provided to modify the operation and retry it if the problem was an update issue such as one where two different users both modified the same record.
    Note that services.odata.org does not use ETags so the last update wins.  See also Offline OData Conflicts and Errors and ETag.

Sample that Switches to Offline Usage once the Network is Unavailable and uses Logon Plugin

The following sample listens to online and offline notifications.  When the app starts, the offline store is opened, and if it is online the store is refreshed.  While the device is online, the offline store is not used.  When the device is offline, the OData requests are redirected to the open online store as the sap.OData.applyHttpClient() method is called when the device switches to offline.  When the device regains network connectivity, the method sap.OData.removeHttpClient() is called.

If this application performed updates rather than simply reading the data, it might make sense to call refresh following create, update or delete operations so the offline store is always up to date.
Instead of the offline store only being used when the device is offline, another approach is to have the app always use the offline store and to make refresh and flush calls as appropriate.
Additional code could be added to ask the user if it is ok to perform the refresh, or perhaps to check if Wi-Fi is being used and then only perform the refresh.

Unlike the previous two examples, this app uses the Logon plugin to perform the registration with the SMP 3.0 server.  It should be noted that
Follow the below steps to try it out.

  • Create the project.
    cordova -d create C:\Kapsel_Projects\OfflineDemo3 com.mycompany.offline3 OfflineDemo3 "{\"plugin_search_path\":\"C:/SAP/MobileSDK3/KapselSDK/plugins/\"}"
    cd C:\Kapsel_Projects\OfflineDemo3
    cordova -d platform add android
    
    cordova -d create ~/Documents/Kapsel_Projects/OfflineDemo3 com.mycompany.offline3 OfflineDemo3 "{\"plugin_search_path\":\"/Users/i826567/SAP/MobileSDK3/KapselSDK/plugins/\"}"
    cd ~/Documents/Kapsel_Projects/OfflineDemo3
    cordova -d platform add ios
  • Replace C:\Kapsel_Projects\OfflineDemo3\www\index.html with the contents of index3.html.

  • Modify the variable smpServerHost in index.html to point to your SMP server.

  • Add the Kapsel and Cordova plugins.
    cordova -d plugin add com.sap.mp.cordova.plugins.logon
    cordova -d plugin add com.sap.mp.cordova.plugins.odata
    cordova plugin add org.apache.cordova.network-information
  • Copy the files to the platform directory by running
    cordova prepare
  • Use the Android IDE or Xcode to deploy and run the project.

    image7.PNG

Sample that Defines Relationships using $expand

The definition of a service can be examined by opening the following URL.  http://services.odata.org/V2/OData/OData.svc/
This shows that there are three collections available named Products, Categories and Suppliers. For further details see the following URL.  http://services.odata.org/V2/OData/OData.svc/$metadata
Notice that Products is defined as an EntityType of OData.Product and it has a set of NavigationProperties.  Specifically it defines that a Product has a Supplier and a Product has a Category.  When the offline store is created it needs to know about these relationships to correctly create the tables and relationships between the tables.  If the metadata does not specify a referentialconstraint as this service does not, the defining requests will need to use the $expand format to specify how the tables are related.  This is explained in more detail at Using Defining Requests to Build Entity Relationships
The following example will attempt to illustrate this.
The following sample displays a table of categories as links that when clicked on shows the products in the clicked on category and the supplier of the product.  To make this data available when the device is offline, we need all three entities.  The following defining requests were used initially when creating this sample.

"definingRequests" : { //the below requests will be used to populate the offline store    "CategoriesDR" : "/Categories",     "ProductsDR" : "/Products",         "SuppliersDR" : "/Suppliers"    
}

Then the following query could be used to retrieve the Categories.

/Categories?$orderby=Name desc

When a category is clicked on a second query can be performed to return the products and supplier information for a given category.  Here are a couple of queries that could be used.

/Products?$expand=Supplier,Category&$filter=Category/ID eq 0&$orderby=Name desc
or
/Categories(1)/Products?$expand=Supplier&$orderby=Name desc

Unfortunately, the above queries returns 0 results when the offline store is open since the relationships between the entities are not defined with ReferentialContaint.  See also ReferentialConstraint Element
Since we are not able to change the OData service, the relationships can be specified by using expand in the defining requests as shown below.

"definingRequests" : { //the below requests will be used to populate the offline store    "CategoriesDR" : "/Categories?$expand=Products/Supplier"    //"ProductsDR" : "/Products?$expand=Category,Supplier"  //this also works
}

Try out the complete example by following the below steps.

  • Create the project.
    cordova -d create C:\Kapsel_Projects\OfflineDemo4 com.mycompany.offline4 OfflineDemo4 "{\"plugin_search_path\":\"C:/SAP/MobileSDK3/KapselSDK/plugins/\"}"
    cd C:\Kapsel_Projects\OfflineDemo4
    cordova -d platform add android
    
    cordova -d create ~/Documents/Kapsel_Projects/OfflineDemo4 com.mycompany.offline4 OfflineDemo4 "{\"plugin_search_path\":\"/Users/i826567/SAP/MobileSDK3/KapselSDK/plugins/\"}"
    cd ~/Documents/Kapsel_Projects/OfflineDemo4
    cordova -d platform add ios
  • Add the Kapsel Offline OData plugin and the Cordova network information plugin.
    cordova -d plugin add com.sap.mp.cordova.plugins.odata
    cordova plugin add org.apache.cordova.network-information
  • Replace C:\Kapsel_Projects\OfflineDemo4\www\index.html with the contents of index4.html.

  • Modify the variable smpServerHost in index.html to point to your SMP server.

  • Copy the files to the platform directory by running
    cordova -d prepare
  • Use the Android IDE or Xcode to deploy and run the project.
    Press Register > Read > Electronics
    image11.PNG

Additional Settings

The following section provides examples of some additional settings that can be set.
Encrypting the Offline Database
Refreshing a Subset of the Offline Data
Prepopulate Offline Database and Refresh Interval of Shared Data

Encrypting the Offline Database

To encrypt the data in the offline stores, specify an encryption key.  Without this, it is possible on an Android or iOS simulator to access the UltraLite database files and view the data as shown below.
image10.PNG

 

The following option can be provided when opening the store to encrypt the stores using AES-256.

var options = {    "storeEncryptionKey" : "myVerySecretKey123!"    //"storeEncryptionKey" : applicationContext.registrationContext.password //if using the Logon plugin, the user entered password for the registration can be used if it never changes
};
store.open(openStoreSuccessCallback, errorCallback, options);

A better solution than hardcoding the password would be to generate a random password and then to store it in the datavault provided by the Logon plugin.  Here is an example of how that might look.

var otp = null;  //one time password.  Must be set once the first time the app starts

function logonSuccessCallback() { 
    getOneTimePassword();    ...
}

function getOneTimePassword() {
    sap.Logon.get(getSuccess, errorCallback, "key");
}

function set(val) {
    sap.Logon.set(getSuccess, errorCallback, "key", val);
}

function getSuccess(val) {
    if (val == null) {            set(Math.random().toString(36).substring(16));            return;    }    otp = val;
}

function openStore() {
    ...    var options = {        "storeEncryptionKey" : otp    };    store.open(openStoreSuccessCallback, errorCallback, options);

Refreshing a Subset of the Offline Data

When performing a refresh, if it is only a subset of the data that changes often, in the refresh call it is possible to specify which defining requests should be refreshed.  Assume the application has the following defining requests.

"definingRequests" : { //the below requests will be used to populate the offline store    "CategoriesDR" : "/Categories",     "ProductsDR" : "/Products",        "SuppliersDR" : "/Suppliers"
}

To only refresh the Products and Suppliers, the following call could be made.

store.refresh(refreshStoreCallback, errorCallback, ["SuppliersDR", "ProductsDR"]);

Prepopulate Offline Database and Refresh Interval of Shared Data

The database used on the device to store the offline data is created and optionally initially populated on the SMP server before it is sent to the device the first time the store is opened.  This can speed up the time taken when the offline store opens for the first time.  As well if the data is cached in the SMP server, calls to refresh the data from the device will use the cached data in the SMP server rather than making requests to the OData producer.
Assume the application has the following defining requests.

"definingRequests" : { //the below requests will be used to populate the offline store    "CategoriesDR" : "/Categories",     "ProductsDR" : "/Products",        "SuppliersDR" : "/Suppliers"
}

Also assume that the following application configuration file is specified in the management cockpit under Applications > com.mycompany.offline > Import Settings

[endpoint]
Name=com.mycompany.offline
prepopulate_offline_db=Y
prepopulate_offline_db_interval=1440

[defining_request]
name=CategoriesDR
is_shared_data=Y
refresh_interval=1440
track_deltas=NEVER
delta_token_lifetime=0

[defining_request]
name=ProductsDR
is_shared_data=Y
refresh_interval=1440
track_deltas=NEVER
delta_token_lifetime=0

[defining_request]
name=SuppliersDR
is_shared_data=Y
refresh_interval=1440
track_deltas=NEVER
delta_token_lifetime=0

The above configuration file specifies that the offline database is prepopulated and filled with data that is at most less than one day old (1440 minutes = 60 minutes * 24 hours).
It also indicates that if the mobile device requests a refresh operation and the data on the server is less than one day old, the SMP server uses the cached data rather than contacting the OData producer.

Note, these options are further explained at Defining an Application Configuration File with Defining Requests.

Troubleshooting

When the store fails to open or fails during a flush or refresh, additional details regarding the error can often be seen in one of three log files; the SMP server log file, the JavaScript console or the device log.
The Offline component of the SMP server should have its log level increased when debugging.

 

image8.PNG

 

The SMP server's log file is located at

C:\SAP\MobilePlatform3\Server\log\YKFN00528072A-smp-server.log

The JavaScript console log can also be useful to monitor. To do so, Open Chrome and press Ctrl Shift I when using an Android 4.4 emulator or device or use Safari on a Mac and choose Develop iPhone Simulator or device.  See also Debugging Appendix.
Finally the Android or iOS log can also be useful.

 

The following are some examples of error conditions and the associated logged messages for these problems.

Version 3 OData Endpoint used with store.open

The endpoint in the management cockpit was modified from

http://services.odata.org/V2/OData/OData.svc
to
http://services.odata.org/V3/OData/OData.svc

JavaScript console from debugging an Android device.

store.open called at 14:20.20 index.html:270
An error occurred "Unknown network error occured" index.html:69
 Device is ONLINE 

Android LogCat Output

10-29 14:20:20.538: I/chromium(16869): [INFO:CONSOLE(270)] "store.open called at 14:20.20", source: file:///android_asset/www/index.html (270)
10-29 14:20:25.653: E/SMP_ODATA(16869): Failed to open store
10-29 14:20:25.653: E/SMP_ODATA(16869): com.sap.smp.client.odata.exception.ODataNetworkException: Unknown network error occured
10-29 14:20:25.653: E/SMP_ODATA(16869):      at com.sap.smp.client.odata.offline.ODataOfflineStore.openStoreSync(ODataOfflineStore.java:500)
10-29 14:20:25.653: E/SMP_ODATA(16869):      at com.sap.smp.client.odata.offline.ODataOfflineStore$OpenStoreWithOptionsThread.run(ODataOfflineStore.java:406)
10-29 14:20:25.653: E/SMP_ODATA(16869): Caused by: com.sap.smp.client.odata.offline.ODataOfflineException: [-10210] The operation failed due to an error on the server.
10-29 14:20:25.653: E/SMP_ODATA(16869):      ... 2 more

Here are some snippets from the SMP server log file.

2014 10 29 14:20:37#0-400#ERROR#com.sap.mobile.platform.server.mobilink.SessionLogger##anonymous#Thread-213###[-100099] An error occurred while parsing the metadata document for service "https://10.7.171.223:8080/com.mycompany.offline" com.sap.odata.offline.util.MODataException: [-100099] An error occurred while parsing the metadata document for service "https://10.7.171.223:8080/com.mycompany.offline"
...
Caused by: org.apache.olingo.odata2.api.ep.EntityProviderException: Invalid or missing namespace for 'Schema'.

Incorrect properties passed to store.open

Notice that the serviceRoot is incorrect.  It has an x added to the end of value.  The service root should be a connection name such as com.mycompany.offline.

var properties = {    "name": "ProductsOfflineStore",    "host": smpServerHost,    "port": smpServerPort,    "https": smpServerProtocol == "https",    "serviceRoot" :  "com.mycompany.offlinex",    "streamParams" : "custom_header=Authorization:" + authStr + ";",    "definingRequests" : {        "ProductsDR" : "/Products"    }
};
store = sap.OData.createOfflineStore(properties);

JavaScript console from debugging an iOS simulator.

[Log] store.open called at 11:10.06 (index.html, line 270)
[Log] An error occurred "[-10210] The operation failed due to an error on the server." (index.html, line 69)
[Log]  Device is ONLINE (index.html, line 264)

Here are some snippets from the SMP server log file.

2014 10 29 11:09:38#0-400#INFO#com.sap.mobile.platform.server.mobilink.SessionLogger##anonymous#Thread-229####null#null#null#info#Offline#null#null#18730952-12fa-4f42-b611-21b1468c5051#null#1414609778664#null#com.sap.mobile.platform.server.mobilink.SessionLogger:info#Service root: https://10.7.171.223:8080/com.mycompany.offlinex#null#385#null#28#null |
...
2014 10 29 11:09:38#0-400#INFO#com.sap.mobile.platform.server.mobilink.SessionLogger##anonymous#Thread-229####null#null#null#info#Offline#null#null#18730952-12fa-4f42-b611-21b1468c5051#null#1414609778745#null#com.sap.mobile.platform.server.mobilink.SessionLogger:info#Sending HTTP GET "https://10.7.171.223:8080/com.mycompany.offlinex/$metadata"#null#385#null#89#null |
2014 10 29 11:09:38#0-400#ERROR#com.sap.mobile.platform.server.mobilink.SessionLogger##anonymous#Thread-229###[-100025] An error occurred while communicating with the OData server to retrieve the result of request "https://10.7.171.223:8080/com.mycompany.offlinex/$metadata" com.sap.odata.offline.util.MODataException: [-100025] An error occurred while communicating with the OData server to retrieve the result of request "https://10.7.171.223:8080/com.mycompany.offlinex/$metadata"
...
Caused by: com.sap.odata.offline.util.MODataException: [-100010] Retrieve metadata failed because the OData server returned HTTP code, 404, with message: null

Incorrect Credentials Passed to store.open

Notice the addition of 123456 to the authorization header

var properties = {    "name": "ProductsOfflineStore",    "host": smpServerHost,    "port": smpServerPort,    "https": smpServerProtocol == "https",    "serviceRoot" :  appID,    //There is a cookie store for JavaScript which is different from the Java one used by the Offline plugin    "streamParams" : "custom_header=Authorization:123456" + authStr + ";custom_header=X-SMP-APPCID:" +  appCID + ";",    "definingRequests" : {        "ProductsDR" : "/Products"    }
};    
store = sap.OData.createOfflineStore(properties);

JavaScript Console from debugging an Android device.

store.open called at 13:53.33 index.html:270
An error occurred "Unknown network error occured" index.html:69
 Device is ONLINE 

Android LogCat Output

10-29 13:53:33.651: I/chromium(754): [INFO:CONSOLE(270)] "store.open called at 13:53.33", source: file:///android_asset/www/index.html (270)
10-29 13:53:56.713: E/SMP_ODATA(754): Failed to open store
10-29 13:53:56.713: E/SMP_ODATA(754): com.sap.smp.client.odata.exception.ODataNetworkException: Unknown network error occured
10-29 13:53:56.713: E/SMP_ODATA(754):      at com.sap.smp.client.odata.offline.ODataOfflineStore.openStoreSync(ODataOfflineStore.java:500)
10-29 13:53:56.713: E/SMP_ODATA(754):      at com.sap.smp.client.odata.offline.ODataOfflineStore$OpenStoreWithOptionsThread.run(ODataOfflineStore.java:406)
10-29 13:53:56.713: E/SMP_ODATA(754): Caused by: com.sap.smp.client.odata.offline.ODataOfflineException: [-10207] Communication with the server failed due to invalid authentication
10-29 13:53:56.713: E/SMP_ODATA(754):      ... 2 more

Here are some snippets from the SMP server log file.

2014 10 29 13:53:59#0-400#ERROR#com.sap.mobile.platform.server.coreservices.configuration.service.ApplicationConnectionServiceImpl##anonymous#http-bio-8080-exec-10####null#null#null#error#Registration#null#null#ddafa3cc1fa24acab78726e30bd48967#null#1414619639774#null#com.sap.mobile.platform.server.coreservices.configuration.service.ApplicationConnectionServiceImpl:isAppConnInputValid#Invalid application connection#null#644#null#0#null |
2014 10 29 13:53:59#0-400#ERROR#com.sap.mobile.platform.server.online.filter.application.SMPApplicationSecurityFilter##anonymous#http-bio-8080-exec-10####null#null#null#error#Other#null#null#ddafa3cc1fa24acab78726e30bd48967#null#1414619639774#null#com.sap.mobile.platform.server.online.filter.application.SMPApplicationSecurityFilter:doFilter#Application connection is not found::null#null#644#null#1#null |

SMP Server not reachable during a Flush or Refresh

JavaScript Console output from debugging an iOS simulator.

[Log] store.flush called at 10:58.56 (index.html, line 537)
[Log] An error occurred "[-10060] An error occurred while performing a synchronization.  Reason: -1305 (MOBILINK_COMMUNICATIONS_ERROR) %1:220 %2:The operation couldn't be completed. Connection refused %3:61" (index.html, line 95)
[Log]  Device is ONLINE (index.html, line 531)

Network Disconnected during a Flush or Refresh

JavaScript Console output from debugging an iOS simulator.

[Log] store.open called at 10:12.04 (index.html, line 537)
[Log] Store opened in  0.694 seconds at 10:12.04 (index.html, line 537)
[Log] Store is OPEN. Device is ONLINE (index.html, line 531)
[Log] store.refresh called at 10:12.10 (index.html, line 537)
[Log]  Device is OFFLINE (index.html, line 531)
[Log] An error occurred "[-10060] An error occurred while performing a synchronization.  Reason: -1305 (MOBILINK_COMMUNICATIONS_ERROR) %1:220 %2:The operation couldn't be completed. Network is unreachable %3:51" (index.html, line 95)
[Log]  Device is OFFLINE (index.html, line 531)

Note, that the flush or refresh operation continues with a short network disconnect.
JavaScript Console output

[Log] store.flush called at 10:56.06 (index.html, line 537)
[Log]  Device is OFFLINE (index.html, line 531)
[Log]  Device is ONLINE (index.html, line 531)
[Log] Store flushed in  15.39 seconds at 10:56.22 (index.html, line 537)

The above provide examples of a few of the different scenarios that lead to an error condition and what to expect in the logs when these errors occur.

 

Back to Getting Started With Kapsel

SAP FIORI - My Timesheet create entry hung

Issue with Physical Inventory in Syclo IM 4.0 WM 1.0

$
0
0

Hi all,

 

We are facing an issue with an SAP report (LX17) with the counts entered using the Syclo application. If we enter the count using LI11n the report displays the results, however, if we do it with the Syclo app the report seems to have issues pulling those inventory documents. All the postings from Syclo seems to be working fine, if we check LI13n we can see the quantity counted.

 

We compared 2 documents counted by SAP and Syclo and the only difference we found is the field LINV-ISTAT. For SAP counts the value is 'Z' and for Syclo counts the value is 'D'.

 

We manually changed the value for Syclo documents during debugging and then they started appearing in the report.

 

Do you have any idea of the reason because Syclo update the LINV-ISTAT field with 'D' instead a 'Z'. Did you face something similar?

 

Your help is greatly appreciated.

 

Fer

 

Omar CandelariaMariana CastilloManju VenkateshaJason Latko


FIORI - timesheet approval - No pending approval

$
0
0

Hi

 

I have configured timesheet approval. It does show 5 pending approval in FIORI Launchpad.

 

But it is empty after I click on the pending approval, Please check the screen shot for the details.

 

I have tried to troubleshoot using Chrome Inspect but there is no error.  Also ERROR_LOG and APP_LOG is empty.

 

Timesheet Approval - Pending.png

Approve Timesheets - Empty.png

 

Thank you

 

Santosh

Agentry Android Clients Not Working on Android 5.0

$
0
0

Hi,

 

After updating Android devices to Android 5.0 software version, Agentry Android Clients not working. It opens login screen and after login information is entered client shuts down itself without giving any error message. This is very bad situation for us because our applications not working for Android 5.0 devices on our production servers.

 

Best Regards,

Serkan DEMIR

Fiori on SAP Fiori Client

$
0
0

Hello Experts,

 

There has been lot of buzz that with SAP Fiori Client 1.1.0 we can use the native features like barcode scanner, database (for offline apps). I have gone through articles saying using Fiori on SAP Fiori Client, we can use all this native capabilities.

I have below doubts.

A. Are the plugins required such as barcode scanner are inbuilt in Fiori Client? If yes, how can I invoke them using a Fiori webapp? Or, how can I make custom fiori like apps make use of them?

B.  As I could easily invoke my OData services using NWGW and host my Fiori apps on launchpad. Is it required for me to use SMP server?

 

 

Thanks,

Parth Jhalani

SAP Fiori Technical Role name is missing in the backend system

$
0
0

Dear Experts,

 

To configure SAP Fiori Approve Purchase Order App, I was following the SAP Fiori Set Up Part 5 - YouTube

 

In that he is using the Technical Role for backend authorisation, But I am unable to find the technical role for PO (SAP_MM_TCR_T_X1) in the backend system, but its available in the front end server.

 

Kindly requesting your help.

 

Thanks,

Shinto Joseph

Getting Started with Kapsel - Part 14 -- SAP Fiori Client (New in SP04)

$
0
0

http://scn.sap.com/servlet/JiveServlet/downloadImage/333927/sap-logo.png

 

 

SAP Fiori Client (New in SP04)

SAP Fiori is a set of applications that cover some of the most frequently used SAP software functions.  These apps were written using SAPUI5 and hence can be accessed in a browser on a variety of devices.

 

When a SAP Fiori app is run in the SAP Fiori Client, it provides a set of enhancements to the app including the ability to access native device functionality such as a barcode scanner, improved caching of the app resources using the Cache Manager plugin, security enhancements such as the ability to set a whitelist of URLs the application can communicate with, handling of authentication challenges within a webview via the AuthProxy plugin, improved attachment handling on Android and iOS and additional benefits when integrated with the SMP 3.0 server.  See also the posts SAP Fiori & SMP and SAP Fiori - Mobile as well as Fiori Guidelines.

 

The SAP Fiori client can now be created using the Kapsel plugins by running the following script.

C:\SAP\MobileSDK3\KapselSDK\apps\fiori_client\create_fiori_client.js

Building the SAP Fiori Client yourself allows for the app to be customized.  A prebuilt version is available from the iTunes and Android stores at iOS SAP Fiori Client mobile app and Android SAP Fiori Client mobile app.

 

The following steps will demonstrate an example of using the create_fiori_client.js script to create a Cordova app with Kapsel plugins that can be used to host SAP Fiori apps.  Note that currently there is no demo SAP Fiori test server so the demo SAPUI5 Purchase Order app can be used instead if you do not have access to a locally hosted SAP Fiori app.

 

For additional details see the script that creates the SAP Fiori Client at

C:\SAP\MobileSDK3\KapselSDK\apps\fiori_client\create_fiori_client.js,

the JavaScript file used by the Fiori Client plugin in a project that includes this plugin at

project_name\plugins\com.sap.mp.cordova.plugins.fioriclient\www\fioriclient.js

or the documentation at SAP Fiori Client in SAP Mobile Platform.

  • Edit the file
    C:\SAP\MobileSDK3\KapselSDK\apps\fiori_client\config.json
    Provide values such as those shown below.  Note, if you if you are running the script on Windows remove "ios" from the platforms or if you are running on a Mac and only wish to build one platform remove either "ios" or "android".
    {    "packageName": "com.sap.fiori.client",    "targetFolder": "FioriClient",    "appName": "FioriClient",    "platforms": ["ios", "android"]
    }
  • In a command window in the folder C:\SAP\MobileSDK3\KapselSDK\apps\fiori_client run
    npm install
    
    node create_fiori_client.js
    
    cd FioriClient
    
  • Note that the create_fiori_client.js script has conveniently created a Cordova project containing Kapsel and Cordova plugins.
    C:\SAP\MobileSDK3\KapselSDK\apps\fiori_client\FioriClient>cordova plugins
    com.sap.mp.cordova.plugins.apppreferences 3.5.3 "AppPreference"
    com.sap.mp.cordova.plugins.attachmentviewer 3.5.3 "AttachmentViewer"
    com.sap.mp.cordova.plugins.authproxy 3.5.3 "AuthProxy"
    com.sap.mp.cordova.plugins.barcodescanner 3.5.3 "BarcodeScanner"
    com.sap.mp.cordova.plugins.cachemanager 3.5.3 "CacheManager"
    com.sap.mp.cordova.plugins.corelibs 3.5.3 "CoreLibs"
    com.sap.mp.cordova.plugins.e2etrace 3.5.3 "E2ETrace"
    com.sap.mp.cordova.plugins.encryptedstorage 3.5.3 "EncryptedStorage"
    com.sap.mp.cordova.plugins.fioriclient 3.5.3 "FioriClient"
    com.sap.mp.cordova.plugins.i18n 3.5.3 "i18n"
    com.sap.mp.cordova.plugins.logger 3.5.3 "Logger"
    com.sap.mp.cordova.plugins.logon 3.5.3 "Logon"
    com.sap.mp.cordova.plugins.online 3.5.3 "Online"
    com.sap.mp.cordova.plugins.push 3.5.3 "Push"
    com.sap.mp.cordova.plugins.settings 3.5.3 "Settings"
    com.sap.mp.cordova.plugins.toolbar 3.5.3 "Toolbar"
    com.sap.mp.cordova.plugins.xhook 3.5.3 "Xhook"
    org.apache.cordova.camera 0.3.3 "Camera"
    org.apache.cordova.contacts 0.2.14 "Contacts"
    org.apache.cordova.device 0.2.12 "Device"
    org.apache.cordova.dialogs 0.2.10 "Notification"
    org.apache.cordova.file 1.3.1 "File"
    org.apache.cordova.geolocation 0.3.10 "Geolocation"
    org.apache.cordova.inappbrowser 0.3.4-patched "InAppBrowser"
    org.apache.cordova.statusbar 0.1.8 "StatusBar"
  • Edit the following file
    C:\SAP\MobileSDK3\KapselSDK\apps\fiori_client\FioriClient\www\appConfig.js
    and provide values such as those shown below.  Note the fioriURL should be changed to reflect the webserver that hosts your SAP Fiori applications or to the publicly available SAPUI5 purchase order demo at https://sapui5.netweaver.ondemand.com/sdk/test-resources/sap/m/demokit/poa/index.html
    cordova.define('fiori_client/appConfig', function(require, exports, module) {
        var appConfig = {
            "appID": "com.sap.fiori",
            //"fioriURL": "
    https://m.sap.internal.de:443/sap/bc/ui5_ui5/ui2/ushell/shells/abap/FioriLaunchpad.html",
            "fioriURL": "
    https://sapui5.netweaver.ondemand.com:443/sdk/test-resources/sap/m/demokit/poa/index.html",
            "fioriURLIsSMP": false,
                "passcodePolicy": {
                "expirationDays":"0",
                "hasDigits":"false",
                "hasLowerCaseLetters":"false",
                "hasSpecialLetters":"false",
                "hasUpperCaseLetters":"false",
                "defaultAllowed":"true",
                "lockTimeout":"10",
                "minLength":"6",
                "minUniqueChars":"0",
                "retryLimit":"0"
            }
        };
        module.exports = appConfig; });
    The fioriURLIsSMP variable indicates if the SMP 3.0 server should be used as a proxy to access the SAP Fiori app.  An example of this is shown later in this section.  The passcode policy can be set in the SMP 3.0 management cockpit when fioriURLIsSMP = true or in the appConfig.js as shown above when fioriURLIsSMP = false.  Since the passcode policy setting defaultAllowed is set to true, this enables the ability to Disable the Passcode screen.

  • Copy the files to the platform directory by running
    cordova -d prepare
  • Use the Android IDE or Xcode to deploy and run the project.
    The script create_fiori_client.js has created an app that can be used to host a SAP Fiori app.  Some of the functionality of the app is illustrated below.
    image0.png

    The app name and icon can be customized before create_fiori_client.js is run by modifying the appName in
    C:\SAP\MobileSDK3\KapselSDK\apps\fiori_client\config.json
    and icon.PNG files under
    C:\SAP\MobileSDK3\KapselSDK\apps\fiori_client\assets
    If the fioriURL variable is not specified in the appConfig or if the app is the one downloaded from the public app stores, the first screen shown requests the user to specify the URL to be used by the app.
    image20.png

    The Set App Passcode screen is shown the first time the app is opened.
    image2.PNG

    The Log in screen is shown when the app is subsequently opened or resumed from the background.  This provides additional security for the app and can be configured by the passcodePolicy set in the appConfig.js file.
    image2b.PNG

    The first use tip is shown the first time the app is opened.  To customize this see the method showFirstUseTips in the following file.
    C:\SAP\MobileSDK3\KapselSDK\apps\fiori_client\FioriClient\platforms\android\assets\www\js\index.js
    image1.PNG

    If the URL being accessed is not available or uses HTTPS and the certificate authority that signed the web server's certificate is not trusted by the device, an error page will be shown. 
    image21.pngimage14.PNG

    For additional details see the HTTPS in the Security Appendix.

    By double tapping, a native menu is shown.  The menu items are added in the initClient method in the following file.
    C:\SAP\MobileSDK3\KapselSDK\apps\fiori_client\FioriClient\platforms\android\assets\www\plugins\com.sap.mp.cordova.plugins.fioriclient\www\fioriclient.js

    image3.PNG

    Note in SP05 and SP05 PL01 there is an issue on Android where the toolbar fails to appear following a double tap.  This is resolved in the SDK SP05 PL03 and Cordova 3.6.3.

    The settings are implemented in fioriclient.js and validation.html on Android and in the Root.plist file on iOS.
    image4.PNG

    Notice that the logic for the app is in two places depending on when it is needed.  The logic to show the first use tips and to change from www\index.html to the Fiori URL is in index.js.  Once the URL changes, the methods and variables defined in index.js are removed from memory.  At this point the logic in fioriclient.js and the other plugins are loaded by the Online Application plugin as is the methods and variables for the application specified by the variable fioriURL.

    If the application to be accessed uses HTTPS and the certificate authority that signed the web server's certificate is not known to the device, the certificate authority's public certificate will need to be installed on the mobile device or emulator.  A quick test to see if the site can be opened is to open the URL on the device's browser.  See HTTPS in the security appendix for additional details.

  • Note that on iOS, there are a few settings that can control how the status bar is displayed in the config.xml by use of the StatusBar Plugin.
    image15.png
    StatusBarOverlaysWebview is set to false

    image16.png
    StatusBarOverlaysWebview is set to true

    The background color of the status bar can also be set via SatusBarBackgroundColor.
    image17.png
    SatusBarBackgroundColor 009ce6 with StatusBarOverlaysWebView set to false.

  • It is possible to not show the Set App Passcode screen and Log in screen by making the below modifications to either fioriclient.js file in the project or to the plugin version to avoid having the changes be overwritten after running cordova prepare.
    C:\SAP\MobileSDK3\KapselSDK\apps\fiori_client\FioriClient\platforms\android\assets\www\plugins\com.sap.mp.cordova.plugins.fioriclient\www\fioriclient.js
    C:\SAP\MobileSDK3\KapselSDK\plugins\fioriclient\www\fioriclient.js
    Note, this assumes the Client Password Policy for Default password allowed is set to true either in the Management Cockpit if using the SMP 3.0 server or in the passcode policy variable in the appConfig.js file if not using the SMP 3.0 server.

    Modify the method initLogonWithRegistration to include the below code.
        var logonView = sap.logon.IabUi;    logonView.onShowScreen = sap.FioriClient.customShowScreen;    logonView.onShowNotification = sap.FioriClient.customShowNotification;    sap.Logon.init(sap.FioriClient.logonWithRegistrationCompleted,                   sap.FioriClient.logonErrorCallback,                   sap.FioriClient.appID,                   sap.FioriClient.context,                   logonView);
    Modify the method initLogonWithoutRegistration to include the below code.
        logonView.onShowScreen = sap.FioriClient.customShowScreen;    logonView.onShowNotification = sap.FioriClient.customShowNotification;
    Add the following two methdods.
        customShowScreen: function(screenId, screenEvents, currentContext) {        if (screenId == "SCR_SET_PASSCODE_OPT_ON") {            screenEvents.ondisable();            return true;        }        else if (screenId == "SCR_SET_PASSCODE_OPT_OFF") {            var context2 = {};            screenEvents.onsubmit(context2);            return true;        }        return false;  //skip the default value    },    customShowNotification: function(screenId, notifcationKey) {        if (screenId == "SCR_SET_PASSCODE_OPT_ON" || screenId == "SCR_SET_PASSCODE_OPT_OFF" ) {            alert(notifcationKey);            return true;        }        return false;    },

Proxying the Fiori Client through an SMP 3.0 Server

The following steps demonstrate how to proxy a SAP Fiori application through a SMP 3.0 server.  Note this requires a server version greater than or equal to 3.0 SP03 PL02 or 3.0 SP04.
Also note, that the Relay Server cannot be used in in this scenario.

  • Create a Kapsel application with an id of com.sap.fiori and an endpoint of a partial URL for the server that is running Fiori or if one is not available, the demo SAPUI5 purchase order app.  The full URL to access the purchase order app is
    https://sapui5.netweaver.ondemand.com/sdk/test-resources/sap/m/demokit/poa/index.html
    The partial URL that can be entered as the endpoint is
    https://sapui5.netweaver.ondemand.com
    Set the Use System Proxy connection if your network uses a proxy and the application being accessed such as https://sapui5.netweaver.ondemand.com is not within your internal network.  Note the proxy host and port for the SMP 3.0 server are set under Settings > System > HTTP proxy host.

    Rewrite mode should be No Rewriting if using the purchase order app or Rewrite URL in Backend System if used with a SAP Fiori app.  When using Rewrite URL in Backend System, the Endpoint in the management cockpit should be the something like https://m.sap.internal.de/sap

    image8.PNG

    The authentication profile can be set to use the existing default profile.

    Save the application and if using the purchase order app verify that the endpoint can be pinged.  It is unlikely that a partial SAP Fiori URL such as https://m.sap.internal.de/sap can be successfully pinged.
    image9.PNG

  • In the file
    C:\SAP\MobileSDK3\KapselSDK\apps\fiori_client\FioriClient\www\appConfig.js
    set the variable fioriURLIsSMP to true to indicate that the connection to the app will be proxied through the SMP 3.0 server.

    Set the fioriURL to a URL as shown below.  The method parseAppConfig will parse the URL and use it to specify the values on the Logon plugin's registration screen.
    https://YKFN00528072A.amer.global.corp.sap:443/com.sap.fiori/sdk/test-resources/sap/m/demokit/poa/index.html
    or
    https://YKFN00528072A.amer.global.corp.sap:443/sap/bc/ui5_ui5/ui2/ushell/shells/abap/FioriLaunchpad.html
    Notice that the app id, com.sap.fiori is prefixed to the first URL above.  This is required for when using a rewrite mode of No Rewriting or Rewrite URL in SMP.
    The second URL uses a rewrite mode of Rewrite URL in Backend System and does not have the app id as part of the URL.

  • Notice that the endpoint uses HTTPS, the certificate that the server uses was signed by GTE Cybertrust Global Root and there is a GTE certificate already installed in the SMP 3.0 server's keystore.
    image6.PNG
    image7.PNG

    For additional details see the HTTPS in the Security Appendix.

  • Deploy and run the app.

    Since fioriURLIsSMP is set to true, the registration screen for the SMP 3.0 server is shown first. 

    image18.png

    The passcode policy is retrieved from the SMP 3.0 server during a successful registration process and then the set app passcode screen is shown next. 

    image2.PNG

    Then the first use tips page is shown followed by the SAP Fiori login page (if the app type is a Fiori App). 

    image19.png

    See the Single Sign On topic to enable the user name and password used by the SMP 3.0 server registration to be used for the SAP Fiori app which causes this screen to be skipped.

  • When the appconfig.js file has fioriURLIsSMP set to true, the settings screen has three additional read only settings shown below.
    image22.png

    Note, if you wish to change the Fiori URL to point to a different SMP server, click the Clear All Application Settings button under Reset Settings.  This will cause the Logon plugin's registration screen to appear.

  • When the SAP Fiori Client is used with the SMP 3.0 server, statistics can be viewed such as those shown below. 
    image10.PNGimage11.PNG

    The log level can be set and a device log retrieved.  Note the log will be available as shown here after the app has been restarted and the Log Upload checkbox has been checked. 
    image12.PNG

    In addition, the passcode policy can be set, notifications can be sent to the device, secure onboarding and the ability to access OData from a local on device store.

Single Sign On

The registration with a SMP 3.0 server for a SAP Fiori app can be made to use a single sign on mechanism so that the user does not need to provide the user name and password for the SAP Fiori app each time it is opened.  To do this, modify the authentication provider for the app to use an HTTP/HTTPS authentication provider.  Set the control flag to be required, provide a URL that will return an SSO Cookie, and set the SSO Cookie Name to MYSAPSSO2 as show in the image below.
image13.PNG

 

When the application initially starts, the logon plugin's registration screen will show and will upon successful registration receive a MYSAPSSO2 cookie that is passed to the SAP Fiori app causing it to open directly without showing its logon screen.
See also MySAPSS02 Cookie.

 

 

Back to Getting Started With Kapsel

Viewing all 6147 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>