Properties of the RFC Select interface The "RFC Select Interface" frequently used in CIS mobile is a combination of two components of the SAP Basis System:
In VB.NET you build a select statement (SAP syntax). This is transferred via RFC to a generic ABAP function module in the SAP system and executed there. The result table of the select represents the return of the RFC call. In VB.NET you then process the returned data. In addition, the RFC Select interface does the following:
Advantages and disadvantages:
|
||||||||||||
Example 1: Read article number and name of the customer In addition to a material number, we want to display the customer's article number and article description as a CIS add-on. You can find all details about the add-on integration in the chapter "Implementing add-ons" in section Example article description. Here we focus on data acquisition.
In the SAP system, this information is displayed in transaction VD53:
The corresponding database table is the KNMT, shown here with transaction SE11, red bordered the two fields we need:
With the key fields VKORG, VTWEG, KUNNR and MATNR we want to read the table KNMT and take from it the fields KDMAT (article number at customer) and POSTX (article description at customer). The VB.NET coding for this can look like this:
Vb.net
For this to work, especially the class "addonknmt" is known in VB.NET, create the class in the "S10 Repository" of the CIS mobile project and include in your VB.NET project "s10cisaddon" the VB.NET classes addonknmt and s10_addonmt generated from it. This works as follows: Start the S10 repository,
Generate the class "addonknmt" from the SAP table KNMT in the S10 repository.
As "assembly" please use your VB.NET project "s10csiaddon" enter After generation, "s10cis", i.e. the CIS mobile standard project, is displayed here first:
Generated class addonknmt in S10 repository
If you only need the two fields KDMAT and POSTX apart from the key fields, you can delete all other fields or set them to comment with // at the beginning of the line. This has the advantage that the database interface only has to read these two fields, which is then faster, especially in the case of a matching secondary index. If you need other fields later, you can either include them again (if you need the additional fields in the same database access) or create a second class addonknmt2 suitable for a different database access. You can delete the MANDT field (client in SAP system), since it is set automatically by the SAP Select interface. However, there is no harm in leaving it in the class. In any case, it is not necessary to provide MANDT with a value to read the table.
Class addonknmt in S10 repository after deleting unnecessary fields
From the class addonknmt the VB.NET files addonknmt.vb and s10_addonknmt.vb are generated at "Generate". Include both files in your VB.NET project "s10ciaddon". To do this, it is best to first copy the files from the "classes\s10cisaddon" subdirectory of the CIS mobile folder to config\s10cisaddon:
The two generated VB.NET files are initially located in classes/s10cisaddon
Copy the two files into your project, i.e. to config/s10cisaddon
And finally, add both files to your VB.NET project "s10cisaddon" using "Add Existing Item" in Visual Studio :
|
||||||||||||
General procedure for reading an SAP table 1. For the SAP table XXXX, generate a new table in the S10 Repository a class addonxxxx 2. With: assembly= Put "s10cisaddon" instead of the generated "s10cis". 3. Optional: Remove the unnecessary fields (but not the key fields) there 4. On "Generate" click 5. The two files addonxxxx.vb and s10_addonxxxx.vb copy You from classes/s10cisaddon to config/s10cisaddon 6. In your VB.NET Project "s10cisaddon" you add the two files via Project->Add existing element auf 7. Now you can create an object of class addonxxxx in VB.NET and read the SAP table with ic.RfcDatabaseRead() or ic.RfcDatabaSeselect() |
||||||||||||
Bundled accesses Instead of a single table row, you can also read in a set of rows from a table specified by a WHERE condition. You can find a detailed example of this at the add-on Complaints. Procedure: 1. For the SAP table XXXX, generate a new table in the S10 Repository a class addonxxxx2. With: assembly= Instead of the generated "s10cis" put the name "s10cisaddon 3. Optional: In the class, remove the fields that are not needed (but not the key fields) 4. On "Generate" click 5. The two files addonxxxx.vb and s10_addonxxxx.vb copy You from classes/s10cisaddon to config/s10cisaddon 6. In your VB.NET Project "s10cisaddon" you add the two files via Projekt->Vorhandenes Element hinzufügen 7. In the S10 repository, take a "folder" On in the class "addon", which contains objects of the class addonxxx: folder all_xxxx class="addonxxxx" 8. Now you can read in the desired table rows in VB.NET with all_xxxx.RfcDatabaseSelect() 9. With the loop For all x as addonxxxx in all_xxxx |
||||||||||||
Description of ic.RfcDatabaseRead (from S10 Forum)
|
||||||||||||
Description of ic.RfcDatabaseSelect (from S10 Forum)
|
||||||||||||
Description of folder.RfcDatabaseSelect (from S10 Forum)
|
||||||||||||
Bundling of accesses For example, if you have two objects dim sapxxxx like addonxxxx dim sapyyy like addonyyy for which you read the values from the SAP tables xxxx and yyyy with ic.RfcDatabaseRead(): sapxxxx.ic.rfcdatabaseread() sapyyy.ic.rfcdatabaseread() two RFC calls are made to the SAP system in succession. Instead you can use
sapxxxx.ic.rfcdatabaseread(deferred:=True) ic.RfcExecuteDeferredCalls(rfcmessages) work. In this case, both database accesses are stored in one processed in a single RFC call.Auch Volume accesses über folder.RfcDatabaseSelect können Sie über deferred:=True in take up the bundled processing. |
||||||||||||
Using the cache Regardless of any buffering of the tables on the SAP application server, you can use an access cache on the machine running CIS mobile and thus avoid RFC access in many cases. This is done simply by adding dbcache="yes" to the class definition in the S10 repository:
All entries found are then stored locally and searched there first. The cache content is discarded at the beginning of the day and recreated, i.e. the entries in the cache are out of date for a maximum of 24 hours. This makes the cache well usable for tables where a next day update is sufficient. For Example: Designations of plants, storage locations, order types, tax codes, payment terms, etc. The total size of the cache is defined in the S10 repository for CIS mobile under "Properties":
The cache is shared for all CIS mobile users, i.e. what was read in for one user is used for all other users.
|