ERP Integrator V2 - Online Help
ERP Integrator V2
Questions / Feedback?

TableCount Property

Total number of tables used by the remote function call.

Syntax

[VB.NET]
Public Property TableCount As Integer

[C#]
public int TableCount {get; set;}

Remarks

Internal tables are handled differently in the SapServer component than they are in the SapClient. In the SapClient, you're receiving data from pre-defined tables, with pre-defined structure. The SAP system knows the format of the tables and the client queries the table structure and maps the data out into rows and columns automatically. However, in the SapServer component you're creating the table data yourself. You are responsible for the structure of the table, and there is no guarantee that the SAP system will have the structure of table you're using installed, or be able to understand your table format. What's more, the SAP system does not specify the type of table it is expecting when he calls your function, the only thing the SAP system supplies is the TableName and the maximum TableRowLength it is expecting in the response.

Using tables is similar to using ReceiveParams, in that you must specify the name of each table you're expecting to receive. After you specify the total TableCount and TableName of each table you expect to receive, call the UpdateReceiveParams methods. This will update the tables as well as the UpdateReceiveParams. The TableRowLength will reflect the expected row length, and the RowData collection will contain any rows that the caller has passed to your function.

If the function caller did not specify one of the tables you requested, it will be removed from the internal collection. For instance, Set TableCount to 1, and specify a TableName of "TESTTABLE" at TableIndex 0, and call UpdateReceiveParams if the caller did not create a table named "TESTTABLE" and pass it in the function call to your system, the table collection will be updated to reflect this. Meaning TableCount will be 0. If you specify 10 tables, and only the second table was not specified by the calling function, the table originally located at TableIndex 1 will be deleted, the following tables will slide back into the missing space. Meaning the table at TableIndex 2 not moves to TableIndex 1, the table at TableIndex 3 moves to TableIndex 2, etc.

Note that if a table is not passed to this component by the caller (eg, TableCount is 0 after calling UpdateReceiveParams), you cannot just add a new table and send it in the reply. This is because the function caller (usually the SAP system) must create the internal tables on its end and pass the handles of those tables to your function. This is all taken care of inside the component but it means that if the caller did not specify a table, you will not be able to create one on the fly and return it to him. This is a limitation of the SAP RFC SDK which this component is built on top of.

The following example shows how tables are used.

void SapServer1_OnFunctionCall(object sender, SapserverFuncionCallEventArgs e) {
  if (e.FunctionName.Equals("Z_GREETING_TEST_FUNCTION")) {
    server.ReceiveParams.Add(new SapParam("FIRSTNAME", "", ParamTypes.ptCharacters));
    server.ReceiveParams.Add(new SapParam("LASTNAME", "", ParamTypes.ptCharacters));
    server.TableCount = 1;
    server.TableIndex = 0;
    server.TableName = "TESTTAB";
    server.UpdateReceiveParams();
    string greeting = "Hello " + server.ReceiveParams[0].Value + " " +
                      server.ReceiveParams[1].Value + ", I hope that you are well.";

    server.ReplyParams.Add(new SapParam("GREETING", greeting, ParamTypes.ptCharacters));

    server.TableIndex = 0;
    char[] buff = new char[25 + 255];
    for (int i = 0; i < buff.Length; ++i ) {
      buff[i] = (i%10).ToString()[0];
    }
    server.RowCount = 1;
    server.RowIndex = 0;
    server.RowData = new string(buff);
    server.SendReply();
  }
}

This property is not available at design time.

Default Value

0

 
 
Copyright (c) 2017 /n software inc. - All rights reserved.
Build 2.0.6240.0