Warning: Deprecated articles
You are using the old version of the knowledge base for ERPConnect.
Make sure to use the samples within the new HelpCenter for ERPConnect.
This sample shows how to exchange tables between SAP and .NET using a RFC server.
About #
A table with name NUMBERS is added to the Z_ADD function and the function is renamed to Z_ADD_2.
All entries in table NUMBERS in column NUMB should be added by the .NET program.
The table NUMBERS is added to the Tables collection.
The column NUMB is added to the empty Columns collection with Add()
.
Initialize RFCServer #
The following sample code shows how to initialize the RFCServer object:
[C#]
The handling of the tables is done as always. We are using the object hierarchy to iterate through the rows and add the values. The result is returned in the scalar export parameter RES.
[C#]
Call the Function #
The following sample ABAP code calls the function in a foreign destination.
REPORT zaddtest2 .
DATA res TYPE i.
DATA numbs LIKE zaddstruc OCCURS 0 WITH HEADER LINE.
numbs-numb = '1'.
APPEND numbs.
numbs-numb = '2'.
APPEND numbs.
numbs-numb = '3'.
APPEND numbs.
CALL FUNCTION 'Z_ADD_2' DESTINATION 'ERPConnectTEST'
IMPORTING
res = res
TABLES
numbers = numbs.
WRITE: / 'Result: ', res.