Additional product information
CIS mobile can display a range of product information. Aside from technical data the names of the product can be shown. Due to the fact that the internal name is not always the same as the name a customer uses, it may make sense to request both names from the ERP system and show them in CIS mobile. In this add-on we look at the name that the customer uses for the product.
The additional information is to be displayed in the detailed view of the product. On activating the test output for add-ons in the settings, orange colored placeholders are shown and these can be replaced by an add-on. In our example we need "ProductAddon3".
Show placeholders for potential add-ons
available for an add-on
To clearly identify a product the (internal) product number is required. As the product name relative to a certain customer should be read we also need the customer number. By clicking a placeholder for an add-on all available keys and their values in this context can be displayed. This example concerns the details for product "P-109" and the customer number is "0000001032". We also want to bear in mind the distribution channel and the sales organization. Consulting the table "KNMT" should do the trick here.
Keys and their current values
Mapping SAP tables
The required data (customer name of a product) can be extracted from a SAP table by using one simple query. We create a new class with the S10 repository to deal with the this data in VB.net. Details about the mapping can be found in the s10 forum (www.synactives10.com), the main steps are:
- Configure the connecton to a SAP system in the repository
- Click "create from an SAP table" in the menu and choose a table, here it is KNMT.
- Change the name of the assembly to "../config/s10cisaddon"
- Generate the classes and include the .vb files in the s10cisaddon VB.net project
NB: The repository also shows the keys for a table (dbkey="yes")
Request data in VB.net
The placeholder in our example is called "ProductAddon3". That means we have to implement a method "BuildProductAddon3" in the add-on project. Open the file "s10cisaddon.sln" in visual studio; you can find it in the directory "config" in the CIS mobile directory on the server.
As we need to access the keys and values in the dictionary object and we also have to return the returned data as an HTML5 formatted string to CIS mobile, we use the following parameters for the new method:
Public Function BuildProductAddon3 (ByVal keys As Dictionary(Of String, String), ByRef buttons As String) As String
We do not use and fill the string "buttons" in this example because we are not creating another button to display more information at this level.
You can access the keys in the dictionary object with:
GetItem(keys, "name of the key").
We will then create an object of the class "KNMT", put in the required key values and request a reading from the SAP table. If the command is succesfull we can immediately access the delivered values, embed them in an HTML string (in our example it is a single table row) and return the string to its position.
Please see the the comments in the example code for further details.
We need an object for table KNMT
Create and access instances of class KNTM in VB.net or S10 repository
You can activate "highlight add-ons" in the CIS mobile settings. The new add-on that we have created in this example is marked in orange and shows the product number the customer uses.
More information about a product implemented as an add-on