Accessing Field Values in a Parameter with Complex Structures 

The class library provides methods to access individual field values in a structure parameter ( the operator [ ]) or a table parameter ( the member functions Field or Cell). These member functions all have a parameter that is either an index or a field name. The user must provide related field information to the parameter objects before these objects can be called to access the target fields. This information includes a field’s name, its column number in the structure or table, its data type, its byte offset from the beginning, its length, and the number of decimal points it contains. Unless the information is available, the parameter object does not know (given a field index or name) how to find the correct memory block to map to a CRfcData object.

The classes CRfcStructParam and CRfcTableParam have a common ancestor, CRfcComplexParam, whose member functions are designed to allow users to provide and retrieve individual field information. To provide field information, use either of the AddFieldInfo methods:

Adds information for multiple fields into the parameter

Adds information for a single field into the parameter

As noted, the first method shown above other allows you to fill in an array of the structure RFC_FIELD_INFO for multiple fields and then enter them in the object all at once. The second one will allow you to add one field information item at a time. The RFC_FIELD_INFO structure contains a single field’s information, such as name, offset, type, length, and so on. (For either of the AddFieldInfo methods, if a field is of a type with fixed-length, then the length information is not required.)

Note that the order of providing field information does not matter. It is also not necessary to provide field information for every field in the structure or table. If you are only going to access certain fields, you need only to provide information for those fields. If you do not need to access any individual field values, then no field information need be provided