00001 #ifndef SAPNWRFC_H 00002 #define SAPNWRFC_H 00003 00004 #include <stdlib.h> 00005 #include <stdio.h> 00006 #ifndef SAPTYPE_H 00007 #include "sapucx.h" 00008 #endif /* SAPTYPE_H */ 00009 #include "sapuc.h" 00010 00011 #ifndef DECL_EXP 00012 # if defined(SAPonLIN) && defined(GCC_HIDDEN_VISIBILITY) 00013 # define DECL_EXP __attribute__((visibility("default"))) 00014 # else 00015 # define DECL_EXP 00016 # endif 00017 #endif /* DECL_EXP */ 00018 00019 #ifndef SAP_API 00020 #ifdef SAPonNT 00021 # define SAP_API _stdcall 00022 #else 00023 # define SAP_API 00024 #endif /* SAPonNT */ 00025 #endif /* SAP_API */ 00026 00027 #ifdef SAPonNT 00028 #pragma warning (disable : 4267) // disable warning: conversion from 'size_t' to 'const unsigned int' 00029 #endif 00030 00031 #if defined(SAPonOS390) && defined(__XPLINK__) && __CHARSET_LIB == 1 00032 #pragma runopts("FILETAG(AUTOCVT,AUTOTAG)") 00033 #endif 00034 00035 #if defined SAPwith64_BIT && \ 00036 ! defined SAPonNT && \ 00037 ! defined SAPonOS400 00038 00039 typedef long RFC_INT8; /* this requires the LP64 data model */ 00040 #elif defined SAPonHPPA || \ 00041 defined SAPonRS6000 || \ 00042 defined SAPonSUN || \ 00043 defined SAPonOS390 || \ 00044 defined SAPonOS400 || \ 00045 defined SAPonDARWIN || \ 00046 defined SAPonLIN 00047 00048 typedef long long RFC_INT8; 00049 #elif defined SAPonNT 00050 typedef __int64 RFC_INT8; 00051 #endif 00052 00053 00054 /* RFC scalar data type mappings */ 00055 typedef SAP_UC RFC_CHAR; ///< Characters, RFCTYPE_CHAR 00056 typedef RFC_CHAR RFC_NUM; ///< Digits, RFCTYPE_NUM /*SAPUNICODEOK_CHARTYPE*/ 00057 typedef SAP_RAW RFC_BYTE; ///< Raw data, RFCTYPE_BYTE 00058 typedef SAP_RAW RFC_BCD; ///< Packed numbers, RFCTYPE_BCD /*SAPUNICODEOK_CHARTYPE*/ 00059 typedef SAP_RAW RFC_INT1; ///< 1 byte integer, RFCTYPE_INT1 00060 typedef short RFC_INT2; ///< 2 byte integer, RFCTYPE_INT2 00061 typedef int RFC_INT; ///< 4 byte integer, RFCTYPE_INT 00062 typedef double RFC_FLOAT; ///< Floating point, double precision, RFCTYPE_FLOAT 00063 typedef RFC_CHAR RFC_DATE[8]; ///< Date, RFCTYPE_DATE (YYYYMMDD) 00064 typedef RFC_CHAR RFC_TIME[6]; ///< Time, RFCTYPE_TIME (HHMMSS) 00065 typedef DecFloat16 RFC_DECF16; ///< IEEE 754r decimal floating point, 8 bytes 00066 typedef DecFloat34 RFC_DECF34; ///< IEEE 754r decimal floating point, 16 bytes 00067 typedef RFC_INT8 RFC_UTCLONG ; ///< timestamp/long 00068 typedef RFC_INT8 RFC_UTCSECOND ; ///< timestamp/second 00069 typedef RFC_INT8 RFC_UTCMINUTE ; ///< timestamp/minute 00070 typedef int RFC_DTDAY ; ///< date/day 00071 typedef int RFC_DTWEEK ; ///< date/week 00072 typedef int RFC_DTMONTH ; ///< date/month 00073 typedef int RFC_TSECOND ; ///< time/second 00074 typedef short RFC_TMINUTE ; ///< time/minute 00075 typedef short RFC_CDAY ; ///< Calandendar day: Day and month 00076 00077 #define RFC_TID_LN 24 00078 #define RFC_UNITID_LN 32 00079 typedef SAP_UC RFC_TID[RFC_TID_LN+1]; ///< Used for TIDs in inbound and outbound tRFC/qRFC 00080 typedef SAP_UC RFC_UNITID[RFC_UNITID_LN+1]; ///< Used for Unit IDs in inbound and outbound bgRFC 00081 00082 00083 /** \enum _RFCTYPE 00084 * \ingroup api 00085 * 00086 * RFCTYPE is used in field descriptions (#RFC_FIELD_DESC) and parameter descriptions 00087 * (#RFC_PARAMETER_DESC) and denotes the ABAP data type of the corresponding field/parameter. 00088 */ 00089 typedef enum _RFCTYPE 00090 { 00091 RFCTYPE_CHAR = 0, ///< 1-byte or multibyte character, fixed size, blank padded 00092 RFCTYPE_DATE = 1, ///< Date ( YYYYYMMDD ) 00093 RFCTYPE_BCD = 2, ///< Packed number, any length between 1 and 16 bytes 00094 RFCTYPE_TIME = 3, ///< Time (HHMMSS) 00095 RFCTYPE_BYTE = 4, ///< Raw data, binary, fixed length, zero padded. 00096 RFCTYPE_TABLE = 5, ///< Internal table 00097 RFCTYPE_NUM = 6, ///< Digits, fixed size, leading '0' padded. 00098 RFCTYPE_FLOAT = 7, ///< Floating point, double precision 00099 RFCTYPE_INT = 8, ///< 4-byte integer 00100 RFCTYPE_INT2 = 9, ///< 2-byte integer. Obsolete, not directly supported by ABAP/4 00101 RFCTYPE_INT1 = 10, ///< 1-byte integer, unsigned. Obsolete, not directly supported by ABAP/4 00102 RFCTYPE_NULL = 14, ///< Not supported data type. 00103 RFCTYPE_ABAPOBJECT = 16,///< ABAP object. 00104 RFCTYPE_STRUCTURE = 17, ///< ABAP structure 00105 RFCTYPE_DECF16 = 23, ///< IEEE 754r decimal floating point, 8 bytes 00106 RFCTYPE_DECF34 = 24, ///< IEEE 754r decimal floating point, 16 bytes 00107 RFCTYPE_XMLDATA = 28, ///< No longer used! 00108 RFCTYPE_STRING = 29, ///< Variable-length, null-terminated string 00109 RFCTYPE_XSTRING = 30, ///< Variable-length raw string, length in bytes 00110 RFCTYPE_INT8, ///< 8-byte integer 00111 RFCTYPE_UTCLONG , ///< timestamp/long, 8-byte integer 00112 RFCTYPE_UTCSECOND , ///< timestamp/second, 8-byte integer 00113 RFCTYPE_UTCMINUTE , ///< timestamp/minute, 8-byte integer 00114 RFCTYPE_DTDAY , ///< date/day , 4-byte integer 00115 RFCTYPE_DTWEEK , ///< date/week, 4-byte integer 00116 RFCTYPE_DTMONTH , ///< date/month, 4-byte integer 00117 RFCTYPE_TSECOND , ///< time/second, 4-byte integer 00118 RFCTYPE_TMINUTE , ///< time/minute, 2-byte integer 00119 RFCTYPE_CDAY , ///< calendar day, 2-byte integer 00120 RFCTYPE_BOX , ///< boxed structure, note: not supported by NW RFC lib 00121 RFCTYPE_GENERIC_BOX, ///< boxed client dependent structure, note: not supported by NW RFC lib 00122 _RFCTYPE_max_value ///< the max. value of RFCTYPEs 00123 }RFCTYPE; 00124 00125 /** \enum _RFC_RC 00126 * \ingroup api 00127 * 00128 * RFC return codes used by all functions that do not directly return a handle. 00129 * Also used as error indicator in the structure #RFC_ERROR_INFO::code. 00130 */ 00131 typedef enum _RFC_RC 00132 { 00133 RFC_OK, ///< Everything O.K. Used by every function 00134 RFC_COMMUNICATION_FAILURE, ///< Error in Network & Communication layer 00135 RFC_LOGON_FAILURE, ///< Unable to logon to SAP system. Invalid password, user locked, etc. 00136 RFC_ABAP_RUNTIME_FAILURE, ///< SAP system runtime error (SYSTEM_FAILURE): Shortdump on the backend side 00137 RFC_ABAP_MESSAGE, ///< The called function module raised an E-, A- or X-Message 00138 RFC_ABAP_EXCEPTION, ///< The called function module raised an Exception (RAISE or MESSAGE ... RAISING) 00139 RFC_CLOSED, ///< Connection closed by the other side 00140 RFC_CANCELED, ///< No longer used 00141 RFC_TIMEOUT, ///< Time out 00142 RFC_MEMORY_INSUFFICIENT, ///< Memory insufficient 00143 RFC_VERSION_MISMATCH, ///< Version mismatch 00144 RFC_INVALID_PROTOCOL, ///< The received data has an unsupported format 00145 RFC_SERIALIZATION_FAILURE, ///< A problem while serializing or deserializing RFM parameters 00146 RFC_INVALID_HANDLE, ///< An invalid handle was passed to an API call 00147 RFC_RETRY, ///< RfcListenAndDispatch did not receive an RFC request during the timeout period 00148 RFC_EXTERNAL_FAILURE, ///< Error in external custom code. (E.g. in the function handlers or tRFC handlers.) Results in SYSTEM_FAILURE 00149 RFC_EXECUTED, ///< Inbound tRFC Call already executed (needs to be returned from RFC_ON_CHECK_TRANSACTION in case the TID is already known and successfully processed before.) 00150 RFC_NOT_FOUND, ///< Function or structure definition not found (Metadata API) 00151 RFC_NOT_SUPPORTED, ///< The operation is not supported on that handle 00152 RFC_ILLEGAL_STATE, ///< The operation is not supported on that handle at the current point of time (e.g. trying a callback on a server handle, while not in a call) 00153 RFC_INVALID_PARAMETER, ///< An invalid parameter was passed to an API call, (e.g. invalid name, type or length) 00154 RFC_CODEPAGE_CONVERSION_FAILURE, ///< Codepage conversion error 00155 RFC_CONVERSION_FAILURE, ///< Error while converting a parameter to the correct data type 00156 RFC_BUFFER_TOO_SMALL, ///< The given buffer was to small to hold the entire parameter. Data has been truncated. 00157 RFC_TABLE_MOVE_BOF, ///< Trying to move the current position before the first row of the table 00158 RFC_TABLE_MOVE_EOF, ///< Trying to move the current position after the last row of the table 00159 RFC_START_SAPGUI_FAILURE, ///< Failed to start and attach SAPGUI to the RFC connection 00160 RFC_ABAP_CLASS_EXCEPTION, ///< The called function module raised a class based exception 00161 RFC_UNKNOWN_ERROR, ///< "Something" went wrong, but I don't know what... 00162 RFC_AUTHORIZATION_FAILURE, ///< Authorization check error 00163 _RFC_RC_max_value ///< Don't use 00164 }RFC_RC; 00165 00166 /** \enum _RFC_ERROR_GROUP 00167 * \ingroup api 00168 * 00169 * Groups several error conditions together, depending on the "layer" to which they belong. 00170 * Used in the structure #RFC_ERROR_INFO::group. 00171 */ 00172 typedef enum _RFC_ERROR_GROUP 00173 { 00174 OK, ///< OK 00175 ABAP_APPLICATION_FAILURE, ///< ABAP Exception raised in ABAP function modules 00176 ABAP_RUNTIME_FAILURE, ///< ABAP Message raised in ABAP function modules or in ABAP runtime of the backend (e.g Kernel) 00177 LOGON_FAILURE, ///< Error message raised when logon fails 00178 COMMUNICATION_FAILURE, ///< Problems with the network connection (or backend broke down and killed the connection) 00179 EXTERNAL_RUNTIME_FAILURE, ///< Problems in the RFC runtime of the external program (i.e "this" library) 00180 EXTERNAL_APPLICATION_FAILURE, ///< Problems in the external program (e.g in the external server implementation) 00181 EXTERNAL_AUTHORIZATION_FAILURE ///< Problems raised in the authorization check handler provided by the external server implementation 00182 }RFC_ERROR_GROUP; 00183 00184 /** \struct _RFC_ERROR_INFO 00185 * \ingroup api 00186 * 00187 * Used in all functions of the NW RFC library to return detailed information about 00188 * an error that has just occurred. This can be an error that the communication partner 00189 * sent back to us, an error that occurred in the network layer or operating system, 00190 * an internal error in the NW RFC library or an error that the application programmer 00191 * (i.e. you) has committed... 00192 * 00193 * Within a server function implementation, the application programmer (you) can return 00194 * this structure to the RFC library in order to specify the error type & message that 00195 * you want to send back to the backend. 00196 */ 00197 typedef struct _RFC_ERROR_INFO 00198 { 00199 RFC_RC code; ///< Error code. Should be the same as the API returns if the API has return type RFC_RC 00200 RFC_ERROR_GROUP group; ///< Error group 00201 SAP_UC key[128]; ///< Error key 00202 SAP_UC message[512]; ///< Error message 00203 SAP_UC abapMsgClass[20+1]; ///< ABAP message ID , or class 00204 SAP_UC abapMsgType[1+1]; ///< ABAP message type, e.g. 'E', 'A' or 'X' 00205 RFC_NUM abapMsgNumber[3 + 1]; ///< ABAP message number 00206 SAP_UC abapMsgV1[50+1]; ///< ABAP message details field 1, corresponds to SY-MSGV1 00207 SAP_UC abapMsgV2[50+1]; ///< ABAP message details field 2, corresponds to SY-MSGV2 00208 SAP_UC abapMsgV3[50+1]; ///< ABAP message details field 3, corresponds to SY-MSGV3 00209 SAP_UC abapMsgV4[50+1]; ///< ABAP message details field 4, corresponds to SY-MSGV4 00210 }RFC_ERROR_INFO; 00211 00212 /** \struct _RFC_ATTRIBUTES 00213 * \ingroup connection 00214 * 00215 * Structure returned by RfcGetConnectionAttributes() giving some 00216 * information about the partner system on the other side of this RFC connection. 00217 */ 00218 typedef struct _RFC_ATTRIBUTES 00219 { 00220 SAP_UC dest[64+1]; ///< RFC destination 00221 SAP_UC host[100+1]; ///< Own host name 00222 SAP_UC partnerHost[100+1]; ///< Partner host name 00223 SAP_UC sysNumber[2+1]; ///< R/3 system number 00224 SAP_UC sysId[8+1]; ///< R/3 system ID 00225 SAP_UC client[3+1]; ///< Client ("Mandant") 00226 SAP_UC user[12+1]; ///< User 00227 SAP_UC language[2+1]; ///< Language 00228 SAP_UC trace[1+1]; ///< Trace level (0-3) 00229 SAP_UC isoLanguage[2+1]; ///< 2-byte ISO-Language 00230 SAP_UC codepage[4+1]; ///< Own code page 00231 SAP_UC partnerCodepage[4+1]; ///< Partner code page 00232 SAP_UC rfcRole[1+1]; ///< C/S: RFC Client / RFC Server 00233 SAP_UC type[1+1]; ///< 2/3/E/R: R/2,R/3,Ext,Reg.Ext 00234 SAP_UC partnerType[1+1]; ///< 2/3/E/R: R/2,R/3,Ext,Reg.Ext 00235 SAP_UC rel[4+1]; ///< My system release 00236 SAP_UC partnerRel[4+1]; ///< Partner system release 00237 SAP_UC kernelRel[4+1]; ///< Partner kernel release 00238 SAP_UC cpicConvId[8 + 1]; ///< CPI-C Conversation ID 00239 SAP_UC progName[128+1]; ///< Name of the calling APAB program (report, module pool) 00240 SAP_UC partnerBytesPerChar[1+1];///< Number of bytes per character in the backend's current codepage. Note this is different from the semantics of the PCS parameter. 00241 SAP_UC partnerSystemCodepage[4 + 1]; ///< Partner system code page 00242 SAP_UC reserved[79]; ///< Reserved for later use 00243 }RFC_ATTRIBUTES, *P_RFC_ATTRIBUTES; 00244 00245 /** \struct _RFC_SECURITY_ATTRIBUTES 00246 * \ingroup connection 00247 * 00248 * Structure passed to the RFC_SERVER_AUTHORIZATION_HANDLER giving some 00249 * security related information about the calling ABAP partner of an incoming RFC call. 00250 */ 00251 typedef struct _RFC_SECURITY_ATTRIBUTES 00252 { 00253 SAP_UC *functionName; ///< Name of the called function module 00254 SAP_UC *sysId; ///< Calling ABAP system ID 00255 SAP_UC *client; ///< ABAP Client ("Mandant") 00256 SAP_UC *user; ///< ABAP User 00257 SAP_UC *progName; ///< Name of the calling APAB program (report, module pool) 00258 SAP_UC *sncName; ///< SNC key of the calling ABAP system, if SNC is enabled 00259 SAP_UC *ssoTicket; ///< Logon ticket of the ABAP user, if SSO2 or assertion tickets are enabled 00260 }RFC_SECURITY_ATTRIBUTES, *P_RFC_SECURITY_ATTRIBUTES; 00261 00262 /** \struct _RFC_UNIT_ATTRIBUTES 00263 * \ingroup bgrfc 00264 * 00265 * If the external program is the sender of the bgRFC unit, this structure is used to set a 00266 * bunch of special attributes that determine, how a bgRFC Unit will be processed in the backend. 00267 * The fields user, client, tCode and program are optional. If left empty, the NW RFC lib will 00268 * fill them with default values. The fields hostname, sendingDate and sendingTime should not be 00269 * filled, the lib fills them, when the unit is submitted. 00270 * 00271 * If the external program is the receiver of the bgRFC unit, you can use RfcGetUnitAttributes() 00272 * to obtain the values that were sent by the backend. 00273 */ 00274 typedef struct _RFC_UNIT_ATTRIBUTES{ 00275 short kernelTrace; ///< If != 0, the backend will write kernel traces, while executing this unit. 00276 short satTrace; ///< If != 0, the backend will write statistic records, while executing this unit. 00277 short unitHistory; ///< If != 0, the backend will keep a "history" for this unit. 00278 short lock; ///< Used only for type Q: If != 0, the unit will be written to the queue, but not processed. The unit can then be started manually in the ABAP debugger. 00279 short noCommitCheck; ///< Per default the backend will check during execution of a unit, whether one of the unit's function modules triggers an explicit or implicit COMMIT WORK. In this case the unit is aborted with an error, because the transactional integrity of this unit cannot be guaranteed. By setting "noCommitCheck" to true (!=0), this behavior can be suppressed, meaning the unit will be executed anyway, even if one of it's function modules "misbehaves" and triggers a COMMIT WORK. 00280 SAP_UC user[12+1]; ///< Sender User (optional). Default is current operating system User. 00281 SAP_UC client[3+1]; ///< Sender Client ("Mandant") (optional). Default is "000". 00282 SAP_UC tCode[20+1]; ///< Sender Transaction Code (optional). Default is "". 00283 SAP_UC program[40+1]; ///< Sender Program (optional). Default is current executable name. 00284 SAP_UC hostname[40+1]; ///< Sender hostname. Used only when the external program is server. In the client case the nwrfclib fills this automatically. 00285 RFC_DATE sendingDate; ///< Sending date in UTC (GMT-0). Used only when the external program is server. In the client case the nwrfclib fills this automatically. 00286 RFC_TIME sendingTime; ///< Sending time in UTC (GMT-0). Used only when the external program is server. In the client case the nwrfclib fills this automatically. 00287 }RFC_UNIT_ATTRIBUTES; 00288 00289 /** \struct _RFC_UNIT_IDENTIFIER 00290 * \ingroup bgrfc 00291 * 00292 * For convenience combines a unit's ID and its type. 00293 */ 00294 typedef struct _RFC_UNIT_IDENTIFIER{ 00295 SAP_UC unitType; ///< 'T' for "transactional" behavior (unit is executed synchronously), 'Q' for "queued" behavior (unit is written into a queue and executed asynchronously) 00296 RFC_UNITID unitID; ///< The 32 digit unit ID of the background unit. 00297 }RFC_UNIT_IDENTIFIER; 00298 00299 /** \enum _RFC_UNIT_STATE 00300 * \ingroup bgrfc 00301 * 00302 * Used in RfcGetUnitState() for inquiring the processing status of a background Unit that 00303 * we (or someone else) sent into this backend. 00304 */ 00305 typedef enum _RFC_UNIT_STATE{ 00306 RFC_UNIT_NOT_FOUND, ///< No information for this unit ID and unit type can be found in the target system. If you are sure, that target system, unit ID and unit type are correct, it means that your previous attempt did not even reach the target system. Send the unit again. However, if you get this status after the Confirm step has already been executed, it means that everything is ok. Don't re-execute in this case! 00307 RFC_UNIT_IN_PROCESS, ///< Backend system is still in the process of persisting (or executing if type 'T') the payload data. Give it some more time and check the state again later. If this takes "too long", an admin should probably have a look at why there is no progress here. 00308 RFC_UNIT_COMMITTED, ///< Data has been persisted (or executed if type 'T') ok on receiver side. Confirm event may now be triggered. 00309 RFC_UNIT_ROLLED_BACK, ///< An error of any type has occurred. Unit needs to be resent. 00310 RFC_UNIT_CONFIRMED ///< Temporary state between the Confirm event and the time, when the status data will be erased for good. Nothing to be done. Just delete the payload and status information on your side. 00311 }RFC_UNIT_STATE; 00312 00313 typedef RFC_CHAR RFC_ABAP_NAME[30+1]; ///< Name of ABAP function, function parameter or field in a structure. (null-terminated) 00314 typedef RFC_CHAR RFC_PARAMETER_DEFVALUE[30+1]; ///< Default value of a function module parameter. (null-terminated) 00315 typedef RFC_CHAR RFC_PARAMETER_TEXT[79+1]; ///< Parameter description for a function module parameter. (null-terminated) 00316 00317 00318 /** \enum _RFC_CALL_TYPE 00319 * \ingroup connection 00320 * 00321 * Used in RfcGetServerContext() for inquiring the type of 00322 * an incoming function call from the backend. 00323 */ 00324 typedef enum _RFC_CALL_TYPE{ 00325 RFC_SYNCHRONOUS, ///< It's a standard synchronous RFC call. 00326 RFC_TRANSACTIONAL, ///< This function call is part of a transactional LUW (tRFC). 00327 RFC_QUEUED, ///< This function call is part of a queued LUW (qRFC). 00328 RFC_BACKGROUND_UNIT ///< This function call is part of a background LUW (bgRFC). 00329 }RFC_CALL_TYPE; 00330 00331 /** \struct _RFC_SERVER_CONTEXT 00332 * \ingroup connection 00333 * 00334 * Used in RfcGetServerContext() for obtaining more information about the 00335 * current incoming function call. 00336 */ 00337 typedef struct _RFC_SERVER_CONTEXT{ 00338 RFC_CALL_TYPE type; ///< Specifies the type of function call. Depending on the value of this field, some of the other fields of this struct may be filled. 00339 RFC_TID tid; ///< If type is RFC_TRANSACTIONAL or RFC_QUEUED, this field is filled with the 24 digit TID of the tRFC/qRFC unit. 00340 RFC_UNIT_IDENTIFIER* unitIdentifier; ///< If type is RFC_BACKGROUND_UNIT, this pointer is set to the unit identifier of the LUW. Note: the pointer is valid only during the execution context of your server function. 00341 RFC_UNIT_ATTRIBUTES* unitAttributes; ///< If type is RFC_BACKGROUND_UNIT, this pointer is set to the unit attributes of the LUW. Note: the pointer is valid only during the execution context of your server function. 00342 }RFC_SERVER_CONTEXT; 00343 00344 00345 /** \struct _RFC_TYPE_DESC_HANDLE 00346 * \ingroup repository 00347 * 00348 * Handle to a cached metadata description of a structure or table type. 00349 */ 00350 typedef struct _RFC_TYPE_DESC_HANDLE {void* handle;} *RFC_TYPE_DESC_HANDLE; 00351 00352 /** \struct _RFC_FUNCTION_DESC_HANDLE 00353 * \ingroup repository 00354 * 00355 * Handle to a cached metadata description of a function module. 00356 */ 00357 typedef struct _RFC_FUNCTION_DESC_HANDLE {void* handle;} *RFC_FUNCTION_DESC_HANDLE; 00358 00359 /** \struct _RFC_CLASS_DESC_HANDLE 00360 * \ingroup repository 00361 * 00362 * Handle to a cached metadata description of a class. 00363 */ 00364 typedef struct _RFC_CLASS_DESC_HANDLE {void* handle;} *RFC_CLASS_DESC_HANDLE; 00365 00366 00367 /** \struct RFC_DATA_CONTAINER 00368 * \ingroup container 00369 * 00370 * Handle to a general data container (structure, table or function module). 00371 */ 00372 typedef struct RFC_DATA_CONTAINER {void* handle;} *DATA_CONTAINER_HANDLE; 00373 00374 /** \struct RFC_STRUCTURE_HANDLE 00375 * \ingroup container 00376 * 00377 * Handle to a data container for a structure. 00378 */ 00379 typedef DATA_CONTAINER_HANDLE RFC_STRUCTURE_HANDLE; 00380 00381 /** \struct RFC_FUNCTION_HANDLE 00382 * \ingroup container 00383 * 00384 * Handle to a data container for a function module. 00385 */ 00386 typedef DATA_CONTAINER_HANDLE RFC_FUNCTION_HANDLE; 00387 00388 /** \struct RFC_TABLE_HANDLE 00389 * \ingroup container 00390 * 00391 * Handle to a data container for a table. 00392 */ 00393 typedef DATA_CONTAINER_HANDLE RFC_TABLE_HANDLE; 00394 00395 /** \struct RFC_ABAP_OBJECT_HANDLE 00396 * \ingroup container 00397 * 00398 * Handle to a data container for an ABAP object instance. 00399 */ 00400 typedef DATA_CONTAINER_HANDLE RFC_ABAP_OBJECT_HANDLE; 00401 00402 00403 /** \struct _RFC_CONNECTION_HANDLE 00404 * \ingroup connection 00405 * 00406 * Handle to an RFC connection (client connection or server connection). 00407 * Returned by RfcOpenConnection() or RfcRegisterServer(). 00408 */ 00409 typedef struct _RFC_CONNECTION_HANDLE {void* handle;} *RFC_CONNECTION_HANDLE; 00410 00411 /** \struct _RFC_TRANSACTION_HANDLE 00412 * \ingroup transaction 00413 * 00414 * Handle to a data container for a tRFC/qRFC LUW. 00415 * Can be filled with several RFC_FUNCTION_HANDLEs. 00416 */ 00417 typedef struct _RFC_TRANSACTION_HANDLE {void* handle;} *RFC_TRANSACTION_HANDLE; 00418 00419 /** \struct _RFC_UNIT_HANDLE 00420 * \ingroup bgrfc 00421 * 00422 * Handle to a data container for a bgRFC LUW. 00423 * Can be filled with several RFC_FUNCTION_HANDLEs. 00424 */ 00425 typedef struct _RFC_UNIT_HANDLE {void* handle;} *RFC_UNIT_HANDLE; 00426 00427 /** \struct _RFC_CONNECTION_PARAMETER 00428 * \ingroup connection 00429 * 00430 * Structure used for connecting to a backend system via RfcOpenConnection() or 00431 * RfcRegisterServer(). For a list of supported parameters see these two functions or the file sapnwrfc.ini, which gives a complete list of all possible connection parameters. 00432 */ 00433 typedef struct _RFC_CONNECTION_PARAMETER 00434 { 00435 const SAP_UC * name; ///< The name of the connection parameter, like ashost, user, client. 00436 const SAP_UC * value; ///< The value of the given parameter. 00437 }RFC_CONNECTION_PARAMETER,*P_RFC_CONNECTION_PARAMETER; 00438 00439 /** \struct _RFC_FIELD_DESC 00440 * \ingroup repository 00441 * 00442 * Structure for reading (RfcGetFieldDescByIndex() or RfcGetFieldDescByName()) 00443 * or defining (RfcAddTypeField()) the properties of a field in a structure/table. 00444 */ 00445 typedef struct _RFC_FIELD_DESC 00446 { 00447 RFC_ABAP_NAME name; ///< Field name, null-terminated string 00448 RFCTYPE type; ///< Field data type 00449 /*SAPUNICODEOK_MIXEDLEN*/ 00450 unsigned nucLength; ///< Field length in bytes in a 1-byte-per-SAP_CHAR system 00451 /*SAPUNICODEOK_MIXEDLEN*/ 00452 unsigned nucOffset; ///< Field offset in bytes in a 1-byte-per-SAP_CHAR system 00453 /*SAPUNICODEOK_MIXEDLEN*/ 00454 unsigned ucLength; ///< Field length in bytes in a 2-byte-per-SAP_CHAR system 00455 /*SAPUNICODEOK_MIXEDLEN*/ 00456 unsigned ucOffset; ///< Field offset in bytes in a 2-byte-per-SAP_CHAR system 00457 unsigned decimals; ///< If the field is of type "packed number" (BCD), this member gives the number of decimals. 00458 RFC_TYPE_DESC_HANDLE typeDescHandle; ///< Pointer to an RFC_STRUCTURE_DESC structure for the nested sub-type if the type field is RFCTYPE_STRUCTURE or RFCTYPE_TABLE */ 00459 void* extendedDescription; ///< Not used by the NW RFC library. This parameter can be used by applications that want to store additional information in the repository (like F4 help values, e.g.). 00460 }RFC_FIELD_DESC,*P_RFC_FIELD_DESC; 00461 00462 /** \enum _RFC_DIRECTION 00463 * \ingroup repository 00464 * 00465 * Used in #RFC_PARAMETER_DESC::direction for specifying the direction of a function module parameter. 00466 */ 00467 typedef enum _RFC_DIRECTION 00468 { 00469 RFC_IMPORT = 0x01, ///< Import parameter. This corresponds to ABAP IMPORTING parameter. 00470 RFC_EXPORT = 0x02, ///< Export parameter. This corresponds to ABAP EXPORTING parameter. 00471 RFC_CHANGING = RFC_IMPORT | RFC_EXPORT, ///< Import and export parameter. This corresponds to ABAP CHANGING parameter. 00472 RFC_TABLES = 0x04 | RFC_CHANGING ///< Table parameter. This corresponds to ABAP TABLES parameter. 00473 }RFC_DIRECTION; 00474 00475 /** \struct _RFC_PARAMETER_DESC 00476 * \ingroup repository 00477 * 00478 * Structure for reading (RfcGetParameterDescByIndex() or RfcGetParameterDescByName()) 00479 * or defining (RfcAddParameter()) the properties of a parameter in a function module. 00480 */ 00481 typedef struct _RFC_PARAMETER_DESC 00482 { 00483 RFC_ABAP_NAME name; ///< Parameter name, null-terminated string 00484 RFCTYPE type; ///< Parameter data type 00485 RFC_DIRECTION direction; ///< Specifies whether the parameter is an input, output or bi-directional parameter 00486 unsigned nucLength; ///< Parameter length in bytes in a 1-byte-per-SAP_CHAR system 00487 unsigned ucLength; ///< Parameter length in bytes in a 2-byte-per-SAP_CHAR system 00488 unsigned decimals; ///< Gives the number of decimals in case or a packed number (BCD) 00489 RFC_TYPE_DESC_HANDLE typeDescHandle; ///< Handle to the structure definition in case this parameter is a structure or table 00490 RFC_PARAMETER_DEFVALUE defaultValue; ///< Default value as defined in SE37 00491 RFC_PARAMETER_TEXT parameterText; ///< Description text of the parameter as defined in SE37. Null-terminated string. 00492 RFC_BYTE optional; ///< Specifies whether this parameter is defined as optional in SE37. 1 is optional, 0 non-optional 00493 void* extendedDescription; ///< This field can be used by the application programmer (i.e. you) to store arbitrary extra information. 00494 }RFC_PARAMETER_DESC,*P_RFC_PARAMETER_DESC; 00495 00496 /** \struct _RFC_EXCEPTION_DESC 00497 * \ingroup repository 00498 * 00499 * Structure for reading (RfcGetExceptionDescByIndex() or RfcGetExceptionDescByName()) 00500 * or defining (RfcAddException()) the properties of an exception key in a function module. 00501 */ 00502 typedef struct _RFC_EXCEPTION_DESC 00503 { 00504 SAP_UC key[128]; ///< Exception key 00505 SAP_UC message[512]; ///< Error message (exception text as defined in SE37) 00506 } RFC_EXCEPTION_DESC, *P__RFC_EXCEPTION_DESC; 00507 00508 00509 /** \enum _RFC_CLASS_ATTRIBUTE_TYPE 00510 * \ingroup repository 00511 * 00512 * Determines the type of an ABAP Object attribute. 00513 */ 00514 typedef enum _RFC_CLASS_ATTRIBUTE_TYPE { 00515 RFC_CLASS_ATTRIBUTE_INSTANCE, ///< Instance attribute (object member) 00516 RFC_CLASS_ATTRIBUTE_CLASS, ///< Class attribute (global) 00517 RFC_CLASS_ATTRIBUTE_CONSTANT ///< A constant 00518 } RFC_CLASS_ATTRIBUTE_TYPE; 00519 00520 typedef RFC_CHAR RFC_CLASS_ATTRIBUTE_DEFVALUE[30+1]; ///< Default value of a function module parameter. (null-terminated) 00521 typedef RFC_CHAR RFC_CLASS_NAME[30+1]; ///< Default value of a function module parameter. (null-terminated) 00522 typedef RFC_CHAR RFC_CLASS_ATTRIBUTE_DESCRIPTION[511+1]; ///< Default value of a function module parameter. (null-terminated) 00523 00524 /** \struct _RFC_CLASS_ATTRIBUTE_DESC 00525 * \ingroup repository 00526 * 00527 * Structure for reading (RfcGetParameterDescByIndex() or RfcGetParameterDescByName()) 00528 * or defining (RfcAddParameter()) the properties of a parameter in a function module. 00529 */ 00530 typedef struct _RFC_CLASS_ATTRIBUTE_DESC 00531 { 00532 RFC_ABAP_NAME name; ///< Attribute name, null-terminated string 00533 RFCTYPE type; ///< Attribute data type 00534 unsigned nucLength; ///< Attribute length in bytes in a 1-byte-per-SAP_CHAR system 00535 unsigned ucLength; ///< Attribute length in bytes in a 2-byte-per-SAP_CHAR system 00536 unsigned decimals; ///< Gives the number of decimals in case this attribute is a packed number (BCD) 00537 RFC_TYPE_DESC_HANDLE typeDescHandle; ///< Handle to the structure definition in case this attribute is a structure or table 00538 RFC_CLASS_ATTRIBUTE_DEFVALUE defaultValue; ///< Default value as defined in SE37 00539 RFC_CLASS_NAME declaringClass; ///< Declaring class 00540 RFC_CLASS_ATTRIBUTE_DESCRIPTION description; ///< Attribute description, null terminated, may be null 00541 unsigned isReadOnly; ///< This attribute is read only if isReadOnly != 0 00542 RFC_CLASS_ATTRIBUTE_TYPE attributeType; ///< The attribute type tells you, whether this attribute is an instance attribute, a class attribute or a constant. 00543 void* extendedDescription; ///< This field can be used by the application programmer (i.e. you) to store arbitrary extra information. 00544 }RFC_CLASS_ATTRIBUTE_DESC,*P_RFC_CLASS_ATTRIBUTE_DESC; 00545 00546 00547 #ifdef __cplusplus 00548 extern "C" 00549 { 00550 #endif 00551 typedef RFC_RC (SAP_API* RFC_SERVER_FUNCTION)(RFC_CONNECTION_HANDLE rfcHandle, RFC_FUNCTION_HANDLE funcHandle, RFC_ERROR_INFO* errorInfo); 00552 typedef RFC_RC (SAP_API* RFC_ON_CHECK_TRANSACTION)(RFC_CONNECTION_HANDLE rfcHandle, SAP_UC const *tid); 00553 typedef RFC_RC (SAP_API* RFC_ON_COMMIT_TRANSACTION)(RFC_CONNECTION_HANDLE rfcHandle, SAP_UC const *tid); 00554 typedef RFC_RC (SAP_API* RFC_ON_ROLLBACK_TRANSACTION)(RFC_CONNECTION_HANDLE rfcHandle, SAP_UC const *tid); 00555 typedef RFC_RC (SAP_API* RFC_ON_CONFIRM_TRANSACTION)(RFC_CONNECTION_HANDLE rfcHandle, SAP_UC const *tid); 00556 00557 typedef RFC_RC (SAP_API* RFC_FUNC_DESC_CALLBACK)(SAP_UC const *functionName, RFC_ATTRIBUTES rfcAttributes, RFC_FUNCTION_DESC_HANDLE *funcDescHandle); 00558 typedef RFC_RC (SAP_API* RFC_PM_CALLBACK)(RFC_CONNECTION_HANDLE rfcHandle, SAP_UC const *functionName, SAP_RAW *eppBuffer, size_t eppBufferSize, size_t *eppLength); 00559 00560 typedef RFC_RC (SAP_API* RFC_ON_CHECK_UNIT)(RFC_CONNECTION_HANDLE rfcHandle, RFC_UNIT_IDENTIFIER const *identifier); 00561 typedef RFC_RC (SAP_API* RFC_ON_COMMIT_UNIT)(RFC_CONNECTION_HANDLE rfcHandle, RFC_UNIT_IDENTIFIER const *identifier); 00562 typedef RFC_RC (SAP_API* RFC_ON_ROLLBACK_UNIT)(RFC_CONNECTION_HANDLE rfcHandle, RFC_UNIT_IDENTIFIER const *identifier); 00563 typedef RFC_RC (SAP_API* RFC_ON_CONFIRM_UNIT)(RFC_CONNECTION_HANDLE rfcHandle, RFC_UNIT_IDENTIFIER const *identifier); 00564 typedef RFC_RC (SAP_API* RFC_ON_GET_UNIT_STATE)(RFC_CONNECTION_HANDLE rfcHandle, RFC_UNIT_IDENTIFIER const *identifier, RFC_UNIT_STATE* unitState); 00565 typedef RFC_RC (SAP_API* RFC_ON_PASSWORD_CHANGE)(SAP_UC const *sysId, SAP_UC const *user, SAP_UC const *client, 00566 SAP_UC *password, unsigned passwordLength, 00567 SAP_UC *newPassword, unsigned newPasswordLength, 00568 RFC_ERROR_INFO* cause); 00569 typedef RFC_RC (SAP_API* RFC_ON_AUTHORIZATION_CHECK)(RFC_CONNECTION_HANDLE rfcHandle, RFC_SECURITY_ATTRIBUTES *secAttributes, RFC_ERROR_INFO* errorInfo); 00570 00571 /* ***********************************************************************/ 00572 /* */ 00573 /* General API & Utilities */ 00574 /* */ 00575 /* ***********************************************************************/ 00576 00577 /** 00578 * \brief Initialization of internal variables 00579 * \ingroup general 00580 * 00581 * Sets up the internal state of the sapnwrfc library and initially reads 00582 * and evaluates the sapnwrfc.ini file. In case the content or location of 00583 * the sapnwrfc.ini file changes later on, reload it via RfcReloadIniFile(). 00584 * %RfcInit() no longer needs to be called explicitly. The RFC library does 00585 * this automatically on DLL load. 00586 * \return RFC_RC 00587 */ 00588 DECL_EXP RFC_RC SAP_API RfcInit(void); 00589 00590 /** 00591 * \brief Get information about currently loaded sapnwrfc library. 00592 * \ingroup general 00593 * 00594 * Fills the provided unsigneds with the SAP release values, e.g. *majorVersion = 7, 00595 * *minorVersion = 10, *patchLevel = 42. 00596 * \out *majorVersion 00597 * \out *minorVersion 00598 * \out *patchLevel 00599 * \return Version information in string format. 00600 * \warning Don't free the returned SAP_UC pointer, it's static memory... 00601 */ 00602 DECL_EXP const SAP_UC* SAP_API RfcGetVersion(unsigned* majorVersion, unsigned* minorVersion, unsigned* patchLevel); 00603 00604 /** 00605 * \brief Sets the directory in which to search for the sapnwrfc.ini file. 00606 * \ingroup general 00607 * 00608 * By default the sapnwrfc library searches for the sapnwrfc.ini in the current 00609 * working directory of the process. If you want to keep it in a different directory, 00610 * use this function to tell the sapnwrfc library about the new path. 00611 * \note After you have changed the directory, the NW RFC lib automatically loads 00612 * the contents of the new sapnwrfc.ini file from that directory. 00613 * 00614 * \in *pathName The full (absolute) path of the directory, in which the sapnwrfc 00615 * library should look for the sapnwrfc.ini file. A path relative to the current 00616 * working directory of the process also works. 00617 * \out *errorInfo Detail information in case anything goes wrong. 00618 * \return RFC_RC 00619 */ 00620 DECL_EXP RFC_RC SAP_API RfcSetIniPath(const SAP_UC* pathName, RFC_ERROR_INFO* errorInfo); 00621 00622 /** 00623 * \brief Loads the contents of the sapnwrfc.ini file into memory. 00624 * \ingroup general 00625 * 00626 * Searches the directory given by RfcSetIniPath() (or the current working directory) 00627 * for the file sapnwrfc.ini and loads its contents into memory. 00628 * 00629 * \out *errorInfo Detail information in case anything goes wrong. Note: if a file 00630 * with the name sapnwrfc.ini does not exist in the given directory, this is not 00631 * considered an error! Default settings are used in this case. 00632 * \return RFC_RC 00633 */ 00634 DECL_EXP RFC_RC SAP_API RfcReloadIniFile(RFC_ERROR_INFO* errorInfo); 00635 00636 /** 00637 * \brief Sets the current trace level of the specified RFC connection or destination to the new value. 00638 * \ingroup general 00639 * 00640 * \note If both of connection and destination are NULL, this function sets the "global" 00641 * trace level. See below. 00642 * \in connection A handle to a currently open RFC connection (client or server connection). 00643 * The new trace level will be effective immediately. 00644 * \in *destination Null-terminated string specifying a client or server destination as defined 00645 * via a DEST=... entry in sapnwrfc.ini. The new trace level will be used for new connections 00646 * to that destination opened after the %RfcSetTraceLevel() call. Already existing connections to 00647 * that destination will not be effected. 00648 * \in traceLevel The new trace level. Must be between 0 and 3. The meaning of those four values 00649 * is as follows: 00650 * - 0: Off. Only severe errors are logged to the dev_rfc.trc file. 00651 * - 1: Brief. All API calls (except for the setter and getter functions) and important attributes 00652 * like codepages, RFC headers, logon parameters are traced. Trace is written to a file named 00653 * rfc<pid>.trc or rfc<pid>_<tid>.trc, depending on whether tracing is done 00654 * on a "per-process" basis or a "per-thread" basis. <pid> is the current process ID, 00655 * <tid> the current thread ID. 00656 * - 2: Verbose. In addition to 1, the values of the "scalar" RFC parameters as well as the contents 00657 * of the network containers are traced. Scalar parameters are primitive types (CHAR, INT, FLOAT, etc) 00658 * and flat structures. 00659 * - 3: Full. In addition to 2 the contents of nested structures and tables as well as all API calls 00660 * of setter and getter functions are traced. 00661 * \out *errorInfo Detail information in case the specified connection or destination does not exist. 00662 * \return RFC_OK, RFC_INVALID_HANDLE or RFC_INVALID_PARAMETER 00663 * 00664 * \note In general RFC trace can be activated/deactivated in 6 different ways: 00665 * - By setting the parameter RFC_TRACE=[0|1|2|3] in the DEFAULT section of the sapnwrfc.ini file. 00666 * This value applies to all destinations, for which no explicit trace level has been set. 00667 * ("Global" trace level.) 00668 * - By setting the parameter TRACE=[0|1|2|3] in a specific destination section of sapnwrfc.ini. 00669 * it applies to that destination only and overrules the "global" trace level from the DEFAULT section. 00670 * - By setting the environment variable RFC_TRACE=[0|1|2|3]. This overrules the setting from the 00671 * DEFAULT section of sapnwrfc.ini. 00672 * - Via %RfcSetTraceLevel(). If connection and destination are NULL, this function sets the global 00673 * trace level and overrules the value from the DEFAULT section of sapnwrfc.ini as well as the environment 00674 * variable RFC_TRACE. If connection is non-NULL, it sets the trace level for the current connection only, 00675 * and if destination is non-NULL, it sets the trace level for that destination, overruling the value from 00676 * this destination's section in the sapnwrfc.ini file. 00677 * - By passing a {name=TRACE, value=[0|1|2|3]} pair in the RFC_CONNECTION_PARAMETER array used in 00678 * RfcOpenConnection(), RfcRegisterServer() or RfcStartServer(). If that RFC_CONNECTION_PARAMETER array 00679 * also contains a {name=DEST, value=...} pair, the trace parameter from the array overrules the value 00680 * from this destination's sapnwrfc.ini section. 00681 * - In case the program is a server program: by activating the trace flag for the corresponding destination 00682 * in SM59. The trace setting on backend side is then "inherited" by the external side. 00683 * 00684 * \note For more information on trace settings see the sample sapnwrfc.ini file contained in the demo folder. 00685 */ 00686 DECL_EXP RFC_RC SAP_API RfcSetTraceLevel(RFC_CONNECTION_HANDLE connection, SAP_UC* destination, unsigned traceLevel, RFC_ERROR_INFO* errorInfo); 00687 00688 00689 /** 00690 * \brief Changes the character encoding to be used in trace files. 00691 * \ingroup general 00692 * 00693 * This function has the same effect as the sapnwrfc.ini parameter RFC_TRACE_ENCODING. 00694 * See the documentation of that parameter in the sample ini file contained in the 00695 * /demo directory of the NW RFC SDK. 00696 * 00697 * \note This API call affects only new trace files that will be opened after the call. 00698 * The character encoding of already existing trace files is not changed in order to 00699 * prevent confusion and garbage data... 00700 * 00701 * 00702 * \in *traceEncoding The new encoding. Possible values are "UTF-16", "UTF-8" and 00703 * "DEFAULT". On Windows UTF-16 is recommended for faster performance. "DEFAULT" corresponds 00704 * to the operating system's default character encoding, which is CP1252 or ISO-8859-1 on 00705 * most Windows systems and UTF-8 on most Linux systems. 00706 * \out *errorInfo Detail information in case of an invalid traceEncoding input. 00707 * \return RFC_RC 00708 */ 00709 DECL_EXP RFC_RC SAP_API RfcSetTraceEncoding(SAP_UC* traceEncoding, RFC_ERROR_INFO* errorInfo); 00710 00711 00712 /** 00713 * \brief Changes the directory where the NW RFC lib should write trace files. 00714 * \ingroup general 00715 * 00716 * This function has the same effect as the sapnwrfc.ini parameter RFC_TRACE_DIR. 00717 * See the documentation of that parameter in the sample ini file contained in the 00718 * /demo directory of the NW RFC SDK. 00719 * 00720 * \note This API call affects only new trace files that will be opened after the call. 00721 * The directory of already existing trace files is not changed in order to 00722 * prevent confusion and garbage data... 00723 * 00724 * 00725 * \in *traceDir The new directory. Can be an absolute or relative path name. 00726 * The directory needs to exist prior to calling this API. The NW RFC lib will not 00727 * attempt to create non-existing directories. 00728 * \out *errorInfo Detail information in case of an invalid traceEncoding input. 00729 * \return RFC_RC 00730 */ 00731 DECL_EXP RFC_RC SAP_API RfcSetTraceDir(SAP_UC* traceDir, RFC_ERROR_INFO* errorInfo); 00732 00733 00734 /** 00735 * \brief Changes the way the NW RFC lib writes trace files. 00736 * \ingroup general 00737 * 00738 * This function has the same effect as the sapnwrfc.ini parameter RFC_TRACE_TYPE. 00739 * See the documentation of that parameter in the sample ini file contained in the 00740 * /demo directory of the NW RFC SDK. 00741 * 00742 * \note This API call closes currently open trace files and then changes to 00743 * "one file per process" or one "file per thread". 00744 * If the NW RFC lib is already using the given trace type, it does nothing. 00745 * 00746 * 00747 * \in *traceType Must be either "PROCESS" or "THREAD". 00748 * \out *errorInfo Detail information in case of an invalid traceEncoding input. 00749 * \return RFC_RC 00750 */ 00751 DECL_EXP RFC_RC SAP_API RfcSetTraceType(SAP_UC* traceType, RFC_ERROR_INFO* errorInfo); 00752 00753 00754 /** 00755 * \brief Sets the global CPIC trace level used by the underlying CPIC libabry to write CPIC tracing information 00756 * to the CPIC trace file cpic_<pid>.trc, where pid is the process ID of the current process. The CPIC trace file 00757 * is located in the same directory where the RFC trace files are located. 00758 * \ingroup general 00759 * 00760 * This function has the same effect as the sapnwrfc.ini parameter CPIC_TRACE_LEVEL. 00761 * See the documentation of that parameter in the sample ini file contained in the 00762 * /demo directory of the NW RFC SDK. 00763 * 00764 * \in traceLevel Must be a value between 0 to 3, where 0 turns tracing off. 00765 * \out *errorInfo Detail information in case of an error. 00766 * \return RFC_RC 00767 */ 00768 DECL_EXP RFC_RC SAP_API RfcSetCpicTraceLevel(unsigned traceLevel, RFC_ERROR_INFO* errorInfo); 00769 00770 00771 /** 00772 * \brief Converts data in UTF-8 format to SAP_UC strings. 00773 * \ingroup general 00774 * 00775 * \in *utf8 Pointer to UTF-8 data to be converted 00776 * \in utf8Length Number of bytes to convert 00777 * \out *sapuc Pre-allocated output buffer, which will receive the result. Output will be null-terminated. 00778 * \inout *sapucSize Needs to be filled with the size of the given output buffer in SAP_UC characters. 00779 * If the given buffer turns out to be too small (return code RFC_BUFFER_TOO_SMALL), it will be filled 00780 * with the required buffer size that would be necessary to convert the given input data. 00781 * \out *resultLength If the output buffer was large enough, resultLength will be filled with the 00782 * length of the output string in SAP_UC characters. 00783 * \out *errorInfo Will be filled with additional error information in case of an error. 00784 * \return RFC_RC 00785 */ 00786 DECL_EXP RFC_RC SAP_API RfcUTF8ToSAPUC(const RFC_BYTE *utf8, unsigned utf8Length, SAP_UC *sapuc, unsigned *sapucSize, unsigned *resultLength, RFC_ERROR_INFO *errorInfo); 00787 00788 /** 00789 * \brief Converts data in SAP_UC format to UTF-8 format 00790 * \ingroup general 00791 * 00792 * \in *sapuc Pointer to SAP_UC data to be converted 00793 * \in sapucLength Number of characters to convert 00794 * \out *utf8 Pre-allocated output buffer, which will receive the result. Output will be null-terminated. 00795 * \inout *utf8Size Needs to be filled with the size of the given output buffer in bytes. 00796 * If the given buffer turns out to be too small (return code RFC_BUFFER_TOO_SMALL), it will be filled 00797 * with the required buffer size that would be necessary to convert the given input data. 00798 * \out *resultLength If the output buffer was large enough, resultLength will be filled with the 00799 * length of the output string in bytes. 00800 * \out *errorInfo Will be filled with additional error information in case of an error. 00801 * \return RFC_OK or RFC_BUFFER_TOO_SMALL 00802 */ 00803 DECL_EXP RFC_RC SAP_API RfcSAPUCToUTF8(const SAP_UC *sapuc, unsigned sapucLength, RFC_BYTE *utf8, unsigned *utf8Size, unsigned *resultLength, RFC_ERROR_INFO *errorInfo); 00804 00805 /** 00806 * \brief Converts an RFC_RC return code to a human readable string for logging purposes. 00807 * \ingroup general 00808 * 00809 * \in rc Return code to covert to string 00810 * \return String representation of the return code 00811 * \warning Don't free the returned SAP_UC pointer -- its's static memory... 00812 */ 00813 DECL_EXP const SAP_UC* SAP_API RfcGetRcAsString(RFC_RC rc); 00814 00815 /** 00816 * \brief Converts an RFCTYPE data type indicator to a human readable string for logging purposes. 00817 * \ingroup general 00818 * 00819 * \in type Data type indicator to convert 00820 * \return String representation of the type 00821 * \warning Don't free the returned SAP_UC pointer -- its's static memory... 00822 */ 00823 DECL_EXP const SAP_UC* SAP_API RfcGetTypeAsString(RFCTYPE type); 00824 00825 /** 00826 * \brief Converts an RFC_DIRECTION direction indicator to a human readable string for logging purposes. 00827 * \ingroup general 00828 * 00829 * \in direction Direction indicator to convert 00830 * \return String representation of the direction 00831 * \warning Don't free the returned SAP_UC pointer -- its's static memory... 00832 */ 00833 DECL_EXP const SAP_UC* SAP_API RfcGetDirectionAsString(RFC_DIRECTION direction); 00834 00835 00836 /* ***********************************************************************/ 00837 /* */ 00838 /* Connection related API */ 00839 /* */ 00840 /* ***********************************************************************/ 00841 00842 /** 00843 * \brief Opens an RFC client connection for invoking ABAP function modules in an R/3 backend. 00844 * \ingroup connection 00845 * 00846 * Opens a client connection to an SAP System. The connectionParams may contain the following name-value pairs: 00847 * - client, user, passwd, lang, trace 00848 * 00849 * and additionally one of 00850 * -# Direct application server logon: ashost, sysnr. 00851 * -# Logon with load balancing: mshost, msserv, sysid, group.\n 00852 * msserv is needed only, if the service of the message server is 00853 * not defined as sapms<SYSID> in /etc/services. 00854 * 00855 * When logging on with SNC, user&passwd are to be replaced by 00856 * - snc_qop, snc_myname, snc_partnername and optionally snc_lib. 00857 * 00858 * (If snc_lib is not specified, the RFC library uses the "global" GSS library 00859 * defined via environment variable SNC_LIB.) 00860 * 00861 * When logging on with SSO Ticket, you can use mysapsso2 instead of user&passwd. 00862 * The old SSO format (mysapsso) is no longer supported. 00863 * 00864 * Alternatively the connection parameters can be defined in the config file 00865 * sapnwrfc.ini. In this case you just pass the parameter dest=... and all 00866 * parameters that are missing in the sapnwrfc.ini entry into %RfcOpenConnection(). 00867 * 00868 * For a complete list of logon parameters to be used in connectionParams as well as in the 00869 * sapnwrfc.ini file, see the sample sapnwrfc.ini file in the SDK's demo folder. 00870 * 00871 * If the logon was ok, %RfcOpenConnection() returns a client connection handle, which can be used in RfcInvoke(). 00872 * Otherwise the return value is NULL and errorInfo contains a detailed error description. 00873 * errorInfo->code will be one of: 00874 * - RFC_INVALID_PARAMETER One of the connectionParams was invalid 00875 * - RFC_COMMUNICATION_FAILURE Something is wrong with the network or network settings 00876 * - RFC_LOGON_FAILURE Invalid user/password/ticket/certificate 00877 * - RFC_ABAP_RUNTIME_FAILURE Something is wrong with the R/3 backend 00878 * - RFC_MEMORY_INSUFFICIENT A malloc failed when trying to allocate a temporary buffer 00879 * 00880 * 00881 * \in *connectionParams An array of RFC_CONNECTION_PARAMETERs with the names as described above 00882 * and the values as necessary in your landscape. 00883 * \in paramCount Number of parameters in the above array. 00884 * \out *errorInfo Returns more error details, if the connect attempt fails. 00885 * \return A handle to an RFC client connection that can be used for invoking ABAP function modules in the backend. 00886 */ 00887 DECL_EXP RFC_CONNECTION_HANDLE SAP_API RfcOpenConnection(RFC_CONNECTION_PARAMETER const * connectionParams, unsigned paramCount, RFC_ERROR_INFO* errorInfo); 00888 00889 /** \brief Registers a server connection at an SAP gateway. 00890 * \ingroup connection 00891 * 00892 * The connectionParams may contain the following name-value pairs: 00893 * - gwhost, gwserv, program_id, trace, and the parameters for SNC communication as in RfcOpenConnection(). 00894 * 00895 * Program_id corresponds to an RFC destination in SM59 of type "T" in registration mode. 00896 * 00897 * For a complete list of logon parameters to be used in connectionParams as well as in the 00898 * sapnwrfc.ini file, see the sample sapnwrfc.ini file in the SDK's demo folder. 00899 * 00900 * If the connection registration was ok, %RfcRegisterServer() returns a server connection handle, which can 00901 * be used in RfcListenAndDispatch(). 00902 * Otherwise the return value is NULL and errorInfo contains information similar to the RfcOpenConnection() case. 00903 * 00904 * 00905 * \in *connectionParams An array of RFC_CONNECTION_PARAMETERs with the names as described above 00906 * and the values as necessary in your landscape. 00907 * \in paramCount Number of parameters in the above array. 00908 * \out *errorInfo Returns more error details, if the connect attempt fails. 00909 * \return A handle to an RFC server connection that can be used for listening for function module requests from the backend. 00910 */ 00911 DECL_EXP RFC_CONNECTION_HANDLE SAP_API RfcRegisterServer(RFC_CONNECTION_PARAMETER const * connectionParams, unsigned paramCount, RFC_ERROR_INFO* errorInfo); 00912 00913 /** \brief Allows a program to be used as an RFC server which is started by the backend on demand. 00914 * \ingroup connection 00915 * 00916 * This API needs to be called, if the server program is to be started by the R/3 application server. 00917 * (RFC destination in SM59 of type "T" in startup mode.) 00918 * argc and argv are the inputs of the mainU function. The R/3 application server passes the correct command line to 00919 * the program, when starting it up, so you only need to forward these two parameters to %RfcStartServer(). 00920 * connectionParams is optional and is only needed, if you want to add additional logon parameters to the 00921 * ones coming from the command line, e.g for activating trace. 00922 * 00923 * Like RfcRegisterServer(), the function returns a server connection handle that can be used in RfcListenAndDispatch(). 00924 * The mechanism of this kind of RFC destination thus works as follows: 00925 * -# The R/3 application server opens a telnet connection to the host, where your server program is located, and 00926 * starts the program with the necessary logon parameters. (Or creates a child process, if the startup 00927 * method is "Start on application server".) 00928 * -# Your server program calls RfcStartServer, which opens an RFC connection back to the R/3 system. 00929 * -# The R/3 system then makes the function call over that RFC connection. 00930 * 00931 * The main differences of "startup mode" compared to the "registration mode" are: 00932 * - Advantage: no logon parameters need to be maintained in the server program. (Unless you want to open 00933 * an additional client connection for looking up function module metadata (RFC_FUNCTION_DESC_HANDLEs) in the 00934 * R/3 DDIC.) 00935 * - Disadvantage: every single function call creates a new process and a telnet connection in addition to 00936 * the actual RFC connection. 00937 * 00938 * 00939 * \in argc From mainU() (command line supplied by backend) 00940 * \in **argv From mainU() (command line supplied by backend) 00941 * \in *connectionParams May optionally contain additional logon parameters 00942 * \in paramCount Length of the connection parameter array above 00943 * \out *errorInfo Returns more error details, if the connect attempt fails. 00944 * \return A handle to an RFC server connection that can be used for listening for function module requests from the backend. 00945 */ 00946 DECL_EXP RFC_CONNECTION_HANDLE SAP_API RfcStartServer(int argc, SAP_UC **argv, RFC_CONNECTION_PARAMETER const * connectionParams, unsigned paramCount, RFC_ERROR_INFO* errorInfo); 00947 00948 /** \brief Closes an RFC connection 00949 * \ingroup connection 00950 * 00951 * Can be used to close client connections as well as server connections, when they are no longer needed. 00952 * 00953 * 00954 * \in rfcHandle Connection to be closed 00955 * \out *errorInfo Error details in case closing the connection fails. (Can usually be ignored...) 00956 * \return RFC_RC 00957 */ 00958 DECL_EXP RFC_RC SAP_API RfcCloseConnection(RFC_CONNECTION_HANDLE rfcHandle, RFC_ERROR_INFO* errorInfo); 00959 00960 /** \brief Checks an RFC connection 00961 * \ingroup connection 00962 * 00963 * Can be used to check whether a client/server connection has already been closed, 00964 * or whether the NW RFC library still "considers" the connection to be open. 00965 * Note that this does not guarantee that the connection is indeed still alive: 00966 * A firewall may silently have closed the connection without notifying the endpoints. 00967 * If you want to find out, whether the connection is still alive, you'll have to 00968 * use the more expensive RfcPing(). 00969 * 00970 * 00971 * \in rfcHandle Connection to be checked 00972 * \out *isValid 1, if the connection is still found in the internal connection management, 0 otherwise. 00973 * \out *errorInfo Error details in case closing the connection fails. (Can usually be ignored...) 00974 * \return RFC_RC 00975 */ 00976 DECL_EXP RFC_RC SAP_API RfcIsConnectionHandleValid(RFC_CONNECTION_HANDLE rfcHandle, int* isValid, RFC_ERROR_INFO *errorInfo); 00977 00978 /** \brief RFC_RC SAP_API RfcResetServerContext 00979 * \ingroup connection 00980 * 00981 * Resets the SAP server context ("user context / ABAP session context") associated with the given client 00982 * connection, but does not close the connection. 00983 * 00984 * 00985 * \in rfcHandle The client connection, whose server context is to be reset. 00986 * \out *errorInfo Error details in case resetting the server context fails. (Better close the connection in that case.) 00987 * \return RFC_RC 00988 */ 00989 DECL_EXP RFC_RC SAP_API RfcResetServerContext(RFC_CONNECTION_HANDLE rfcHandle, RFC_ERROR_INFO* errorInfo); 00990 00991 /** \brief Ping the remote communication partner through the passed connection handle. 00992 * \ingroup connection 00993 * 00994 * Sends a ping to the backend in order to check, whether the connection is still alive. 00995 * Can be used on both, client connections as well as server connections. 00996 * \warning Do not use inside a server function implementation. 00997 * 00998 * 00999 * \in rfcHandle The connection to check 01000 * \out *errorInfo More error details in case the connection is broken. 01001 * \return RFC_RC 01002 */ 01003 DECL_EXP RFC_RC SAP_API RfcPing(RFC_CONNECTION_HANDLE rfcHandle, RFC_ERROR_INFO* errorInfo); 01004 01005 /** \brief Returns details about the current client or server connection. 01006 * \ingroup connection 01007 * 01008 * See documentation of RFC_ATTRIBUTES. 01009 * 01010 * 01011 * \in rfcHandle RFC connection 01012 * \out *attr Information about the current connection and the communication partner on the other side. 01013 * \out *errorInfo Additional error information (e.g. connection already closed). 01014 * \return RFC_RC 01015 */ 01016 DECL_EXP RFC_RC SAP_API RfcGetConnectionAttributes(RFC_CONNECTION_HANDLE rfcHandle, RFC_ATTRIBUTES* attr, RFC_ERROR_INFO* errorInfo); 01017 01018 /** \brief Inside a server function, returns details about the current execution context. 01019 * \ingroup connection 01020 * 01021 * See documentation of RFC_SERVER_CONTEXT. 01022 * 01023 * 01024 * \in rfcHandle RFC server connection 01025 * \out *context Information about the current server execution context. 01026 * \out *errorInfo Additional error information (e.g. connection is not a server connection). 01027 * \return RFC_RC 01028 */ 01029 DECL_EXP RFC_RC SAP_API RfcGetServerContext(RFC_CONNECTION_HANDLE rfcHandle, RFC_SERVER_CONTEXT* context, RFC_ERROR_INFO* errorInfo); 01030 01031 /** \brief Gets the partner's SSO2 ticket, if any. 01032 * \ingroup connection 01033 * 01034 * Can be used only with a server connection inside the implementation of a server function. 01035 * 01036 * 01037 * \in rfcHandle RFC server connection 01038 * \out *ssoTicket Pre-allocated buffer, which will receive the backend user's SSO2 ticket (signed user information in base64 format) 01039 * \inout *length Needs to be filled with the buffer length of ssoTicket. The return value will be the string 01040 * length of the returned ticket (if buffer was large enough) or the required buffer size (if RFC_BUFFER_TOO_SMALL). 01041 * \out *errorInfo More error details in case there is no ticket. 01042 * \return RFC_RC 01043 * \warning 01044 */ 01045 DECL_EXP RFC_RC SAP_API RfcGetPartnerSSOTicket(RFC_CONNECTION_HANDLE rfcHandle, SAP_UC *ssoTicket, unsigned *length, RFC_ERROR_INFO* errorInfo); 01046 01047 /** \brief Gets the partner's SNC name, if any. 01048 * \ingroup connection 01049 * 01050 * 01051 * \in rfcHandle RFC server connection. If this function is executed on a client connection, RFC_ILLEGAL_STATE will be returned. 01052 * \out *sncName Pre-allocated buffer, which will receive the backend user's SNC name (null-terminated string). 01053 * \in length Size of the pre-allocated buffer. This information is coming from the GSS library, therefore 01054 * unfortunately the feature of assigning the used/required length to an output parameter is not possible in this case. 01055 * The maximum length of an SNC name is 256. 01056 * \out *errorInfo More error details in case SNC is not active. 01057 * \return RFC_RC 01058 */ 01059 DECL_EXP RFC_RC SAP_API RfcGetPartnerSNCName(RFC_CONNECTION_HANDLE rfcHandle, SAP_UC *sncName, unsigned length, RFC_ERROR_INFO* errorInfo); 01060 01061 /** \brief Gets partner's SNC key, if any. 01062 * \ingroup connection 01063 * 01064 * 01065 * \in rfcHandle RFC server connection. If this function is executed on a client connection, RFC_ILLEGAL_STATE will be returned. 01066 * \out *sncKey Pre-allocated buffer, which will receive the backend user's SNC key. 01067 * \inout *length Needs to be filled with the buffer length of ssoTicket. The return value will be the byte 01068 * length of the returned key (if buffer was large enough). Unfortunately in case of RFC_BUFFER_TOO_SMALL 01069 * the required size is not returned by the GSS library. 01070 * The maximum length of an SNC key is 1024. 01071 * \out *errorInfo More error details in case SNC is not active. 01072 * \return RFC_RC 01073 */ 01074 DECL_EXP RFC_RC SAP_API RfcGetPartnerSNCKey(RFC_CONNECTION_HANDLE rfcHandle, SAP_RAW *sncKey, unsigned *length, RFC_ERROR_INFO* errorInfo); 01075 01076 /** \brief Converts SNC name to SNC key. 01077 * \ingroup connection 01078 * 01079 * 01080 * \in *sncLib Optional: file name of the GSS library to be used for the conversion. If not specified, the 01081 * "global" GSS library (environment variable SNC_LIB) will be used. 01082 * \in *sncName Null-terminated SNC name to be converted. 01083 * \out *sncKey Pre-allocated buffer, which will receive the corresponding SNC key. 01084 * \inout *keyLength Needs to be filled with the buffer length of sncKey. The return value will be byte length 01085 * of the SNC key (if buffer was large enough). Unfortunately in case of RFC_BUFFER_TOO_SMALL 01086 * the required size is not returned by the GSS library. 01087 * The maximum length of an SNC key is 1024. 01088 * \out *errorInfo More error details in case something goes wrong. 01089 * \return RFC_RC 01090 */ 01091 DECL_EXP RFC_RC SAP_API RfcSNCNameToKey(SAP_UC const *sncLib, SAP_UC const *sncName, SAP_RAW *sncKey, unsigned *keyLength, RFC_ERROR_INFO* errorInfo); 01092 01093 /** \brief Converts SNC key to SNC name. 01094 * \ingroup connection 01095 * 01096 * 01097 * \in *sncLib Optional: file name of the GSS library to be used for the conversion. If not specified, the 01098 * "global" GSS library (environment variable SNC_LIB) will be used. 01099 * \in *sncKey SNC key to be converted. 01100 * \in keyLength Byte length of the given SNC key 01101 * \out *sncName Pre-allocated buffer, which will receive the corresponding (null-terminated) SNC name. 01102 * \in nameLength Size of the given sncName buffer. (The maximum length of an SNC name is 256.) 01103 * \out *errorInfo More error details in case something goes wrong. 01104 * \return RFC_RC 01105 */ 01106 DECL_EXP RFC_RC SAP_API RfcSNCKeyToName(SAP_UC const *sncLib, SAP_RAW const *sncKey, unsigned keyLength ,SAP_UC *sncName, unsigned nameLength, RFC_ERROR_INFO* errorInfo); 01107 01108 01109 /** \brief Listens on a server connection handle and waits for incoming RFC calls from the R/3 system. 01110 * \ingroup connection 01111 * 01112 * The mechanism for dispatching incoming function calls works as follows: 01113 * First %RfcListenAndDispatch() checks, whether for the current combination of R/3 SystemID and function 01114 * module name a callback function has been installed via RfcInstallServerFunction(). If not, it checks, 01115 * whether a callback function for SystemID=NULL has been installed via RfcInstallServerFunction().If not, 01116 * it checks, whether a global callback function has been installed via RfcInstallGenericServerFunction(). 01117 * 01118 * If a callback function has been found, the RFC call will be dispatched to that function for processing, 01119 * and %RfcListenAndDispatch() returns the return code of the callback function. 01120 * Otherwise %RfcListenAndDispatch() returns a SYSTEM_FAILURE to the R/3 backend and the return code 01121 * RFC_NOT_FOUND to the caller. 01122 * 01123 * In general the return codes of %RfcListenAndDispatch() have the following meaning: 01124 * - RFC_OK\n A function call was processed successfully. 01125 * - RFC_RETRY\n No function call came in within the specified timeout period. ("timeout" is given in seconds.) 01126 * - RFC_ABAP_EXCEPTION\n A function call was processed and ended with a defined ABAP Exception, which has 01127 * been returned to the backend. 01128 * 01129 * In the above three cases "rfcHandle" is still open and can be used to listen for the next request. 01130 * 01131 * - RFC_ABAP_MESSAGE\n A function call was started to be processed, but was aborted with an ABAP A-, E- or X-Message. 01132 * The message parameters have been returned to the backend (and can be evaluated there via 01133 * the sy-msgid, sy-msgtype, sy-msgno, sy-msgv1, ..., sy-msgv4 parameters). 01134 * - RFC_EXTERNAL_FAILURE\n A function call was started to be processed, but was aborted with a "SYSTEM_FAILURE", 01135 * which has been returned to the backend. 01136 * - RFC_COMMUNICATION_FAILURE\n The connection broke down while processing the function call. No response 01137 * has been sent to the backend. 01138 * - RFC_CLOSED\n The connection has been closed by the backend side (SMGW, SM04). No response 01139 * has been sent to the backend. 01140 * - RFC_NOT_FOUND\n No handler has been found for the current function module name. A SYSTEM_FAILURE has 01141 * been returned to the R/3 backend. 01142 * 01143 * In these five cases the connection has been closed, so the "rfcHandle" needs to be refreshed via RfcRegisterServer. 01144 * 01145 * - RFC_INVALID_HANDLE\n "rfcHandle" is invalid or points to a connection that has already been closed. 01146 * 01147 * 01148 * \in rfcHandle Server connection on which to listen for incoming requests. 01149 * \in timeout Number of seconds to wait for an incoming request. 01150 * \out *errorInfo Additional error information. 01151 * \return RFC_RC 01152 */ 01153 DECL_EXP RFC_RC SAP_API RfcListenAndDispatch (RFC_CONNECTION_HANDLE rfcHandle, int timeout, RFC_ERROR_INFO* errorInfo); 01154 01155 /** 01156 * \brief Executes a function module in the backend system. 01157 * \ingroup connection 01158 * 01159 * The return codes have the following meaning: 01160 * - RFC_OK\n The function call was executed successfully. 01161 * - RFC_ABAP_EXCEPTION\n The function call was executed and ended with a defined ABAP Exception. The key of the 01162 * exception can be obtained from errorInfo->key. 01163 * 01164 * In the above two cases "rfcHandle" is still open and can be used to execute further function call. 01165 * 01166 * - RFC_ABAP_MESSAGE\n The function call was started to be processed, but was aborted with an ABAP Message. 01167 * The message parameters can be obtained from errorInfo->abapMsgClass, errorInfo->abapMsgType, 01168 * errorInfo->abapMsgNumber, errorInfo->abapMsgV1, ..., errorInfo->abapMsgV4. 01169 * - RFC_ABAP_RUNTIME_FAILURE\n The function call was started to be processed, but was aborted with a SYSTEM_FAILURE 01170 * (e.g division by zero, unhandled exception, etc in the backend system). 01171 * Details can be obtained from errorInfo->message. 01172 * - RFC_COMMUNICATION_FAILURE\n The connection broke down while processing the function call. 01173 * Details can be obtained from errorInfo->message. 01174 * 01175 * In these three cases the connection has been closed, so the "rfcHandle" needs to be refreshed via RfcOpenConnection. 01176 * 01177 * - RFC_INVALID_HANDLE\n "rfcHandle" is invalid or points to a connection that has already been closed. 01178 * 01179 * 01180 * \in rfcHandle Client connection over which to execute the function module. 01181 * \inout funcHandle Data container containing the input data for the function module. 01182 * %RfcInvoke() will write the FM's output data into this container. 01183 * \out *errorInfo Additional error information. 01184 * \return RFC_RC 01185 */ 01186 DECL_EXP RFC_RC SAP_API RfcInvoke(RFC_CONNECTION_HANDLE rfcHandle, RFC_FUNCTION_HANDLE funcHandle, RFC_ERROR_INFO* errorInfo); 01187 01188 01189 /* ***********************************************************************/ 01190 /* */ 01191 /* Transaction (tRFC & qRFC) Client API */ 01192 /* */ 01193 /* ***********************************************************************/ 01194 01195 /** 01196 * \brief Retrieves a unique 24-digit transaction ID from the backend. 01197 * \ingroup transaction 01198 * 01199 * 01200 * \in rfcHandle Client connection to a backend. 01201 * \out tid Will be filled with the transaction ID. 01202 * \out *errorInfo Error information in case there is a problem with the connection. 01203 * \return RFC_RC 01204 */ 01205 DECL_EXP RFC_RC SAP_API RfcGetTransactionID(RFC_CONNECTION_HANDLE rfcHandle, RFC_TID tid, RFC_ERROR_INFO* errorInfo); 01206 01207 /** 01208 * \brief Creates a container for executing a (multi-step) transactional call. 01209 * \ingroup transaction 01210 * 01211 * If queueName is NULL, tRFC will be used, otherwise qRFC. Use RfcInvokeInTransaction() to 01212 * add one (or more) function modules to the transactional call. When sending this transactional 01213 * call to the backend via RfcSubmitTransaction(), the backend will then treat 01214 * all function modules in the RFC_TRANSACTION_HANDLE as one LUW. 01215 * 01216 * \in rfcHandle Client connection to the backend, into which you want to send this tRFC/qRFC LUW. 01217 * \in tid A unique 24 character ID. 01218 * \in *queueName For tRFC set this to NULL, for qRFC specify the name of a qRFC inbound queue in the backend. 01219 * \out *errorInfo Error information in case there is a problem with the connection. 01220 * \return A data container that can be filled with several function modules. 01221 */ 01222 DECL_EXP RFC_TRANSACTION_HANDLE SAP_API RfcCreateTransaction(RFC_CONNECTION_HANDLE rfcHandle, RFC_TID tid, SAP_UC const *queueName, RFC_ERROR_INFO* errorInfo); 01223 01224 /** 01225 * \brief Adds a function module call to a transaction. Can be used multiple times on one tHandle. 01226 * \ingroup transaction 01227 * 01228 * \in tHandle A transaction handle created via RfcCreateTransaction(). 01229 * \in funcHandle An RFC_FUNCTION_HANDLE, whose IMPORTING, CHANGING and TABLES parameters have been filled. 01230 * \note that tRFC/qRFC calls have no return values, so the EXPORTING parameters of this function handle will 01231 * not be filled, nor will the changes to the CHANGING/TABLES parameters be returned. 01232 * \out *errorInfo Actually there is nothing that can go wrong here except for invalid handles and out of memory. 01233 * \return RFC_RC 01234 */ 01235 DECL_EXP RFC_RC SAP_API RfcInvokeInTransaction(RFC_TRANSACTION_HANDLE tHandle, RFC_FUNCTION_HANDLE funcHandle, RFC_ERROR_INFO* errorInfo); 01236 01237 /** 01238 * \brief Executes the entire LUW in the backend system as an "atomic unit". 01239 * \ingroup transaction 01240 * 01241 * This step can be repeated until it finally succeeds (RFC_OK). The transaction handling in the backend 01242 * system protects against duplicates (until you remove the TID from the backend's status tables using 01243 * RfcConfirmTransaction()). 01244 * 01245 * 01246 * \in tHandle A transaction handle filled with one or several function modules. 01247 * \out *errorInfo Additional error information in case anything goes wrong. 01248 * \return RFC_RC 01249 */ 01250 DECL_EXP RFC_RC SAP_API RfcSubmitTransaction(RFC_TRANSACTION_HANDLE tHandle, RFC_ERROR_INFO* errorInfo); 01251 01252 /** 01253 * \brief Removes the TID contained in the RFC_TRANSACTION_HANDLE from the backend's ARFCRSTATE table. 01254 * \ingroup transaction 01255 * 01256 * After RfcSubmitTransaction() has finally succeeded, call %RfcConfirmTransaction() to clean up the 01257 * transaction handling table in the backend. 01258 * \warning Attention: after this call, the backend is no longer protected against this TID. So another 01259 * RfcSubmitTransaction() with the same transaction handle would result in a duplicate. 01260 * 01261 * 01262 * \in tHandle A transaction handle that has successfully been submitted. 01263 * \out *errorInfo Additional error information in case of a network problem. 01264 * \warning You may retry the Confirm step, if you get an error here, but do not retry the Submit step! 01265 * \return RFC_RC 01266 */ 01267 DECL_EXP RFC_RC SAP_API RfcConfirmTransaction(RFC_TRANSACTION_HANDLE tHandle, RFC_ERROR_INFO* errorInfo); 01268 01269 /** 01270 * \brief Releases the memory of the transaction container. 01271 * \ingroup transaction 01272 * 01273 * 01274 * \in tHandle A transaction handle that is no longer needed. 01275 * \out *errorInfo Not much that can go wrong here... 01276 * \return RFC_RC 01277 */ 01278 DECL_EXP RFC_RC SAP_API RfcDestroyTransaction(RFC_TRANSACTION_HANDLE tHandle, RFC_ERROR_INFO* errorInfo); 01279 01280 01281 /* ***********************************************************************/ 01282 /* */ 01283 /* Background Communication (bgRFC) Client API */ 01284 /* */ 01285 /* ***********************************************************************/ 01286 01287 /** 01288 * \brief Create a 32 digit bgRFC unit ID. 01289 * \ingroup bgrfc 01290 * 01291 * This function fills the given RFC_UNITID with a 32 digit hexadecimal GUID and zero-terminates it. 01292 * If you want the GUID to be generated by the backend, pass a valid rfcHandle, if you want the 01293 * NW RFC library to generate one locally (using the appropriate OS functions), pass NULL as 01294 * connection handle. In both cases the GUID is suitable for sending bgRFC units into an SAP system. 01295 * 01296 * 01297 * \in rfcHandle An open RFC connection into the system that is to create the unit ID, or NULL. 01298 * \out uid Preallocated buffer that will receive the 32 digits of the unit ID and a terminating zero. 01299 * \out *errorInfo Not much that can go wrong here... 01300 * \return RFC_RC 01301 */ 01302 DECL_EXP RFC_RC SAP_API RfcGetUnitID(RFC_CONNECTION_HANDLE rfcHandle, RFC_UNITID uid, RFC_ERROR_INFO* errorInfo); 01303 01304 /** 01305 * \brief Create a bgRFC unit. 01306 * \ingroup bgrfc 01307 * 01308 * Creates a data container that can later be filled with one or more function modules comprising the 01309 * bgRFC unit. The backend will execute these function modules as an atomic unit. 01310 * The connection handle specifies the target system, to which the unit will later be sent. The unit ID 01311 * has been created in the previous step (or is an old one in case of retrying a failed unit). 01312 * Via queueNames and queueNameCount you can specify the list of bgRFC queues, into which this unit 01313 * shall later be inserted. If no queues are given (queueNameCount == 0), a synchronous unit is created 01314 * (type 'T') that will later be executed immediately. Otherwise an asynchronous unit (type 'Q') is created, 01315 * which will be inserted into the named queues and executed asynchronously by the bgRFC scheduler. 01316 * 01317 * 01318 * \in rfcHandle An open RFC connection into the system that will later receive the unit. 01319 * \in uid A 32 digit unique identifier of the unit. 01320 * \in *queueNames[] A list of bgRFC queues in the backend or NULL. 01321 * \in queueNameCount The length of the queueNames list. 01322 * \in *unitAttr A set of attributes that specify the behaviour of the unit in the backend. 01323 * See RFC_UNIT_ATTRIBUTES for more information. 01324 * \out *identifier This identifier can be used in later calls to RfcConfirmUnit() and RfcGetUnitState(). 01325 * It is important that these functions are called with the correct unit type ('T' or 'Q'), otherwise 01326 * the backend system won't find the status information corresponding to the uid... Therefore the 01327 * NW RFC lib bundles the uid and the correct unit type here for your convenience. 01328 * \out *errorInfo More details in case something goes wrong. 01329 * \return RFC_OK or RFC_MEMORY_INSUFFICIENT 01330 */ 01331 DECL_EXP RFC_UNIT_HANDLE SAP_API RfcCreateUnit(RFC_CONNECTION_HANDLE rfcHandle, RFC_UNITID uid, SAP_UC const *queueNames[], unsigned queueNameCount, const RFC_UNIT_ATTRIBUTES* unitAttr, RFC_UNIT_IDENTIFIER* identifier, RFC_ERROR_INFO* errorInfo); 01332 01333 /** 01334 * \brief Adds a function module to a bgRFC unit. 01335 * \ingroup bgrfc 01336 * 01337 * Serializes the payload of the function module data container into bgRFC format and inserts 01338 * it into the data container for the bgRFC unit. The funcHandle can afterwards be freed 01339 * using RfcDestroyFunction(), because the data is copied, not referenced. 01340 * 01341 * \note Despite the name "invoke", nothing is executed in the backend system, yet! 01342 * 01343 * 01344 * \in unitHandle A valid (unsubmitted) bgRFC unit, to which the given function module shall be added. 01345 * \in funcHandle A function module, whose payload (IMPORTING/CHANGING/TABLES) shall be added to the unit. 01346 * \out *errorInfo More details in case something goes wrong. 01347 * \return RFC_OK, RFC_INVALID_HANDLE or RFC_MEMORY_INSUFFICIENT 01348 */ 01349 DECL_EXP RFC_RC SAP_API RfcInvokeInUnit(RFC_UNIT_HANDLE unitHandle, RFC_FUNCTION_HANDLE funcHandle, RFC_ERROR_INFO* errorInfo); 01350 01351 /** 01352 * \brief Executes a bgRFC unit in the backend. 01353 * \ingroup bgrfc 01354 * 01355 * Sends the bgRFC unit into the backend, where it will be executed synchronously or persisted 01356 * in the given inbound queues and executed asynchronously by the bgRFC scheduler, depending on 01357 * whether the unit type is 'T' or 'Q'. 01358 * If the type is 'T', this function will wait until the unit is completely executed and then 01359 * return the success or error information. If the type is 'Q', this function only inserts the 01360 * unit into the specified queues and then returns. Processing of the unit in the backend system 01361 * happens asynchronously. The return code of this function indicates, whether the unit could 01362 * be persisted in the given queues successfully. In order to get information about the processing 01363 * status of the unit, use RfcGetUnitState() at a later point. 01364 * 01365 * \note Despite the name "invoke", nothing is executed in the backend system, yet! 01366 * 01367 * 01368 * \in unitHandle A valid (unsubmitted) bgRFC unit, which shall be sent into the backend system. 01369 * \out *errorInfo More details in case something goes wrong. 01370 * \return RFC_OK, RFC_INVALID_HANDLE, RFC_MEMORY_INSUFFICIENT, RFC_COMMUNICATION_FAILURE 01371 */ 01372 DECL_EXP RFC_RC SAP_API RfcSubmitUnit(RFC_UNIT_HANDLE unitHandle, RFC_ERROR_INFO* errorInfo); 01373 01374 /** 01375 * \brief Removes the UID from the backend's status management. 01376 * \ingroup bgrfc 01377 * 01378 * After RfcSubmitUnit() returned successfully, you should use this function to cleanup 01379 * the status information for this unit on backend side. However, be careful: if you have 01380 * a three-tier architecture, don't bundle Submit and Confirm into one single logical step. 01381 * Otherwise you run the risk, that the middle tier (the NW RFC lib) successfully executes 01382 * both, the Submit and the Confirm, but on the way back to the first tier an error occurs 01383 * and the first tier can not be sure that the unit was really executed in the backend and 01384 * therefore decides to re-execute it. This will now result in a duplicate execution in the 01385 * backend, because the Confirm step in the first try has already deleted the UID in the 01386 * backend, and consequently the backend is no longer protected against re-execution of this 01387 * UID. In a three-tier architecture, the first tier should trigger both steps separately: 01388 * first the Submit, and after it knows that the Submit was successful, the Confirm. 01389 * Also in case the Confirm runs into an error, do NOT execute the Submit again, never! 01390 * You may try the Confirm again at a later point, but otherwise just ignore the error. 01391 * Better a left-over entry in the status information table than a duplicate unit... 01392 * 01393 * \in rfcHandle A connection into the same system, into which the corresponding bgRFC unit 01394 * has been sent via RfcSubmitUnit(). 01395 * \in *identifier The correct combination of UID and type of the unit. Best use the output 01396 * you get from RfcCreateUnit(). 01397 * \out *errorInfo More details in case something goes wrong. 01398 * \return RFC_OK, RFC_INVALID_HANDLE, RFC_COMMUNICATION_FAILURE 01399 */ 01400 DECL_EXP RFC_RC SAP_API RfcConfirmUnit(RFC_CONNECTION_HANDLE rfcHandle, RFC_UNIT_IDENTIFIER* identifier, RFC_ERROR_INFO* errorInfo); 01401 01402 /** 01403 * \brief Releases the memory of the bgRFC unit container. 01404 * \ingroup bgrfc 01405 * 01406 * 01407 * \in unitHandle A unit handle that is no longer needed. 01408 * \out *errorInfo Not much that can go wrong here... 01409 * \return RFC_RC 01410 */ 01411 DECL_EXP RFC_RC SAP_API RfcDestroyUnit(RFC_UNIT_HANDLE unitHandle, RFC_ERROR_INFO* errorInfo); 01412 01413 /** 01414 * \brief Retrieves the processing status of the given background unit from the backend system's status management. 01415 * \ingroup bgrfc 01416 * 01417 * 01418 * \in rfcHandle A connection into the same system, into which the corresponding bgRFC unit 01419 * has been sent via RfcSubmitUnit(). 01420 * \in *identifier The correct combination of UID and type of the unit. Best use the output 01421 * you get from RfcCreateUnit(). 01422 * \out *state The state of the unit. See RFC_UNIT_STATE for more details. 01423 * \out *errorInfo Not much that can go wrong here... 01424 * \return RFC_RC 01425 */ 01426 DECL_EXP RFC_RC SAP_API RfcGetUnitState(RFC_CONNECTION_HANDLE rfcHandle, RFC_UNIT_IDENTIFIER* identifier, RFC_UNIT_STATE* state, RFC_ERROR_INFO* errorInfo); 01427 01428 01429 01430 /* ***********************************************************************/ 01431 /* */ 01432 /* Installation of Callback Functions for RFC Servers */ 01433 /* */ 01434 /* ***********************************************************************/ 01435 01436 /** 01437 * \brief Installs a callback function of type RFC_SERVER_FUNCTION, which will be triggered when a request for 01438 * the function module corresponding to funcDescHandle comes in from the R/3 system corresponding to sysId. 01439 * \ingroup installer 01440 * 01441 * If you pass NULL as "sysId", the serverFunction will be used for calls from any backend system. 01442 * 01443 * The main inputs of RFC_SERVER_FUNCTION are as follows: 01444 * - RFC_CONNECTION_HANDLE\n A connection handle, which can be used to query logon information about 01445 * the current (backend) user or to make callbacks into the backend. 01446 * - RFC_FUNCTION_HANDLE\n A data container that represents the current function call. Read the importing 01447 * parameters, which came from the backend, from this container via the RfcGetX functions and 01448 * write the exporting parameters, which are to be returned to the backend, into this container 01449 * using the RfcSetX functions.\n 01450 * The memory of that container is automatically released by the RFC Runtime after the 01451 * RFC_SERVER_FUNCTION returns. 01452 * - RFC_ERROR_INFO*\n If you want to return an ABAP Exception or ABAP Message to the backend, fill the 01453 * parameters of that container and return RFC_ABAP_EXCEPTION or RFC_ABAP_MESSAGE from 01454 * your RFC_SERVER_FUNCTION implementation.\n 01455 * If you want to return a SYSTEM_FAILURE to the backend, fill the message parameter of 01456 * this container and return RFC_EXTERNAL_FAILURE from your RFC_SERVER_FUNCTION implementation. 01457 * If your RFC_SERVER_FUNCTION implementation processed the function call successfully, you should return RFC_OK. 01458 * 01459 * 01460 * \in *sysId System ID of the R/3 system, for which this function module implementation shall be used. 01461 * If you set this to NULL, this server function will be used for calls from all backends, for whose SysID no 01462 * explicit server function has been installed. 01463 * \in funcDescHandle A function description giving the name of the function module and its parameters.\n 01464 * Note that the NW RFC library does not create a copy of this function description. So if you are using 01465 * self-defined (hard-coded) function descriptions (see RfcCreateFunctionDesc()), then you need to make 01466 * sure, that these function descriptions are not destroyed as long as they are still used in a server 01467 * function installation! 01468 * \in serverFunction Pointer to a C function of type RFC_SERVER_FUNCTION. If you pass a null-pointer here, 01469 * any previously installed server function for the given function module will be uninstalled. 01470 * \out *errorInfo Not much that can go wrong here. 01471 * \return RFC_RC 01472 */ 01473 DECL_EXP RFC_RC SAP_API RfcInstallServerFunction(SAP_UC const *sysId, RFC_FUNCTION_DESC_HANDLE funcDescHandle, RFC_SERVER_FUNCTION serverFunction, RFC_ERROR_INFO* errorInfo); 01474 01475 /** 01476 * \brief Installs a generic callback function of type RFC_SERVER_FUNCTION together with a callback 01477 * function of type RFC_FUNC_DESC_CALLBACK for obtaining the metadata description of unknown function modules. 01478 * \ingroup installer 01479 * 01480 * The RFC Runtime calls the callback function RFC_SERVER_FUNCTION, if it receives a function call, for whose 01481 * function module name no matching callback function has been installed via RfcInstallServerFunction() 01482 * (neither for the current system ID nor for SysID=NULL). 01483 * 01484 * In addition to the handler function you need to provide a second callback function: RFC_FUNC_DESC_CALLBACK. 01485 * The RFC runtime calls it to obtain an RFC_FUNCTION_DESC_HANDLE for the current function module from you. 01486 * So this function either needs to return hardcoded meta data or needs to be able to perform a DDIC lookup 01487 * using a valid client connection and RfcGetFunctionDesc(). If your implementation of RFC_FUNC_DESC_CALLBACK 01488 * is not able to provide a function description for the current function module name, it should return RFC_NOT_FOUND. 01489 * The RFC runtime will then notify the backend, that this function module cannot be processed by your 01490 * RFC server. 01491 * 01492 * 01493 * \in serverFunction A pointer to a function that can handle "all" function modules. 01494 * \in funcDescProvider A pointer to a function that can provide metadata descriptions of "all" function modules. 01495 * \out *errorInfo Again not much that can go wrong at this point. 01496 * \return 01497 */ 01498 DECL_EXP RFC_RC SAP_API RfcInstallGenericServerFunction(RFC_SERVER_FUNCTION serverFunction, RFC_FUNC_DESC_CALLBACK funcDescProvider, RFC_ERROR_INFO* errorInfo); 01499 01500 /** 01501 * \brief Installs the necessary callback functions for processing incoming tRFC/qRFC calls. 01502 * \ingroup installer 01503 * 01504 * These functions need to be implemented by you and will be used by the RFC runtime in the following way: 01505 * -# The RFC_ON_CHECK_TRANSACTION function is called when a local transaction is starting. Since a transactional 01506 * RFC call can be issued many times by the client system, the function is responsible for storing the transaction ID 01507 * in permanent storage. The return value should be one of the following: 01508 * - RFC_OK\n Transaction ID stored, transaction can be started. 01509 * - RFC_EXECUTED\n This transaction has already been processed successfully in an earlier attempt. Skip the execution now. 01510 * - RFC_EXTERNAL_FAILURE\n Currently unable to access my permanent storage. Raise an exception in the sending system, so 01511 * that the sending system will try to resend the transaction at a later time. 01512 * -# The next step will be the execution of the RFC_SERVER_FUNCTIONs for all function modules contained in the LUW. 01513 * -# If one of the RFC_SERVER_FUNCTION implementations returns an error code, RFC_ON_ROLLBACK_TRANSACTION is called. 01514 * Here you should roll back all the work of all the previous RFC_SERVER_FUNCTIONs. (The easiest way is to do 01515 * a database ROLLBACK WORK here.)\n 01516 * If all RFC_SERVER_FUNCTIONs complete successfully, RFC_ON_COMMIT_TRANSACTION is called at the end. 01517 * Persist all the changes here (e.g. do a COMMIT WORK).\n 01518 * Note: Normally you'll only have "one-function-module LUWs", e.g. IDocs. In this case the RFC_SERVER_FUNCTION 01519 * can already commit/rollback its own work, before returning RFC_OK or an error code. So the two functions 01520 * RFC_ON_ROLLBACK_TRANSACTION and RFC_ON_COMMIT_TRANSACTION can be empty in this case. 01521 * -# In the end RFC_ON_CONFIRM_TRANSACTION will be called. All information stored about that transaction can now be 01522 * discarded by the server, as it no longer needs to protect itself against duplicates. 01523 * In general this function can be used to delete the transaction ID from permanent storage. 01524 * 01525 * If you pass NULL as "sysId", the transaction handlers will be used for tRFC calls from any backend system, 01526 * for which no explicit handlers have been installed. 01527 * 01528 * 01529 * \in *sysId System ID of the SAP system for which to use this set of transaction handlers, or NULL. 01530 * \in onCheckFunction Pointer to a function of type RFC_ON_CHECK_TRANSACTION. 01531 * \in onCommitFunction Pointer to a function of type RFC_ON_COMMIT_TRANSACTION. 01532 * \in onRollbackFunction Pointer to a function of type RFC_ON_ROLLBACK_TRANSACTION. 01533 * \in onConfirmFunction Pointer to a function of type RFC_ON_CONFIRM_TRANSACTION. 01534 * \out *errorInfo Additional information, in case the handlers could not be installed. 01535 * \return RFC_RC 01536 */ 01537 DECL_EXP RFC_RC SAP_API RfcInstallTransactionHandlers (SAP_UC const *sysId, RFC_ON_CHECK_TRANSACTION onCheckFunction, 01538 RFC_ON_COMMIT_TRANSACTION onCommitFunction, RFC_ON_ROLLBACK_TRANSACTION onRollbackFunction, 01539 RFC_ON_CONFIRM_TRANSACTION onConfirmFunction, RFC_ERROR_INFO* errorInfo); 01540 01541 01542 /** 01543 * \brief Installs the necessary callback functions for processing incoming bgRFC calls. 01544 * \ingroup installer 01545 * 01546 * These functions need to be implemented by you and will be used by the RFC runtime in the following way: 01547 * -# The RFC_ON_CHECK_UNIT function is called when a local background unit is starting. Since a background 01548 * RFC call can be issued many times by the client system, the function is responsible for storing the unit ID 01549 * and type in permanent storage. The return value should be one of the following: 01550 * - RFC_OK\n Unit ID stored, LUW can be started. 01551 * - RFC_EXECUTED\n This LUW has already been processed successfully in an earlier attempt. Skip the execution now. 01552 * - RFC_EXTERNAL_FAILURE\n Currently unable to access my permanent storage. Raise an exception in the sending system, so 01553 * that the sending system will try to resend the unit at a later time. 01554 * -# The next step will be the execution of the RFC_SERVER_FUNCTIONs for all function modules contained in the LUW. 01555 * -# If one of the RFC_SERVER_FUNCTION implementations returns an error code, RFC_ON_ROLLBACK_UNIT is called. 01556 * Here you should roll back all the work of all the previous RFC_SERVER_FUNCTIONs. (The easiest way is to do 01557 * a database ROLLBACK WORK here.)\n 01558 * If all RFC_SERVER_FUNCTIONs complete successfully, RFC_ON_COMMIT_UNIT is called at the end. 01559 * Persist all the changes here (e.g. do a COMMIT WORK).\n 01560 * Note: Normally you'll only have "one-function-module LUWs", e.g. IDocs. In this case the RFC_SERVER_FUNCTION 01561 * can already commit/rollback its own work, before returning RFC_OK or an error code. So the two functions 01562 * RFC_ON_ROLLBACK_UNIT and RFC_ON_COMMIT_UNIT can be empty in this case. 01563 * -# In the end RFC_ON_CONFIRM_UNIT will be called. All information stored about that LUW can now be 01564 * discarded by the server, as it no longer needs to protect itself against duplicates. 01565 * In general this function can be used to delete the unit ID from permanent storage. 01566 * -# At various points in the processing of a background unit, the backend system may or may not inquire 01567 * the status of the currently (or previously) processed unit by calling RFC_ON_GET_UNIT_STATE. Your implementation 01568 * of this function should check your permanent storage for status information about the given unit ID and 01569 * fill the RFC_UNIT_STATE* accordingly. 01570 * 01571 * If you pass NULL as "sysId", the transaction handlers will be used for bgRFC calls from any backend system, 01572 * for which no explicit handlers have been installed. 01573 * 01574 * 01575 * \in *sysId System ID of the SAP system for which to use this set of transaction handlers, or NULL. 01576 * \in onCheckFunction Pointer to a function of type RFC_ON_CHECK_UNIT. 01577 * \in onCommitFunction Pointer to a function of type RFC_ON_COMMIT_UNIT. 01578 * \in onRollbackFunction Pointer to a function of type RFC_ON_ROLLBACK_UNIT. 01579 * \in onConfirmFunction Pointer to a function of type RFC_ON_CONFIRM_UNIT. 01580 * \in onGetStateFunction Pointer to a function of type RFC_ON_GET_UNIT_STATE. 01581 * \out *errorInfo Additional information, in case the handlers could not be installed. 01582 * \return RFC_RC 01583 */ 01584 DECL_EXP RFC_RC SAP_API RfcInstallBgRfcHandlers (SAP_UC const *sysId, RFC_ON_CHECK_UNIT onCheckFunction, 01585 RFC_ON_COMMIT_UNIT onCommitFunction, RFC_ON_ROLLBACK_UNIT onRollbackFunction, 01586 RFC_ON_CONFIRM_UNIT onConfirmFunction, RFC_ON_GET_UNIT_STATE onGetStateFunction, RFC_ERROR_INFO* errorInfo); 01587 01588 01589 /** 01590 * \brief Installs the necessary callback functions for processing Extended Passport (EPP) events. 01591 * \ingroup installer 01592 * 01593 * Extended Passports is a feature that supersedes Distributed Statistical Records (DSRs). 01594 * It allows to track certain performance attributes across system boundaries. These callback functions 01595 * allow the application to exchange passports with the backend system. The actual data contained in the 01596 * passports, can be processed with the eppslib library. 01597 * \note Normal RFC applications should never need to deal with this topic at all... 01598 * 01599 * 01600 * \in onClientCallStart Pointer to a function of type RFC_PM_CALLBACK. The RFC lib calls this function, before it sends a client request into the backend. Here you can provide the passport that is to be sent along with the RFC request. 01601 * \in onClientCallEnd Pointer to a function of type RFC_PM_CALLBACK. The RFC lib calls this function, after the RFC response was received from the backend. You can read the updated passport information. 01602 * \in onServerCallStart Pointer to a function of type RFC_PM_CALLBACK. The RFC lib calls this function, when it received an RFC request from the backend. Here you can read the passport that accompanied the request. 01603 * \in onServerCallEnd Pointer to a function of type RFC_PM_CALLBACK. The RFC lib calls this function, before it will send the response to the above request back to the backend. You can update the passport data with information about processing performance of the current call. 01604 * \out *errorInfo Additional information, in case the handlers could not be installed. 01605 * \return RFC_RC 01606 */ 01607 DECL_EXP RFC_RC SAP_API RfcInstallPassportManager (RFC_PM_CALLBACK onClientCallStart, 01608 RFC_PM_CALLBACK onClientCallEnd, 01609 RFC_PM_CALLBACK onServerCallStart, 01610 RFC_PM_CALLBACK onServerCallEnd, RFC_ERROR_INFO* errorInfo); 01611 01612 01613 /** 01614 * \brief Installs an optional callback function for processing password change events. 01615 * \ingroup installer 01616 * 01617 * Whenever a logon attempt is made with a user, whose password is still initial, the backend system 01618 * challenges this user to change his/her password. If this happens during a call to RfcOpenConnection(), 01619 * the RFC library calls this callback function (if installed), and allows you to change the user's password. 01620 * In your implementation, you can either return RFC_EXTERNAL_FAILURE, if you can't/don't want to change 01621 * the password. In that case RfcOpenConnection() will end with RFC_LOGON_FAILURE and any additional text from 01622 * errorInfo->message will be returned to the application. Or you can fill the old and new password with correct 01623 * values and return RFC_OK, upon which the RFC library will attempt to change the password accordingly. 01624 * 01625 * 01626 * \in onPasswordChange Pointer to a function of type RFC_ON_PASSWORD_CHANGE. The RFC lib calls this function, whenever an initial password is detected during a call to RfcOpenConnection(). 01627 * \out *errorInfo Additional information, in case the handler could not be installed. 01628 * \return RFC_RC 01629 */ 01630 DECL_EXP RFC_RC SAP_API RfcInstallPasswordChangeHandler(RFC_ON_PASSWORD_CHANGE onPasswordChange, RFC_ERROR_INFO* errorInfo); 01631 01632 01633 /** 01634 * \brief Installs an optional callback function for performing authorization checks on incoming function calls. 01635 * \ingroup installer 01636 * 01637 * After an RFC call arrives at the RFC library, and before the library executes the corresponding 01638 * server implementation for that function module, it calls this callback function, if installed. 01639 * Here you can implement a central authorization check, defining exactly which user from which backend 01640 * system is allowed to execute what functions in your RFC server program. 01641 * The actual function module implementations can then concentrate on their business logic and don't 01642 * need to pay attention to access and authorization checks. 01643 * 01644 * 01645 * \in onAuthorizationCheck Pointer to a function of type RFC_ON_AUTHORIZATION_CHECK. The RFC lib calls this function, whenever an RFC request arrives from the backend. 01646 * \out *errorInfo Additional information, in case the handler could not be installed. 01647 * \return RFC_RC 01648 */ 01649 DECL_EXP RFC_RC SAP_API RfcInstallAuthorizationCheckHandler(RFC_ON_AUTHORIZATION_CHECK onAuthorizationCheck, RFC_ERROR_INFO* errorInfo); 01650 01651 01652 01653 /* ***********************************************************************/ 01654 /* */ 01655 /* Data container API (Function modules, structures & tables) */ 01656 /* */ 01657 /* ***********************************************************************/ 01658 01659 /** 01660 * \brief Creates a data container that can be used to execute function calls in the backend via RfcInvoke(). 01661 * \ingroup container 01662 * 01663 * The importing parameters can be set using the RfcSetX functions. After the RfcInvoke() call returned 01664 * successfully, the exporting parameters can be read from this data container via the RfcGetX functions. 01665 * 01666 * 01667 * \in funcDescHandle Metadata description ("blueprint") for the data container to be created. 01668 * \out *errorInfo Error information in case the parameters are incorrect or there's not enough memory. 01669 * \return A handle to the function module container. 01670 */ 01671 DECL_EXP RFC_FUNCTION_HANDLE SAP_API RfcCreateFunction(RFC_FUNCTION_DESC_HANDLE funcDescHandle, RFC_ERROR_INFO* errorInfo); 01672 01673 /** 01674 * \brief Releases all memory used by the data container. 01675 * \ingroup container 01676 * 01677 * \warning Be careful: if you have obtained a handle to a structure (RFC_STRUCTURE_HANDLE) or 01678 * table parameter (RFC_TABLE_HANDLE) from that function module, that handle will be invalid afterwards, 01679 * as that memory will be released as well! 01680 * 01681 * 01682 * \in funcHandle Data container to release. 01683 * \out *errorInfo Not much that can go wrong here. 01684 * \return RFC_RC 01685 */ 01686 DECL_EXP RFC_RC SAP_API RfcDestroyFunction(RFC_FUNCTION_HANDLE funcHandle, RFC_ERROR_INFO* errorInfo); 01687 01688 /** 01689 * \brief Allows to deactivate certain parameters in the function module interface. 01690 * \ingroup container 01691 * 01692 * This is particularly useful for BAPIs which have many large tables, in which you are not interested. 01693 * Deactivate those and leave only those tables active, in which you are interested. This reduces 01694 * network traffic and memory consumption in your application considerably. 01695 * 01696 * \note This functionality can be used for input and output parameters. If the parameter is an input, 01697 * no data for that parameter will be sent to the backend. If it's an output, the backend will be 01698 * informed not to return data for that parameter. 01699 * 01700 * \in funcHandle A function module data container. 01701 * \in *paramName The name of a parameter of this function module. 01702 * \in isActive 1 = activate, 0 = deactivate. 01703 * \out *errorInfo Error information in case something goes wrong (e.g. a parameter of that name does not exist). 01704 * \return RFC_RC 01705 */ 01706 DECL_EXP RFC_RC SAP_API RfcSetParameterActive(RFC_FUNCTION_HANDLE funcHandle, SAP_UC const* paramName, int isActive, RFC_ERROR_INFO* errorInfo); 01707 01708 /** 01709 * \brief Query whether a parameter is active. 01710 * \ingroup container 01711 * 01712 * Useful for example in a server function implementation: Before creating a large table, 01713 * you may want to check, whether the client (the backend system), has requested that table at all. 01714 * 01715 * \in funcHandle A function module data container (usually handed to your server function from the RFC library). 01716 * \in *paramName The name of a parameter of this function module. 01717 * \out *isActive 1 = is active, 0 = is not active. 01718 * \out *errorInfo Error information in case something goes wrong (e.g. a parameter of that name does not exist). 01719 * \return RFC_RC 01720 */ 01721 DECL_EXP RFC_RC SAP_API RfcIsParameterActive(RFC_FUNCTION_HANDLE funcHandle, SAP_UC const* paramName, int *isActive, RFC_ERROR_INFO* errorInfo); 01722 01723 /** 01724 * \brief Creates a data container for a structure. 01725 * \ingroup container 01726 * 01727 * 01728 * \in typeDescHandle The metadata description (blueprint) for the structure to be created. 01729 * \out *errorInfo Error information in case the parameters are incorrect or there's not enough memory. 01730 * \return A handle to the structure. 01731 */ 01732 DECL_EXP RFC_STRUCTURE_HANDLE SAP_API RfcCreateStructure(RFC_TYPE_DESC_HANDLE typeDescHandle, RFC_ERROR_INFO* errorInfo); 01733 01734 /** 01735 * \brief Clones a sructure including the data in it. 01736 * \ingroup container 01737 * 01738 * 01739 * \in srcStructureHandle The structure to clone. 01740 * \out *errorInfo Not enough memory? 01741 * \return A handle to the newly created copy of the input structure. 01742 */ 01743 DECL_EXP RFC_STRUCTURE_HANDLE SAP_API RfcCloneStructure(RFC_STRUCTURE_HANDLE srcStructureHandle, RFC_ERROR_INFO* errorInfo); 01744 01745 /** 01746 * \brief Releases all memory for a particular structure 01747 * \ingroup container 01748 * 01749 * \warning Do not call this function on structures, which you have obtained from another data container 01750 * (e.g. a function module) via RfcGetStructure(). In that case the memory will be released, when the 01751 * parent container will be destroyed. If you destroy a child structure separately, you will get a 01752 * segmentation fault, when the parent structure is destroyed! 01753 * 01754 * \in structHandle Structure to release. 01755 * \out *errorInfo Not much that can go wrong here. 01756 * \return RFC_RC 01757 */ 01758 DECL_EXP RFC_RC SAP_API RfcDestroyStructure(RFC_STRUCTURE_HANDLE structHandle, RFC_ERROR_INFO* errorInfo); 01759 01760 /** 01761 * \brief Creates a data container for a table. 01762 * \ingroup container 01763 * 01764 * 01765 * \in typeDescHandle The metadata description (blueprint) for the line type of the table to be created. 01766 * \out *errorInfo More details in case there was an invalid parameter or not enough memory. 01767 * \return The freshly created table. 01768 */ 01769 DECL_EXP RFC_TABLE_HANDLE SAP_API RfcCreateTable(RFC_TYPE_DESC_HANDLE typeDescHandle, RFC_ERROR_INFO* errorInfo); 01770 01771 /** 01772 * \brief Clones a table including all the data in it. (Use with care...) 01773 * \ingroup container 01774 * 01775 * 01776 * \in srcTableHandle The table to duplicate. 01777 * \out *errorInfo In case there is not enough memory. 01778 * \return A handle to the cloned table. 01779 */ 01780 DECL_EXP RFC_TABLE_HANDLE SAP_API RfcCloneTable(RFC_TABLE_HANDLE srcTableHandle, RFC_ERROR_INFO* errorInfo); 01781 01782 /** 01783 * \brief Releases the memory of a table and all its lines. 01784 * \ingroup container 01785 * 01786 * \warning Be careful: if you still have a reference to a certain table line (an RFC_STRUCTURE_HANDLE you got 01787 * from RfcGetCurrentRow()/RfcAppendNewRow()/RfcInsertNewRow()), this handle will be invalid after RfcDestroyTable! 01788 * Using a handle to a table line after the table has been destroyed, will lead to a segmentation fault. 01789 * 01790 * \in tableHandle The table to release. 01791 * \out *errorInfo Nothing can go wrong here... 01792 * \return RFC_RC 01793 */ 01794 DECL_EXP RFC_RC SAP_API RfcDestroyTable(RFC_TABLE_HANDLE tableHandle, RFC_ERROR_INFO* errorInfo); 01795 01796 /** 01797 * \brief Returns the table row, on which the "table cursor" is currently positioned. 01798 * \ingroup container 01799 * 01800 * \note that the rows are numbered from 0 to n-1, not from 1 to n, as it's done in ABAP. 01801 * 01802 * \in tableHandle The table to read data from. 01803 * \out *errorInfo If the table cursor is not on a valid position. 01804 * \return A handle to the current row. 01805 * \warning Do not destroy the returned RFC_STRUCTURE_HANDLE. 01806 */ 01807 DECL_EXP RFC_STRUCTURE_HANDLE SAP_API RfcGetCurrentRow(RFC_TABLE_HANDLE tableHandle, RFC_ERROR_INFO* errorInfo); 01808 01809 /** 01810 * \brief Appends a new empty row at the end of the table and moves the table cursor to that row. 01811 * \ingroup container 01812 * 01813 * 01814 * \in tableHandle The table to enlarge. 01815 * \out *errorInfo More information in case of errors (e.g. not enough memory). 01816 * \return A handle to the newly created row. 01817 */ 01818 DECL_EXP RFC_STRUCTURE_HANDLE SAP_API RfcAppendNewRow(RFC_TABLE_HANDLE tableHandle, RFC_ERROR_INFO* errorInfo); 01819 01820 /** 01821 * \brief Appends a set of new empty rows at the end of the table and moves the table cursor to the first new row. 01822 * \ingroup container 01823 * 01824 * 01825 * \in tableHandle The table to enlarge. 01826 * \in numRows Number of rows to add. 01827 * \out *errorInfo More information in case of errors (e.g. not enough memory). 01828 * \return RFC_OK, RFC_INVALID_HANDLE or RFC_MEMORY_INSUFFICIENT. 01829 */ 01830 DECL_EXP RFC_RC SAP_API RfcAppendNewRows(RFC_TABLE_HANDLE tableHandle, unsigned numRows, RFC_ERROR_INFO* errorInfo); 01831 01832 /** 01833 * \brief Inserts a new empty row at the current position of the table cursor. 01834 * \ingroup container 01835 * 01836 * The row, on which the table cursor is currently positioned, and all following rows are moved 01837 * one index "down". E.g. if the table currently has rows nos 0 - n-1 and the cursor points to row i, 01838 * then the rows i - n-1 are moved to positions i+1 - n, and the new row is inserted at position i. 01839 * 01840 * 01841 * \in tableHandle The table to enlarge. 01842 * \out *errorInfo More information in case of errors (e.g. not enough memory). 01843 * \return A handle to the newly created row. 01844 */ 01845 DECL_EXP RFC_STRUCTURE_HANDLE SAP_API RfcInsertNewRow(RFC_TABLE_HANDLE tableHandle, RFC_ERROR_INFO* errorInfo); 01846 01847 /** 01848 * \brief Appends an existing row to the end of the table and moves the table cursor to that row. 01849 * \ingroup container 01850 * 01851 * 01852 * \in tableHandle The table to enlarge. 01853 * \in structHandle The row to append to the table. 01854 * \out *errorInfo More information in case something goes wrong (e.g. the line types of the table and the structure don't match). 01855 * \return RFC_RC 01856 */ 01857 DECL_EXP RFC_RC SAP_API RfcAppendRow(RFC_TABLE_HANDLE tableHandle, RFC_STRUCTURE_HANDLE structHandle, RFC_ERROR_INFO* errorInfo); 01858 01859 /** 01860 * \brief Inserts an existing row at the current position of the table cursor. 01861 * \ingroup container 01862 * 01863 * The row, on which the table cursor is currently positioned, and all following rows are moved 01864 * one index "down". E.g. if the table currently has rows nos 0 - n-1 and the cursor points to row i, 01865 * then the rows i - n-1 are moved to positions i+1 - n, and the given row is inserted at position i. 01866 * 01867 * 01868 * \in tableHandle The table to enlarge. 01869 * \in structHandle The row to insert into the table. 01870 * \out *errorInfo More information in case something goes wrong (e.g. the line types of the table and the structure don't match). 01871 * \return RFC_RC 01872 */ 01873 DECL_EXP RFC_RC SAP_API RfcInsertRow(RFC_TABLE_HANDLE tableHandle, RFC_STRUCTURE_HANDLE structHandle, RFC_ERROR_INFO* errorInfo); 01874 01875 /** 01876 * \brief Deletes the row, on which the table cursor is currently positioned. 01877 * \ingroup container 01878 * 01879 * If the row cursor is currently at an index i between 0 - n-2, then row i will be deleted and the 01880 * rows i+1 - n-1 will be moved on index "up", e.g. will now be rows i - n-2. The table cursor will 01881 * remain fixed at index i.\n 01882 * If the cursor is currently on the last row (n-1), then that row will be deleted, all other position 01883 * will remain unchanged, and the table cursor will move up to n-2 (the new last row of the table). 01884 * 01885 * 01886 * \in tableHandle The table from which to delete a row. 01887 * \out *errorInfo Error information in case the table cursor is not on a valid position. 01888 * \return RFC_RC 01889 */ 01890 DECL_EXP RFC_RC SAP_API RfcDeleteCurrentRow(RFC_TABLE_HANDLE tableHandle, RFC_ERROR_INFO* errorInfo); 01891 01892 /** 01893 * \brief Deletes all rows from the table. 01894 * \ingroup container 01895 * 01896 * 01897 * \in tableHandle The table to clear. 01898 * \out *errorInfo Not much that can go wrong here (except an invalid table handle). 01899 * \return RFC_RC 01900 */ 01901 DECL_EXP RFC_RC SAP_API RfcDeleteAllRows(RFC_TABLE_HANDLE tableHandle, RFC_ERROR_INFO* errorInfo); 01902 01903 /** 01904 * \brief Positions the table cursor at the first row (or at index "-1", if the table is empty). 01905 * \ingroup container 01906 * 01907 * 01908 * \in tableHandle A table. 01909 * \out *errorInfo Not much that can go wrong here (except an invalid table handle). 01910 * \return RFC_RC 01911 */ 01912 DECL_EXP RFC_RC SAP_API RfcMoveToFirstRow(RFC_TABLE_HANDLE tableHandle, RFC_ERROR_INFO* errorInfo); 01913 01914 /** 01915 * \brief Positions the table cursor at the last row (or at index "-1", if the table is empty). 01916 * \ingroup container 01917 * 01918 * 01919 * \in tableHandle A table. 01920 * \out *errorInfo Not much that can go wrong here (except an invalid table handle). 01921 * \return RFC_RC 01922 */ 01923 DECL_EXP RFC_RC SAP_API RfcMoveToLastRow(RFC_TABLE_HANDLE tableHandle, RFC_ERROR_INFO* errorInfo); 01924 01925 /** 01926 * \brief Increments the table cursor by one. 01927 * \ingroup container 01928 * 01929 * 01930 * \in tableHandle A table. 01931 * \out *errorInfo Not much that can go wrong here (except an invalid table handle). 01932 * \return RFC_RC 01933 */ 01934 DECL_EXP RFC_RC SAP_API RfcMoveToNextRow(RFC_TABLE_HANDLE tableHandle, RFC_ERROR_INFO* errorInfo); 01935 01936 /** 01937 * \brief Decrements the table cursor by one. 01938 * \ingroup container 01939 * 01940 * 01941 * \in tableHandle A table. 01942 * \out *errorInfo Not much that can go wrong here (except an invalid table handle). 01943 * \return RFC_RC 01944 */ 01945 DECL_EXP RFC_RC SAP_API RfcMoveToPreviousRow(RFC_TABLE_HANDLE tableHandle, RFC_ERROR_INFO* errorInfo); 01946 01947 /** 01948 * \brief Sets the table cursor to a specific index. 01949 * \ingroup container 01950 * 01951 * 01952 * \in tableHandle A table. 01953 * \in index The index to which to move the cursor. 01954 * \out *errorInfo Index out of bounds or invalid table handle. 01955 * \return RFC_RC 01956 */ 01957 DECL_EXP RFC_RC SAP_API RfcMoveTo(RFC_TABLE_HANDLE tableHandle, unsigned index, RFC_ERROR_INFO* errorInfo); 01958 01959 /** 01960 * \brief Returns the number of rows in a table. 01961 * \ingroup container 01962 * 01963 * 01964 * \in tableHandle A table. 01965 * \out *rowCount The number of rows in the table. 01966 * \out *errorInfo Not much that can go wrong. 01967 * \return RFC_RC 01968 */ 01969 DECL_EXP RFC_RC SAP_API RfcGetRowCount(RFC_TABLE_HANDLE tableHandle, unsigned* rowCount, RFC_ERROR_INFO* errorInfo); 01970 01971 /** 01972 * \brief Creates an ABAP object handle with the given class description handle. 01973 * \ingroup container 01974 * 01975 * \in classDescHandle class description handle. 01976 * \out *errorInfo Contains more information, for example if memory runs out (code = RFC_MEMORY_INSUFFICIENT). 01977 * \return A handle to the created ABAP object. 01978 */ 01979 DECL_EXP RFC_ABAP_OBJECT_HANDLE SAP_API RfcCreateAbapObject(RFC_CLASS_DESC_HANDLE classDescHandle, RFC_ERROR_INFO* errorInfo); 01980 01981 /** 01982 * \brief Destroys an ABAP object handle. 01983 * \ingroup container 01984 * 01985 * \in objHandle ABAP object handle to be destroyed. 01986 * \out *errorInfo Should always return successfully. 01987 * \return RFC_RC 01988 */ 01989 DECL_EXP RFC_RC SAP_API RfcDestroyAbapObject(RFC_ABAP_OBJECT_HANDLE objHandle, RFC_ERROR_INFO* errorInfo); 01990 01991 01992 /* **************************************************************************** 01993 * 01994 * API for accessing the fields of a data container 01995 * 01996 * API for reading the exporting parameters of an RFC_FUNCTION_HANDLE in the 01997 * client case, the importing parameters of an RFC_FUNCTION_HANDLE in the 01998 * server case and the fields of an RFC_STRUCTURE_HANDLE or RFC_TABLE_HANDLE. 01999 * ****************************************************************************/ 02000 02001 /** 02002 * \brief Returns the value of the specified field as char array. 02003 * \ingroup container 02004 * 02005 * The charBuffer will be filled with a string representation of the given field. The remaining 02006 * places in the buffer will be filled with trailing spaces. In case the buffer is too small, 02007 * the function will return RFC_BUFFER_TOO_SMALL. The result will not be null-terminated. 02008 * 02009 * The field specified by name needs to be of one of the following data types. If the field 02010 * has one of the listed non-char-like data types, the RFC library will convert the field value 02011 * to string format. Example:\n 02012 * If "name" specifies a field of type INT4 with the value 4711 and charBuffer is an SAP_CHAR[10], 02013 * then the buffer will be filled as follows: "4711 ". 02014 * 02015 * \note If the target field has type BYTE or XSTRING, the bytes will be 02016 * converted to a hex encoded string representation. 02017 * 02018 * - RFCTYPE_CHAR 02019 * - RFCTYPE_STRING 02020 * - RFCTYPE_NUM 02021 * - RFCTYPE_DATE 02022 * - RFCTYPE_TIME 02023 * - RFCTYPE_INTx 02024 * - RFCTYPE_FLOAT 02025 * - RFCTYPE_BCD 02026 * - RFCTYPE_DECFxx 02027 * - RFCTYPE_BYTE 02028 * - RFCTYPE_XSTRING 02029 * 02030 * 02031 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02032 * is a table handle, the function will read the field value of the current row. 02033 * \in *name The name of the field. 02034 * \out *charBuffer A pre-allocated buffer, which will receive the (converted) field value. 02035 * \in bufferLength Size of the buffer in RFC_CHARs. 02036 * \out *errorInfo Field doesn't exist, cannot be converted to char, etc. 02037 * \return RFC_RC 02038 */ 02039 DECL_EXP RFC_RC SAP_API RfcGetChars(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, RFC_CHAR *charBuffer, unsigned bufferLength, RFC_ERROR_INFO* errorInfo); 02040 02041 /** 02042 * \brief Returns the value of the specified field as char array. 02043 * \ingroup container 02044 * 02045 * This function works exactly like RfcGetChars(), the difference being that the field is 02046 * addressed by its index within the structure/table/function module. The first field has index 0, 02047 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02048 * 02049 * 02050 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02051 * is a table handle, the function will read the field value of the current row. 02052 * \in index The index of the field. 02053 * \out *charBuffer A pre-allocated buffer, which will receive the (converted) field value. 02054 * \in bufferLength Size of the buffer in RFC_CHARs. 02055 * \out *errorInfo Field doesn't exist, cannot be converted to char, etc. 02056 * \return RFC_RC 02057 */ 02058 DECL_EXP RFC_RC SAP_API RfcGetCharsByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, RFC_CHAR *charBuffer, unsigned bufferLength, RFC_ERROR_INFO* errorInfo); 02059 02060 /** 02061 * \brief Returns the value of the specified field as num-char array (digits only). 02062 * \ingroup container 02063 * 02064 * The charBuffer will be filled with a string representation of the field (from right to left). 02065 * The remaining places in the buffer will be filled with leading zero digits. In case 02066 * the buffer is too small, the function will return RFC_BUFFER_TOO_SMALL. The result is not 02067 * null-terminated. 02068 * 02069 * The field specified by name needs to be of one of the following data types. If the field 02070 * has one of the listed non-char-like data types, the RFC library will convert the field value 02071 * to string format. Example:\n 02072 * If "name" specifies a field of type INT4 with the value 4711 and charBuffer is an SAP_CHAR[10], 02073 * then the buffer will be filled as follows: "0000004711". 02074 * 02075 * - RFCTYPE_CHAR 02076 * - RFCTYPE_STRING 02077 * - RFCTYPE_NUM 02078 * - RFCTYPE_DATE 02079 * - RFCTYPE_TIME 02080 * - RFCTYPE_INTx 02081 * 02082 * 02083 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02084 * is a table handle, the function will read the field value of the current row. 02085 * \in *name The name of the field. 02086 * \out *charBuffer A pre-allocated buffer, which will receive the (converted) field value. 02087 * \in bufferLength Size of the buffer in RFC_CHARs. 02088 * \out *errorInfo Field doesn't exist, cannot be converted to numc, etc. 02089 * \return RFC_RC 02090 */ 02091 DECL_EXP RFC_RC SAP_API RfcGetNum(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, RFC_NUM *charBuffer, unsigned bufferLength, RFC_ERROR_INFO* errorInfo); 02092 02093 /** 02094 * \brief Returns the value of the specified field as num-char array (digits only). 02095 * \ingroup container 02096 * 02097 * This function works exactly like RfcGetNum(), the difference being that the field is 02098 * addressed by its index within the structure/table/function module. The first field has index 0, 02099 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02100 * 02101 * 02102 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02103 * is a table handle, the function will read the field value of the current row. 02104 * \in index The index of the field. 02105 * \out *charBuffer A pre-allocated buffer, which will receive the (converted) field value. 02106 * \in bufferLength Size of the buffer in RFC_CHARs. 02107 * \out *errorInfo Field doesn't exist, cannot be converted to numc, etc. 02108 * \return RFC_RC 02109 */ 02110 DECL_EXP RFC_RC SAP_API RfcGetNumByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, RFC_NUM *charBuffer, unsigned bufferLength, RFC_ERROR_INFO* errorInfo); 02111 02112 /** 02113 * \brief Reads a DATE field. 02114 * \ingroup container 02115 * 02116 * 02117 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02118 * is a table handle, the function will read the field value of the current row. 02119 * \in *name The name of the field to read. The field must be of type RFCTYPE_DATE. 02120 * \out emptyDate An RFC_DATE object, which will receive the field value. 02121 * \out *errorInfo More information in case something goes wrong. 02122 * \return RFC_RC 02123 */ 02124 DECL_EXP RFC_RC SAP_API RfcGetDate(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, RFC_DATE emptyDate, RFC_ERROR_INFO* errorInfo); 02125 02126 /** 02127 * \brief Reads a DATE field. 02128 * \ingroup container 02129 * 02130 * This function works exactly like RfcGetDate(), the difference being that the field is 02131 * addressed by its index within the structure/table/function module. The first field has index 0, 02132 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02133 * 02134 * 02135 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02136 * is a table handle, the function will read the field value of the current row. 02137 * \in index The index of the field to read. The field must be of type RFCTYPE_DATE. 02138 * \out emptyDate An RFC_DATE object, which will receive the field value. 02139 * \out *errorInfo More information in case something goes wrong. 02140 * \return RFC_RC 02141 */ 02142 DECL_EXP RFC_RC SAP_API RfcGetDateByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, RFC_DATE emptyDate, RFC_ERROR_INFO* errorInfo); 02143 02144 /** 02145 * \brief Reads a TIME field. 02146 * \ingroup container 02147 * 02148 * 02149 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02150 * is a table handle, the function will read the field value of the current row. 02151 * \in *name The name of the field to read. The field must be of type RFCTYPE_TIME. 02152 * \out emptyTime An RFC_TIME object, which will receive the field value. 02153 * \out *errorInfo More information in case something goes wrong. 02154 * \return RFC_RC 02155 */ 02156 DECL_EXP RFC_RC SAP_API RfcGetTime(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, RFC_TIME emptyTime, RFC_ERROR_INFO* errorInfo); 02157 02158 /** 02159 * \brief Reads a TIME field. 02160 * \ingroup container 02161 * 02162 * This function works exactly like RfcGetTime(), the difference being that the field is 02163 * addressed by its index within the structure/table/function module. The first field has index 0, 02164 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02165 * 02166 * 02167 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02168 * is a table handle, the function will read the field value of the current row. 02169 * \in index The index of the field to read. The field must be of type RFCTYPE_TIME. 02170 * \out emptyTime An RFC_TIME object, which will receive the field value. 02171 * \out *errorInfo More information in case something goes wrong. 02172 * \return RFC_RC 02173 */ 02174 DECL_EXP RFC_RC SAP_API RfcGetTimeByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, RFC_TIME emptyTime, RFC_ERROR_INFO* errorInfo); 02175 02176 /** 02177 * \brief Returns the value of the specified field as null-terminated string. 02178 * \ingroup container 02179 * 02180 * The charBuffer will be filled with a null-terminated string representation of the field value. 02181 * In case the buffer is too small, e.g. no place for string termination, the function will 02182 * return RFC_BUFFER_TOO_SMALL. stringLength contains the number of written characters, or the 02183 * required number of characters in case RFC_BUFFER_TOO_SMALL was thrown. 02184 * The result will be null-terminated. 02185 * 02186 * The field specified by name needs to be of one of the following data types. If the field 02187 * has one of the listed non-char-like data types, the RFC library will convert the field value 02188 * to string format. Example:\n 02189 * If "name" specifies a field of type INT4 with the value 4711 and stringBuffer is an SAP_UC[10], 02190 * then the buffer will be filled as follows: "4711\0xxxxx". (x: left unchanged.) 02191 * 02192 * \note If the target field has type BYTE or XSTRING, the bytes will be 02193 * converted to a hex encoded string representation. 02194 * 02195 * - RFCTYPE_CHAR 02196 * - RFCTYPE_STRING 02197 * - RFCTYPE_NUM 02198 * - RFCTYPE_DATE 02199 * - RFCTYPE_TIME 02200 * - RFCTYPE_INTx 02201 * - RFCTYPE_FLOAT 02202 * - RFCTYPE_BCD 02203 * - RFCTYPE_DECFxx 02204 * - RFCTYPE_BYTE 02205 * - RFCTYPE_XSTRING 02206 * 02207 * 02208 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02209 * is a table handle, the function will read the field value of the current row. 02210 * \in *name The name of the field to read. 02211 * \out *stringBuffer Pre-allocated buffer, which will receive the (converted) field value. 02212 * \in bufferLength Size of the buffer in SAP_UC. 02213 * \out *stringLength Always returns the string's length, no matter whether the stringBuffer had 02214 * been large enough or not. (Note that if you want to try again after an RFC_BUFFER_TOO_SMALL, 02215 * you need to make the stringBuffer at least *stringLength + 1 in order to account for the terminating null.) 02216 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02217 * \return RFC_RC 02218 */ 02219 DECL_EXP RFC_RC SAP_API RfcGetString(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, SAP_UC *stringBuffer, unsigned bufferLength, unsigned* stringLength, RFC_ERROR_INFO* errorInfo); 02220 02221 /** 02222 * \brief Returns the value of the specified field as null-terminated string. 02223 * \ingroup container 02224 * 02225 * This function works exactly like RfcGetString(), the difference being that the field is 02226 * addressed by its index within the structure/table/function module. The first field has index 0, 02227 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02228 * 02229 * 02230 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02231 * is a table handle, the function will read the field value of the current row. 02232 * \in index The index of the field to read. 02233 * \out *stringBuffer Pre-allocated buffer, which will receive the (converted) field value. 02234 * \in bufferLength Size of the buffer in SAP_UC. 02235 * \out *stringLength Always returns the string's length, no matter whether the stringBuffer had 02236 * been large enough or not. (Note that if you want to try again after an RFC_BUFFER_TOO_SMALL, 02237 * you need to make the stringBuffer at least *stringLength + 1 in order to account for the termnating null.) 02238 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02239 * \return RFC_RC 02240 */ 02241 DECL_EXP RFC_RC SAP_API RfcGetStringByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, SAP_UC *stringBuffer, unsigned bufferLength, unsigned* stringLength, RFC_ERROR_INFO* errorInfo); 02242 02243 /** 02244 * \brief Returns the value of the specified field as byte array. 02245 * \ingroup container 02246 * 02247 * Should mainly be used with fields of type RAW (RFCTYPE_BYTE), but also works with 02248 * a number of other data types. In case of numerical data types it simply gives the 02249 * binary representation of the value, in case of character data types it gives the 02250 * UTF-16 representation (little endian/big endian, depending on the host platform). 02251 * In case the buffer is too small, the function will return RFC_BUFFER_TOO_SMALL. 02252 * In case the buffer is longer than the field, it will be filled with 0x00 values. 02253 * Example: The field is of type INT4 and contains the value 4711, byteBuffer is an SAP_RAW[10]. 02254 * Then the buffer will be filled as follows: 67 12 00 00 00 00 00 00 00 00 (little endian system) 02255 * or 00 00 12 67 00 00 00 00 00 00 (big endian system). 02256 * 02257 * The field specified by name needs to be of one of the following data types: 02258 * - RFCTYPE_BYTE 02259 * - RFCTYPE_XSTRING 02260 * - RFCTYPE_CHAR 02261 * - RFCTYPE_NUM 02262 * - RFCTYPE_DATE 02263 * - RFCTYPE_TIME 02264 * - RFCTYPE_INTx 02265 * - RFCTYPE_FLOAT 02266 * - RFCTYPE_BCD 02267 * - RFCTYPE_DECFxx 02268 * 02269 * 02270 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02271 * is a table handle, the function will read the field value of the current row. 02272 * \in *name The name of the field to read. 02273 * \out *byteBuffer Pre-allocated buffer, which will receive the (converted) field value. 02274 * \in bufferLength Size of the buffer in bytes. 02275 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02276 * \return RFC_RC 02277 */ 02278 DECL_EXP RFC_RC SAP_API RfcGetBytes(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, SAP_RAW *byteBuffer, unsigned bufferLength, RFC_ERROR_INFO* errorInfo); 02279 02280 /** 02281 * \brief Returns the value of the specified field as byte array. 02282 * \ingroup container 02283 * 02284 * This function works exactly like RfcGetBytes(), the difference being that the field is 02285 * addressed by its index within the structure/table/function module. The first field has index 0, 02286 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02287 * 02288 * 02289 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02290 * is a table handle, the function will read the field value of the current row. 02291 * \in index The index of the field to read. 02292 * \out *byteBuffer Pre-allocated buffer, which will receive the (converted) field value. 02293 * \in bufferLength Size of the buffer in bytes. 02294 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02295 * \return RFC_RC 02296 */ 02297 DECL_EXP RFC_RC SAP_API RfcGetBytesByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, SAP_RAW *byteBuffer, unsigned bufferLength, RFC_ERROR_INFO* errorInfo); 02298 02299 /** 02300 * \brief Returns the value of the specified field as byte array. 02301 * \ingroup container 02302 * 02303 * In case the buffer is too small, the function will return RFC_BUFFER_TOO_SMALL. 02304 * xstringLength contains the number of written bytes, or the required number of bytes 02305 * in case of RFC_BUFFER_TOO_SMALL. 02306 * The remaining buffer won't be changed. 02307 * 02308 * Example: The field is of type INT4 and contains the value 4711, byteBuffer is an SAP_RAW[10]. 02309 * Then the buffer will be filled as follows: 67 12 00 00 x x x x x x (little endian system) 02310 * or 00 00 12 67 x x x x x x (big endian system). (x: unchanged) In both cases *xstringLength 02311 * will be 4. 02312 * 02313 * The field specified by name needs to be of one of the following data types: 02314 * - RFCTYPE_BYTE 02315 * - RFCTYPE_XSTRING 02316 * - RFCTYPE_CHAR 02317 * - RFCTYPE_NUM 02318 * - RFCTYPE_DATE 02319 * - RFCTYPE_TIME 02320 * - RFCTYPE_INTx 02321 * - RFCTYPE_FLOAT 02322 * - RFCTYPE_BCD 02323 * - RFCTYPE_DECFxx 02324 * 02325 * 02326 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02327 * is a table handle, the function will read the field value of the current row. 02328 * \in *name The name of the field to read. 02329 * \out *byteBuffer Pre-allocated buffer, which will receive the (converted) field value. 02330 * \in bufferLength Size of the buffer in bytes. 02331 * \out *xstringLength Byte length of the result (in both cases, no matter whether the byteBuffer had 02332 * been large enough or not). 02333 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02334 * \return RFC_RC 02335 */ 02336 DECL_EXP RFC_RC SAP_API RfcGetXString(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, SAP_RAW *byteBuffer, unsigned bufferLength, unsigned* xstringLength, RFC_ERROR_INFO* errorInfo); 02337 02338 /** 02339 * \brief Returns the value of the specified field as byte array. 02340 * \ingroup container 02341 * 02342 * This function works exactly like RfcGetXString(), the difference being that the field is 02343 * addressed by its index within the structure/table/function module. The first field has index 0, 02344 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02345 * 02346 * 02347 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02348 * is a table handle, the function will read the field value of the current row. 02349 * \in index The index of the field to read. 02350 * \out *byteBuffer Pre-allocated buffer, which will receive the (converted) field value. 02351 * \in bufferLength Size of the buffer in bytes. 02352 * \out *xstringLength Byte length of the result (in both cases, no matter whether the byteBuffer had 02353 * been large enough or not). 02354 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02355 * \return RFC_RC 02356 */ 02357 DECL_EXP RFC_RC SAP_API RfcGetXStringByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, SAP_RAW *byteBuffer, unsigned bufferLength, unsigned* xstringLength, RFC_ERROR_INFO* errorInfo); 02358 02359 /** 02360 * \brief Returns the value of the specified field as RFC_INT (signed). 02361 * \ingroup container 02362 * 02363 * If the field is a character type, an "atoi-like" conversion is performed. If the field is of type 02364 * RFCTYPE_BYTE/RFCTYPE_XSTRING, this function interprets the bytes in big-endian byte order when 02365 * converting them to int. Note that in this case the byte length of the field value must not exceed 4! 02366 * 02367 * The field specified by name needs to be of one of the following data types: 02368 * - RFCTYPE_INT 02369 * - RFCTYPE_INT2 02370 * - RFCTYPE_INT1 02371 * - RFCTYPE_BYTE is interpreted as big endian sequence of an int 02372 * - RFCTYPE_XSTRING is interpreted as big endian sequence of an int 02373 * - RFCTYPE_CHAR 02374 * - RFCTYPE_NUM 02375 * - RFCTYPE_STRING 02376 * 02377 * 02378 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02379 * is a table handle, the function will read the field value of the current row. 02380 * \in *name The name of the field to read. 02381 * \out *value The (converted) integer value. 02382 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02383 * \return RFC_RC 02384 */ 02385 DECL_EXP RFC_RC SAP_API RfcGetInt(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, RFC_INT *value, RFC_ERROR_INFO* errorInfo); 02386 02387 /** 02388 * \brief Returns the value of the specified field as RFC_INT (signed). 02389 * \ingroup container 02390 * 02391 * This function works exactly like RfcGetInt(), the difference being that the field is 02392 * addressed by its index within the structure/table/function module. The first field has index 0, 02393 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02394 * 02395 * 02396 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02397 * is a table handle, the function will read the field value of the current row. 02398 * \in index The index of the field to read. 02399 * \out *value The (converted) integer value. 02400 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02401 * \return RFC_RC 02402 */ 02403 DECL_EXP RFC_RC SAP_API RfcGetIntByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, RFC_INT *value, RFC_ERROR_INFO* errorInfo); 02404 02405 /** 02406 * \brief Returns the value of a field as an unsigned one byte integer. 02407 * \ingroup container 02408 * 02409 * The current field value must not be bigger than 255, otherwise you'll get an 02410 * RFC_CONVERSION_ERROR. If the field is of type RFCTYPE_BYTE/RFCTYPE_XSTRING, the field length must be 1 byte. 02411 * 02412 * The field specified by name needs to be of one of the following data types: 02413 * - RFCTYPE_INT 02414 * - RFCTYPE_INT2 02415 * - RFCTYPE_INT1 02416 * - RFCTYPE_BYTE 02417 * - RFCTYPE_XSTRING 02418 * 02419 * 02420 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02421 * is a table handle, the function will read the field value of the current row. 02422 * \in *name The name of the field to read. 02423 * \out *value The (converted) integer value. 02424 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02425 * \return RFC_RC 02426 */ 02427 DECL_EXP RFC_RC SAP_API RfcGetInt1(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, RFC_INT1 *value, RFC_ERROR_INFO* errorInfo); 02428 02429 /** 02430 * \brief Returns the value of a field as an unsigned one byte integer. 02431 * \ingroup container 02432 * 02433 * This function works exactly like RfcGetInt1(), the difference being that the field is 02434 * addressed by its index within the structure/table/function module. The first field has index 0, 02435 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02436 * 02437 * 02438 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02439 * is a table handle, the function will read the field value of the current row. 02440 * \in index The index of the field to read. 02441 * \out *value The (converted) integer value. 02442 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02443 * \return RFC_RC 02444 */ 02445 DECL_EXP RFC_RC SAP_API RfcGetInt1ByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, RFC_INT1 *value, RFC_ERROR_INFO* errorInfo); 02446 02447 /** 02448 * \brief Returns the field value as a signed two byte integer. 02449 * \ingroup container 02450 * 02451 * The current field value must not be between -32768 and 32767, otherwise you'll get an 02452 * RFC_CONVERSION_ERROR. If the field is of type RFCTYPE_BYTE/RFCTYPE_XSTRING, the field length must be 1 or 2 bytes. 02453 * 02454 * The field specified by name needs to be of one of the following data types: 02455 * - RFCTYPE_INT 02456 * - RFCTYPE_INT2 02457 * - RFCTYPE_INT1 02458 * - RFCTYPE_BYTE is interpreted as big endian sequence of a short 02459 * - RFCTYPE_XSTRING is interpreted as big endian sequence of a short 02460 * 02461 * 02462 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02463 * is a table handle, the function will read the field value of the current row. 02464 * \in *name The name of the field to read. 02465 * \out *value The (converted) integer value. 02466 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02467 * \return RFC_RC 02468 */ 02469 DECL_EXP RFC_RC SAP_API RfcGetInt2(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, RFC_INT2 *value, RFC_ERROR_INFO* errorInfo); 02470 02471 /** 02472 * \brief Returns the field value as a signed two byte integer. 02473 * \ingroup container 02474 * 02475 * This function works exactly like RfcGetInt2(), the difference being that the field is 02476 * addressed by its index within the structure/table/function module. The first field has index 0, 02477 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02478 * 02479 * 02480 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02481 * is a table handle, the function will read the field value of the current row. 02482 * \in index The index of the field to read. 02483 * \out *value The (converted) integer value. 02484 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02485 * \return RFC_RC 02486 */ 02487 DECL_EXP RFC_RC SAP_API RfcGetInt2ByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, RFC_INT2 *value, RFC_ERROR_INFO* errorInfo); 02488 02489 /** 02490 * \brief Returns the value of the given field as an RFC_FLOAT. 02491 * \ingroup container 02492 * 02493 * The field specified by name needs to be of one of the following data types: 02494 * - RFCTYPE_FLOAT 02495 * - RFCTYPE_BCD 02496 * 02497 * 02498 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02499 * is a table handle, the function will read the field value of the current row. 02500 * \in *name The name of the field to read. 02501 * \out *value The floating point value. 02502 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02503 * \return RFC_RC 02504 */ 02505 DECL_EXP RFC_RC SAP_API RfcGetFloat(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, RFC_FLOAT *value, RFC_ERROR_INFO* errorInfo); 02506 02507 /** 02508 * \brief Returns the value of the given field as an RFC_FLOAT. 02509 * \ingroup container 02510 * 02511 * This function works exactly like RfcGetFloat(), the difference being that the field is 02512 * addressed by its index within the structure/table/function module. The first field has index 0, 02513 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02514 * 02515 * 02516 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02517 * is a table handle, the function will read the field value of the current row. 02518 * \in index The index of the field to read. 02519 * \out *value The floating point value. 02520 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02521 * \return RFC_RC 02522 */ 02523 DECL_EXP RFC_RC SAP_API RfcGetFloatByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, RFC_FLOAT *value, RFC_ERROR_INFO* errorInfo); 02524 02525 /** 02526 * \brief Returns the field as an 8 byte IEEE 754r decimal floating point. 02527 * \ingroup container 02528 * 02529 * See the header sapdecf.h for how to work with RFC_DECF16 objects. If the field has a binary 02530 * data type, its field length needs to be 8 bytes. 02531 * 02532 * The field specified by name needs to be of one of the following data types: 02533 * - RFCTYPE_DECF16 02534 * - RFCTYPE_DECF34 02535 * - RFCTYPE_FLOAT 02536 * - RFCTYPE_BCD 02537 * - RFCTYPE_INT 02538 * - RFCTYPE_INT2 02539 * - RFCTYPE_INT1 02540 * - RFCTYPE_CHAR 02541 * - RFCTYPE_NUM 02542 * - RFCTYPE_STRING 02543 * - RFCTYPE_BYTE is interpreted as IEEE 754r format 02544 * - RFCTYPE_XSTRING is interpreted as IEEE 754r format 02545 * 02546 * 02547 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02548 * is a table handle, the function will read the field value of the current row. 02549 * \in *name The name of the field to read. 02550 * \out *value The (converted) decimal floating point value. 02551 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02552 * \return RFC_RC 02553 */ 02554 DECL_EXP RFC_RC SAP_API RfcGetDecF16(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, RFC_DECF16 *value, RFC_ERROR_INFO* errorInfo); 02555 02556 /** 02557 * \brief Returns the field as an 8 byte IEEE 754r decimal floating point. 02558 * \ingroup container 02559 * 02560 * This function works exactly like RfcGetDecF16(), the difference being that the field is 02561 * addressed by its index within the structure/table/function module. The first field has index 0, 02562 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02563 * 02564 * 02565 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02566 * is a table handle, the function will read the field value of the current row. 02567 * \in index The index of the field to read. 02568 * \out *value The (converted) decimal floating point value. 02569 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02570 * \return RFC_RC 02571 */ 02572 DECL_EXP RFC_RC SAP_API RfcGetDecF16ByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, RFC_DECF16 *value, RFC_ERROR_INFO* errorInfo); 02573 02574 /** 02575 * \brief Returns the field as a 16 byte IEEE 754r decimal floating point. 02576 * \ingroup container 02577 * 02578 * See the header sapdecf.h for how to work with RFC_DECF16 objects. If the field has a binary 02579 * data type, its field length needs to be 16 bytes. 02580 * 02581 * The field specified by name needs to be of one of the following data types: 02582 * - RFCTYPE_DECF16 02583 * - RFCTYPE_DECF34 02584 * - RFCTYPE_FLOAT 02585 * - RFCTYPE_BCD 02586 * - RFCTYPE_INT 02587 * - RFCTYPE_INT2 02588 * - RFCTYPE_INT1 02589 * - RFCTYPE_CHAR 02590 * - RFCTYPE_NUM 02591 * - RFCTYPE_STRING 02592 * - RFCTYPE_BYTE is interpreted as IEEE 754r format 02593 * - RFCTYPE_XSTRING is interpreted as IEEE 754r format 02594 * 02595 * 02596 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02597 * is a table handle, the function will read the field value of the current row. 02598 * \in *name The name of the field to read. 02599 * \out *value The (converted) decimal floating point value. 02600 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02601 * \return RFC_RC 02602 */ 02603 DECL_EXP RFC_RC SAP_API RfcGetDecF34(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, RFC_DECF34 *value, RFC_ERROR_INFO* errorInfo); 02604 02605 /** 02606 * \brief Returns the field as a 16 byte IEEE 754r decimal floating point. 02607 * \ingroup container 02608 * 02609 * This function works exactly like RfcGetDecF34(), the difference being that the field is 02610 * addressed by its index within the structure/table/function module. The first field has index 0, 02611 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02612 * 02613 * 02614 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02615 * is a table handle, the function will read the field value of the current row. 02616 * \in index The index of the field to read. 02617 * \out *value The (converted) decimal floating point value. 02618 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02619 * \return RFC_RC 02620 */ 02621 DECL_EXP RFC_RC SAP_API RfcGetDecF34ByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, RFC_DECF34 *value, RFC_ERROR_INFO* errorInfo); 02622 02623 /** 02624 * \brief Returns a handle to a structure. 02625 * \ingroup container 02626 * 02627 * The field specified by name must be of type RFCTYPE_STRUCTURE. If that field has not yet 02628 * been accessed/filled previously, a new empty structure is created from the metadata of the 02629 * parent data container ("dataHandle") and returned. 02630 * \warning The memory of that data container will be released, when the parent container gets 02631 * destroyed. So don't destroy the returned structure handle, nor continue to use it, after the 02632 * parent has been destroyed! 02633 * 02634 * 02635 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02636 * is a table handle, the function will read the field value of the current row. 02637 * \in *name The name of the field to read. 02638 * \out *structHandle A handle to the sub-structure. 02639 * \out *errorInfo Field does not exist, is of wrong type or out of memory. 02640 * \return RFC_RC 02641 */ 02642 DECL_EXP RFC_RC SAP_API RfcGetStructure(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, RFC_STRUCTURE_HANDLE* structHandle, RFC_ERROR_INFO* errorInfo); 02643 02644 /** 02645 * \brief Returns a handle to a structure. 02646 * \ingroup container 02647 * 02648 * This function works exactly like RfcGetStructure(), the difference being that the field is 02649 * addressed by its index within the structure/table/function module. The first field has index 0, 02650 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02651 * 02652 * 02653 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02654 * is a table handle, the function will read the field value of the current row. 02655 * \in index The index of the field to read. 02656 * \out *structHandle A handle to the sub-structure. 02657 * \out *errorInfo Field does not exist, is of wrong type or out of memory. 02658 * \return RFC_RC 02659 */ 02660 DECL_EXP RFC_RC SAP_API RfcGetStructureByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, RFC_STRUCTURE_HANDLE* structHandle, RFC_ERROR_INFO* errorInfo); 02661 02662 /** 02663 * \brief Returns a handle to a table. 02664 * \ingroup container 02665 * 02666 * The field specified by name must be of type RFCTYPE_TABLE. If that field has not yet 02667 * been accessed/filled previously, a new empty structure is created from the metadata of the 02668 * parent data container ("dataHandle") and returned. 02669 * \warning The memory of that data container will be released, when the parent container gets 02670 * destroyed. So don't destroy the returned table handle, nor continue to use it, after the 02671 * parent has been destroyed! 02672 * 02673 * 02674 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02675 * is a table handle, the function will read the field value of the current row. 02676 * \in *name The name of the field to read. 02677 * \out *tableHandle A handle to the sub-table. 02678 * \out *errorInfo Field does not exist, is of wrong type or out of memory. 02679 * \return RFC_RC 02680 */ 02681 DECL_EXP RFC_RC SAP_API RfcGetTable(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, RFC_TABLE_HANDLE* tableHandle, RFC_ERROR_INFO* errorInfo); 02682 02683 /** 02684 * \brief Returns a handle to a table. 02685 * \ingroup container 02686 * 02687 * This function works exactly like RfcGetTable(), the difference being that the field is 02688 * addressed by its index within the structure/table/function module. The first field has index 0, 02689 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02690 * 02691 * 02692 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02693 * is a table handle, the function will read the field value of the current row. 02694 * \in index The index of the field to read. 02695 * \out *tableHandle A handle to the sub-table. 02696 * \out *errorInfo Field does not exist, is of wrong type or out of memory. 02697 * \return RFC_RC 02698 */ 02699 DECL_EXP RFC_RC SAP_API RfcGetTableByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, RFC_TABLE_HANDLE* tableHandle, RFC_ERROR_INFO* errorInfo); 02700 02701 /** 02702 * \brief Returns a handle to an abap object. 02703 * \ingroup container 02704 * 02705 * The field specified by name must be of type RFCTYPE_ABAPOBJECT. If that field has not yet 02706 * been filled previously, NULL is returned. 02707 * \warning The memory of that data container will be released, when the parent container gets 02708 * destroyed. So don't destroy the returned table handle, nor continue to use it, after the 02709 * parent has been destroyed! 02710 * 02711 * 02712 * \in dataHandle A data container (function handle, structure handle, table handle or object handle). If dataHandle 02713 * is a table handle, the function will read the field value of the current row. 02714 * \in *name The name of the field to read. 02715 * \out *objHandle A handle to the object. 02716 * \out *errorInfo Field does not exist, is of wrong type or out of memory. 02717 * \return RFC_RC 02718 */ 02719 DECL_EXP RFC_RC SAP_API RfcGetAbapObject(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, RFC_ABAP_OBJECT_HANDLE* objHandle, RFC_ERROR_INFO* errorInfo); 02720 02721 /** 02722 * \brief Returns a handle to an abap object. 02723 * \ingroup container 02724 * 02725 * This function works exactly like RfcGetAbapObject(), the difference being that the field is 02726 * addressed by its index within the structure/table/function module. The first field has index 0, 02727 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02728 * 02729 * 02730 * \in dataHandle A data container (function handle, structure handle, table handle or object handle). If dataHandle 02731 * is a table handle, the function will read the field value of the current row. 02732 * \in index The index of the field to read. 02733 * \out *objHandle A handle to the object. 02734 * \out *errorInfo Field does not exist, is of wrong type or out of memory. 02735 * \return RFC_RC 02736 */ 02737 DECL_EXP RFC_RC SAP_API RfcGetAbapObjectByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, RFC_ABAP_OBJECT_HANDLE* objHandle, RFC_ERROR_INFO* errorInfo); 02738 02739 /** 02740 * \brief Returns the length of the value of a STRING or XSTRING parameter. 02741 * \ingroup container 02742 * 02743 * The field specified by name must be of type RFCTYPE_STRING or RFCTYPE_XSTRING. If that field is 02744 * of type STRING, the returned length is measured in characters, otherwise in bytes. 02745 * 02746 * 02747 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02748 * is a table handle, the function will read the field value of the current row. 02749 * \in *name The name of a STRING or XSTRING field. 02750 * \out *stringLength Length of the current field value. 02751 * \out *errorInfo Wrong field type? 02752 * \return RFC_RC 02753 */ 02754 DECL_EXP RFC_RC SAP_API RfcGetStringLength(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, unsigned* stringLength, RFC_ERROR_INFO* errorInfo); 02755 02756 /** 02757 * \brief Returns the length of the value of a STRING or XSTRING parameter. 02758 * \ingroup container 02759 * 02760 * This function works exactly like RfcGetStringLength(), the difference being that the field is 02761 * addressed by its index within the structure/table/function module. The first field has index 0, 02762 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02763 * 02764 * 02765 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02766 * is a table handle, the function will read the field value of the current row. 02767 * \in index The index of a STRING or XSTRING field. 02768 * \out *stringLength Length of the current field value. 02769 * \out *errorInfo Wrong field type? 02770 * \return RFC_RC 02771 */ 02772 DECL_EXP RFC_RC SAP_API RfcGetStringLengthByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, unsigned* stringLength, RFC_ERROR_INFO* errorInfo); 02773 02774 02775 02776 /* ***************************************************************************** 02777 * 02778 * API for setting the importing parameters of an RFC_FUNCTION_HANDLE in the 02779 * client case, the exporting parameters of an RFC_FUNCTION_HANDLE in the server 02780 * case and the subfields of an RFC_STRUCTURE_HANDLE or RFC_TABLE_HANDLE. 02781 * 02782 *******************************************************************************/ 02783 02784 /** 02785 * \brief Sets the given char value (charValue/valueLength) into the field. 02786 * \ingroup container 02787 * 02788 * The field specified by name needs to be of one of the following data types: 02789 * - RFCTYPE_CHAR 02790 * - RFCTYPE_STRING 02791 * - RFCTYPE_NUM 02792 * - RFCTYPE_DATE 02793 * - RFCTYPE_TIME 02794 * - RFCTYPE_INTx 02795 * - RFCTYPE_FLOAT 02796 * - RFCTYPE_BCD 02797 * - RFCTYPE_DECFxx 02798 * - RFCTYPE_BYTE 02799 * - RFCTYPE_XSTRING 02800 * \note If the target field is a numerical type, the RFC library tries to convert the string 02801 * to a number. If the target field has type BYTE or XSTRING, the char value will be interpreted as 02802 * hex encoded string representation of the bytes. Its length needs to be even in that case.\n 02803 * Example: the 8 characters "CAFEBABE" will be converted to 4 bytes 0xCA 0xFE 0xBA 0xBE. 02804 * 02805 * If the value cannot be converted to the desired target type, RFC_CONVERSION_ERROR will be 02806 * returned. 02807 * 02808 * 02809 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02810 * is a table handle, the function will read the field value of the current row. 02811 * \in *name The name of the field to set. 02812 * \in *charValue The characters to write into the field. 02813 * \in valueLength The number of characters to read from charValue. 02814 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02815 * \return RFC_RC 02816 */ 02817 DECL_EXP RFC_RC SAP_API RfcSetChars(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, const RFC_CHAR *charValue, unsigned valueLength, RFC_ERROR_INFO* errorInfo); 02818 02819 /** 02820 * \brief Sets the given char value (charValue/valueLength) into the field. 02821 * \ingroup container 02822 * 02823 * This function works exactly like RfcSetChars(), the difference being that the field is 02824 * addressed by its index within the structure/table/function module. The first field has index 0, 02825 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02826 * 02827 * 02828 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02829 * is a table handle, the function will read the field value of the current row. 02830 * \in *index The index of the field to set. 02831 * \in *charValue The characters to write into the field. 02832 * \in valueLength The number of characters to read from charValue. 02833 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02834 * \return RFC_RC 02835 */ 02836 DECL_EXP RFC_RC SAP_API RfcSetCharsByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, const RFC_CHAR *charValue, unsigned valueLength, RFC_ERROR_INFO* errorInfo); 02837 02838 /** 02839 * \brief Sets the value of a NUMC field. 02840 * \ingroup container 02841 * 02842 * The target field needs to be of type RFCTYPE_NUM. 02843 * 02844 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02845 * is a table handle, the function will read the field value of the current row. 02846 * \in *name The name of the field to set. 02847 * \in *charValue The digits [0..9] to write into the field. 02848 * \in valueLength The number of characters to read from charValue. 02849 * \out *errorInfo More information in case the field does not exist or the parameter value is invalid. 02850 * \return RFC_RC 02851 */ 02852 DECL_EXP RFC_RC SAP_API RfcSetNum(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, const RFC_NUM *charValue, unsigned valueLength, RFC_ERROR_INFO* errorInfo); 02853 02854 /** 02855 * \brief Sets the value of a NUMC field. 02856 * \ingroup container 02857 * 02858 * This function works exactly like RfcSetNum(), the difference being that the field is 02859 * addressed by its index within the structure/table/function module. The first field has index 0, 02860 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02861 * 02862 * 02863 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02864 * is a table handle, the function will read the field value of the current row. 02865 * \in *index The index of the field to set. 02866 * \in *charValue The digits [0..9] to write into the field. 02867 * \in valueLength The number of characters to read from charValue. 02868 * \out *errorInfo More information in case the field does not exist or the parameter value is invalid. 02869 * \return RFC_RC 02870 */ 02871 DECL_EXP RFC_RC SAP_API RfcSetNumByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, const RFC_NUM *charValue, unsigned valueLength, RFC_ERROR_INFO* errorInfo); 02872 02873 /** 02874 * \brief Sets the given string value (stringValue/valueLength) into the field. 02875 * \ingroup container 02876 * 02877 * The field specified by name needs to be of one of the following data types: 02878 * - RFCTYPE_CHAR 02879 * - RFCTYPE_STRING 02880 * - RFCTYPE_NUM 02881 * - RFCTYPE_DATE 02882 * - RFCTYPE_TIME 02883 * - RFCTYPE_INTx 02884 * - RFCTYPE_FLOAT 02885 * - RFCTYPE_BCD 02886 * - RFCTYPE_DECFxx 02887 * - RFCTYPE_BYTE 02888 * - RFCTYPE_XSTRING 02889 * \note If the target field is a numerical type, the RFC library tries to convert the string 02890 * to a number. If the target field has type BYTE or XSTRING, the char value will be interpreted as 02891 * hex encoded string representation of the bytes. Its length needs to be even in that case.\n 02892 * Example: the 8 characters "CAFEBABE" will be converted to 4 bytes 0xCA 0xFE 0xBA 0xBE. 02893 * 02894 * If the value cannot be converted to the desired target type, RFC_CONVERSION_ERROR will be 02895 * returned. 02896 * 02897 * 02898 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02899 * is a table handle, the function will read the field value of the current row. 02900 * \in *name The name of the field to set. 02901 * \in *stringValue The characters to write into the field. 02902 * \in valueLength The number of characters to read from stringValue. 02903 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02904 * \return RFC_RC 02905 */ 02906 DECL_EXP RFC_RC SAP_API RfcSetString(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, const SAP_UC *stringValue, unsigned valueLength, RFC_ERROR_INFO* errorInfo); 02907 02908 /** 02909 * \brief Sets the given string value (stringValue/valueLength) into the field. 02910 * \ingroup container 02911 * 02912 * This function works exactly like RfcSetString(), the difference being that the field is 02913 * addressed by its index within the structure/table/function module. The first field has index 0, 02914 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02915 * 02916 * 02917 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02918 * is a table handle, the function will read the field value of the current row. 02919 * \in *index The index of the field to set. 02920 * \in *stringValue The characters to write into the field. 02921 * \in valueLength The number of characters to read from stringValue. 02922 * \out *errorInfo More information in case the field does not exist or a conversion fails. 02923 * \return RFC_RC 02924 */ 02925 DECL_EXP RFC_RC SAP_API RfcSetStringByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, const SAP_UC *stringValue, unsigned valueLength, RFC_ERROR_INFO* errorInfo); 02926 02927 /** 02928 * \brief Sets the value of a DATE field. 02929 * \ingroup container 02930 * 02931 * The target field needs to be of type RFCTYPE_DATE. 02932 * 02933 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02934 * is a table handle, the function will read the field value of the current row. 02935 * \in *name The name of the field to set. 02936 * \in date The date value to write into the field. 02937 * \out *errorInfo Is the field not of type DATE? 02938 * \return RFC_RC 02939 */ 02940 DECL_EXP RFC_RC SAP_API RfcSetDate(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, const RFC_DATE date, RFC_ERROR_INFO* errorInfo); 02941 02942 /** 02943 * \brief Sets the value of a DATE field. 02944 * \ingroup container 02945 * 02946 * This function works exactly like RfcSetDate(), the difference being that the field is 02947 * addressed by its index within the structure/table/function module. The first field has index 0, 02948 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02949 * 02950 * 02951 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02952 * is a table handle, the function will read the field value of the current row. 02953 * \in *index The index of the field to set. 02954 * \in date The date value to write into the field. 02955 * \out *errorInfo Is the field not of type DATE? 02956 * \return RFC_RC 02957 */ 02958 DECL_EXP RFC_RC SAP_API RfcSetDateByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, const RFC_DATE date, RFC_ERROR_INFO* errorInfo); 02959 02960 /** 02961 * \brief Sets the value of a TIME field. 02962 * \ingroup container 02963 * 02964 * The target field needs to be of type RFCTYPE_TIME. 02965 * 02966 * 02967 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02968 * is a table handle, the function will read the field value of the current row. 02969 * \in *name The name of the field to set. 02970 * \in time The time value to write into the field. 02971 * \out *errorInfo Is the field not of type TIME? 02972 * \return RFC_RC 02973 */ 02974 DECL_EXP RFC_RC SAP_API RfcSetTime(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, const RFC_TIME time, RFC_ERROR_INFO* errorInfo); 02975 02976 /** 02977 * \brief Sets the value of a TIME field. 02978 * \ingroup container 02979 * 02980 * This function works exactly like RfcSetTime(), the difference being that the field is 02981 * addressed by its index within the structure/table/function module. The first field has index 0, 02982 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 02983 * 02984 * 02985 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 02986 * is a table handle, the function will read the field value of the current row. 02987 * \in *index The index of the field to set. 02988 * \in time The time value to write into the field. 02989 * \out *errorInfo Is the field not of type TIME? 02990 * \return RFC_RC 02991 */ 02992 DECL_EXP RFC_RC SAP_API RfcSetTimeByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, const RFC_TIME time, RFC_ERROR_INFO* errorInfo); 02993 02994 /** 02995 * \brief Sets the given byte value (byteValue/valueLength) into the field. 02996 * \ingroup container 02997 * 02998 * The field specified by name needs to be of one of the following data types: 02999 * - RFCTYPE_BYTE 03000 * - RFCTYPE_XSTRING 03001 * - RFCTYPE_CHAR 03002 * - RFCTYPE_STRING 03003 * - RFCTYPE_INTx 03004 * - RFCTYPE_FLOAT 03005 * - RFCTYPE_BCD 03006 * - RFCTYPE_DECFxx 03007 * \note: If the target field has type CHAR or STRING, the byte value 03008 * will be stored as a hex representation of the bytes.\n 03009 * If the target field has a numerical type, the byte value will be 03010 * assigned only if the given valueLength matches the field length. 03011 * In order to use this feature, you need to know exactly what you are doing... 03012 * E.g. when setting 8 bytes into an RFC_FLOAT field, you need to understand the 03013 * IEEE floating point format. Better only use this function for setting RAW fields. 03014 * 03015 * 03016 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03017 * is a table handle, the function will read the field value of the current row. 03018 * \in *name The name of the field to set. 03019 * \in *byteValue The byte value to write into the field. 03020 * \in valueLength The number of bytes to use from byteValue. 03021 * \out *errorInfo More information in case the field does not exist or a conversion fails. 03022 * \return RFC_RC 03023 */ 03024 DECL_EXP RFC_RC SAP_API RfcSetBytes(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, const SAP_RAW *byteValue, unsigned valueLength, RFC_ERROR_INFO* errorInfo); 03025 03026 /** 03027 * \brief Sets the given byte value (byteValue/valueLength) into the field. 03028 * \ingroup container 03029 * 03030 * This function works exactly like RfcSetBytes(), the difference being that the field is 03031 * addressed by its index within the structure/table/function module. The first field has index 0, 03032 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 03033 * 03034 * 03035 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03036 * is a table handle, the function will read the field value of the current row. 03037 * \in *index The index of the field to set. 03038 * \in *byteValue The byte value to write into the field. 03039 * \in valueLength The number of bytes to use from byteValue. 03040 * \out *errorInfo More information in case the field does not exist or a conversion fails. 03041 * \return RFC_RC 03042 */ 03043 DECL_EXP RFC_RC SAP_API RfcSetBytesByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, const SAP_RAW *byteValue, unsigned valueLength, RFC_ERROR_INFO* errorInfo); 03044 03045 /** 03046 * \brief Sets the given byte value (byteValue/valueLength) into the field. 03047 * \ingroup container 03048 * 03049 * The field specified by name needs to be of one of the following data types: 03050 * - RFCTYPE_BYTE 03051 * - RFCTYPE_XSTRING 03052 * - RFCTYPE_CHAR 03053 * - RFCTYPE_STRING 03054 * - RFCTYPE_INTx 03055 * - RFCTYPE_FLOAT 03056 * - RFCTYPE_BCD 03057 * - RFCTYPE_DECFxx 03058 * \note: If the target field has type CHAR or STRING, the byte value 03059 * will be stored as a hex representation of the bytes.\n 03060 * If the target field has a numerical type, the byte value will be 03061 * assigned only if the given valueLength matches the field length. 03062 * In order to use this feature, you need to know exactly what you are doing... 03063 * E.g. when setting 8 bytes into an RFC_FLOAT field, you need to understand the 03064 * IEEE floating point format. Better only use this function for setting RAW fields. 03065 * 03066 * 03067 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03068 * is a table handle, the function will read the field value of the current row. 03069 * \in *name The name of the field to set. 03070 * \in *byteValue The byte value to write into the field. 03071 * \in valueLength The number of bytes to use from byteValue. 03072 * \out *errorInfo More information in case the field does not exist or a conversion fails. 03073 * \return RFC_RC 03074 */ 03075 DECL_EXP RFC_RC SAP_API RfcSetXString(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, const SAP_RAW *byteValue, unsigned valueLength, RFC_ERROR_INFO* errorInfo); 03076 03077 /** 03078 * \brief Sets the given byte value (byteValue/valueLength) into the field. 03079 * \ingroup container 03080 * 03081 * This function works exactly like RfcSetXString(), the difference being that the field is 03082 * addressed by its index within the structure/table/function module. The first field has index 0, 03083 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 03084 * 03085 * 03086 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03087 * is a table handle, the function will read the field value of the current row. 03088 * \in *index The index of the field to set. 03089 * \in *byteValue The byte value to write into the field. 03090 * \in valueLength The number of bytes to use from byteValue. 03091 * \out *errorInfo More information in case the field does not exist or a conversion fails. 03092 * \return RFC_RC 03093 */ 03094 DECL_EXP RFC_RC SAP_API RfcSetXStringByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, const SAP_RAW *byteValue, unsigned valueLength, RFC_ERROR_INFO* errorInfo); 03095 03096 /** 03097 * \brief Sets the value of an INT4 field. 03098 * \ingroup container 03099 * 03100 * The target field needs to be of type RFCTYPE_INT. 03101 * 03102 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03103 * is a table handle, the function will read the field value of the current row. 03104 * \in *name The name of the field to set. 03105 * \in value The int value to set. 03106 * \out *errorInfo Field does not exist or is not of type INT4? 03107 * \return RFC_RC 03108 */ 03109 DECL_EXP RFC_RC SAP_API RfcSetInt(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, const RFC_INT value, RFC_ERROR_INFO* errorInfo); 03110 03111 /** 03112 * \brief Sets the value of an INT4 field. 03113 * \ingroup container 03114 * 03115 * This function works exactly like RfcSetInt(), the difference being that the field is 03116 * addressed by its index within the structure/table/function module. The first field has index 0, 03117 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 03118 * 03119 * 03120 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03121 * is a table handle, the function will read the field value of the current row. 03122 * \in *index The index of the field to set. 03123 * \in value The int value to set. 03124 * \out *errorInfo Field does not exist or is not of type INT4? 03125 * \return RFC_RC 03126 */ 03127 DECL_EXP RFC_RC SAP_API RfcSetIntByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, const RFC_INT value, RFC_ERROR_INFO* errorInfo); 03128 03129 /** 03130 * \brief Sets the value of an INT1 field. 03131 * \ingroup container 03132 * 03133 * The target field needs to be of type RFCTYPE_INT1. 03134 * 03135 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03136 * is a table handle, the function will read the field value of the current row. 03137 * \in *name The name of the field to set. 03138 * \in value The int value to set. 03139 * \out *errorInfo Field does not exist or is not of type INT1? 03140 * \return RFC_RC 03141 */ 03142 DECL_EXP RFC_RC SAP_API RfcSetInt1(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, const RFC_INT1 value, RFC_ERROR_INFO* errorInfo); 03143 03144 /** 03145 * \brief Sets the value of an INT1 field. 03146 * \ingroup container 03147 * 03148 * This function works exactly like RfcSetInt1(), the difference being that the field is 03149 * addressed by its index within the structure/table/function module. The first field has index 0, 03150 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 03151 * 03152 * 03153 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03154 * is a table handle, the function will read the field value of the current row. 03155 * \in *index The index of the field to set. 03156 * \in value The int value to set. 03157 * \out *errorInfo Field does not exist or is not of type INT1? 03158 * \return RFC_RC 03159 */ 03160 DECL_EXP RFC_RC SAP_API RfcSetInt1ByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, const RFC_INT1 value, RFC_ERROR_INFO* errorInfo); 03161 03162 /** 03163 * \brief Sets the value of an INT2 field. 03164 * \ingroup container 03165 * 03166 * The target field needs to be of type RFCTYPE_INT2. 03167 * 03168 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03169 * is a table handle, the function will read the field value of the current row. 03170 * \in *name The name of the field to set. 03171 * \in value The int value to set. 03172 * \out *errorInfo Field does not exist or is not of type INT2? 03173 * \return RFC_RC 03174 */ 03175 DECL_EXP RFC_RC SAP_API RfcSetInt2(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, const RFC_INT2 value, RFC_ERROR_INFO* errorInfo); 03176 03177 /** 03178 * \brief Sets the value of an INT2 field. 03179 * \ingroup container 03180 * 03181 * This function works exactly like RfcSetInt2(), the difference being that the field is 03182 * addressed by its index within the structure/table/function module. The first field has index 0, 03183 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 03184 * 03185 * 03186 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03187 * is a table handle, the function will read the field value of the current row. 03188 * \in *index The index of the field to set. 03189 * \in value The int value to set. 03190 * \out *errorInfo Field does not exist or is not of type INT2? 03191 * \return RFC_RC 03192 */ 03193 DECL_EXP RFC_RC SAP_API RfcSetInt2ByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, const RFC_INT2 value, RFC_ERROR_INFO* errorInfo); 03194 03195 /** 03196 * \brief Sets a floating point field. 03197 * \ingroup container 03198 * 03199 * The field specified by name needs to be of one of the following data types: 03200 * - RFCTYPE_FLOAT 03201 * - RFCTYPE_BCD 03202 * - RFCTYPE_CHAR 03203 * - RFCTYPE_STRING 03204 * - RFCTYPE_NUM 03205 * - RFCTYPE_DECF16 03206 * - RFCTYPE_DECF34 03207 * \note If the target field is CHAR or STRING, the value will be converted to a string in 03208 * scientific notation. If it is NUMC, it will be truncated to the next integer. 03209 * 03210 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03211 * is a table handle, the function will read the field value of the current row. 03212 * \in *name The name of the field to set. 03213 * \in value The double value to set. 03214 * \out *errorInfo Field does not exist or is not of a supported type? 03215 * \return RFC_RC 03216 */ 03217 DECL_EXP RFC_RC SAP_API RfcSetFloat(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, const RFC_FLOAT value, RFC_ERROR_INFO* errorInfo); 03218 03219 /** 03220 * \brief Sets a floating point field. 03221 * \ingroup container 03222 * 03223 * This function works exactly like RfcSetFloat(), the difference being that the field is 03224 * addressed by its index within the structure/table/function module. The first field has index 0, 03225 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 03226 * 03227 * 03228 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03229 * is a table handle, the function will read the field value of the current row. 03230 * \in *index The index of the field to set. 03231 * \in value The double value to set. 03232 * \out *errorInfo Field does not exist or is not of a supported type? 03233 * \return RFC_RC 03234 */ 03235 DECL_EXP RFC_RC SAP_API RfcSetFloatByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, const RFC_FLOAT value, RFC_ERROR_INFO* errorInfo); 03236 03237 03238 /** 03239 * \brief Sets the value of an 8 byte decfloat object into a field. 03240 * \ingroup container 03241 * 03242 * The field specified by name needs to be of one of the following data types: 03243 * - RFCTYPE_DECF16 03244 * - RFCTYPE_DECF34 03245 * - RFCTYPE_FLOAT 03246 * - RFCTYPE_BCD 03247 * - RFCTYPE_INT 03248 * - RFCTYPE_INT2 03249 * - RFCTYPE_INT1 03250 * - RFCTYPE_CHAR 03251 * - RFCTYPE_NUM 03252 * - RFCTYPE_STRING 03253 * - RFCTYPE_BYTE Needs to be 8 byte long. 03254 * - RFCTYPE_XSTRING 03255 * \note If the target field is CHAR or STRING, the value will be converted to a string in 03256 * scientific notation. If it is NUMC, it will be truncated to the next integer. 03257 * 03258 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03259 * is a table handle, the function will read the field value of the current row. 03260 * \in *name The name of the field to set. 03261 * \in value The decfloat value to set. 03262 * \out *errorInfo Field does not exist or is not of a supported type? 03263 * \return RFC_RC 03264 */ 03265 DECL_EXP RFC_RC SAP_API RfcSetDecF16(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, const RFC_DECF16 value, RFC_ERROR_INFO* errorInfo); 03266 03267 /** 03268 * \brief Sets the value of an 8 byte decfloat object into a field. 03269 * \ingroup container 03270 * 03271 * This function works exactly like RfcSetDecF16(), the difference being that the field is 03272 * addressed by its index within the structure/table/function module. The first field has index 0, 03273 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 03274 * 03275 * 03276 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03277 * is a table handle, the function will read the field value of the current row. 03278 * \in *index The index of the field to set. 03279 * \in value The decfloat value to set. 03280 * \out *errorInfo Field does not exist or is not of a supported type? 03281 * \return RFC_RC 03282 */ 03283 DECL_EXP RFC_RC SAP_API RfcSetDecF16ByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, const RFC_DECF16 value, RFC_ERROR_INFO* errorInfo); 03284 03285 03286 /** 03287 * \brief Sets the value of a 16 byte decfloat object into a field. 03288 * \ingroup container 03289 * 03290 * The field specified by name needs to be of one of the following data types: 03291 * - RFCTYPE_DECF16 03292 * - RFCTYPE_DECF34 03293 * - RFCTYPE_FLOAT 03294 * - RFCTYPE_BCD 03295 * - RFCTYPE_INT 03296 * - RFCTYPE_INT2 03297 * - RFCTYPE_INT1 03298 * - RFCTYPE_CHAR 03299 * - RFCTYPE_NUM 03300 * - RFCTYPE_STRING 03301 * - RFCTYPE_BYTE Needs to be 8 byte long. 03302 * - RFCTYPE_XSTRING 03303 * \note If the target field is CHAR or STRING, the value will be converted to a string in 03304 * scientific notation. If it is NUMC, it will be truncated to the next integer. 03305 * 03306 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03307 * is a table handle, the function will read the field value of the current row. 03308 * \in *name The name of the field to set. 03309 * \in value The decfloat value to set. 03310 * \out *errorInfo Field does not exist or is not of a supported type? 03311 * \return RFC_RC 03312 */ 03313 DECL_EXP RFC_RC SAP_API RfcSetDecF34(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, const RFC_DECF34 value, RFC_ERROR_INFO* errorInfo); 03314 03315 /** 03316 * \brief Sets the value of a 16 byte decfloat object into a field. 03317 * \ingroup container 03318 * 03319 * This function works exactly like RfcSetDecF34(), the difference being that the field is 03320 * addressed by its index within the structure/table/function module. The first field has index 0, 03321 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 03322 * 03323 * 03324 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03325 * is a table handle, the function will read the field value of the current row. 03326 * \in *index The index of the field to set. 03327 * \in value The decfloat value to set. 03328 * \out *errorInfo Field does not exist or is not of a supported type? 03329 * \return RFC_RC 03330 */ 03331 DECL_EXP RFC_RC SAP_API RfcSetDecF34ByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, const RFC_DECF34 value, RFC_ERROR_INFO* errorInfo); 03332 03333 03334 /** 03335 * \brief Copies the given structure into the target structure of the parent container. 03336 * \ingroup container 03337 * 03338 * The target field needs to be of type RFCTYPE_STRUCTURE. 03339 * 03340 * \note If you want to avoid the copy operation, use RfcGetStructure() and set the subfields here, 03341 * instead of the sequence RfcCreateStructure()/ setting the subfields/ #RfcSetStructure(). 03342 * 03343 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03344 * is a table handle, the function will read the field value of the current row. 03345 * \in *name The name of the field to set. 03346 * \in value The structure to copy. 03347 * \out *errorInfo Out of memory, field does not exist or is not of type RFCTYPE_STRUCTURE? 03348 * \return RFC_RC 03349 */ 03350 DECL_EXP RFC_RC SAP_API RfcSetStructure(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, const RFC_STRUCTURE_HANDLE value, RFC_ERROR_INFO* errorInfo); 03351 03352 /** 03353 * \brief Copies the given structure into the target structure of the parent container. 03354 * \ingroup container 03355 * 03356 * This function works exactly like RfcSetStructure(), the difference being that the field is 03357 * addressed by its index within the structure/table/function module. The first field has index 0, 03358 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 03359 * 03360 * 03361 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03362 * is a table handle, the function will read the field value of the current row. 03363 * \in *index The index of the field to set. 03364 * \in value The structure to copy. 03365 * \out *errorInfo Out of memory, field does not exist or is not of type RFCTYPE_STRUCTURE? 03366 * \return RFC_RC 03367 */ 03368 DECL_EXP RFC_RC SAP_API RfcSetStructureByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, const RFC_STRUCTURE_HANDLE value, RFC_ERROR_INFO* errorInfo); 03369 03370 /** 03371 * \brief Copies the given table into the target table of the parent container. 03372 * \ingroup container 03373 * 03374 * The target field needs to be of type RFCTYPE_TABLE. 03375 * 03376 * \note If you want to avoid the copy operation, use RfcGetTable() and set the subfields here, 03377 * instead of the sequence RfcCreateTable()/ setting the subfields/ #RfcSetTable(). 03378 * 03379 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03380 * is a table handle, the function will read the field value of the current row. 03381 * \in *name The name of the field to set. 03382 * \in value The table to copy. 03383 * \out *errorInfo Field does not exist or is not of type RFCTYPE_TABLE? 03384 * \return RFC_RC 03385 */ 03386 DECL_EXP RFC_RC SAP_API RfcSetTable(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, const RFC_TABLE_HANDLE value, RFC_ERROR_INFO* errorInfo); 03387 03388 /** 03389 * \brief Copies the given table into the target table of the parent container. 03390 * \ingroup container 03391 * 03392 * This function works exactly like RfcSetTable(), the difference being that the field is 03393 * addressed by its index within the structure/table/function module. The first field has index 0, 03394 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 03395 * 03396 * 03397 * \in dataHandle A data container (function handle, structure handle or table handle). If dataHandle 03398 * is a table handle, the function will read the field value of the current row. 03399 * \in *index The index of the field to set. 03400 * \in value The table to copy. 03401 * \out *errorInfo Field does not exist or is not of type RFCTYPE_TABLE? 03402 * \return RFC_RC 03403 */ 03404 DECL_EXP RFC_RC SAP_API RfcSetTableByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, const RFC_TABLE_HANDLE value, RFC_ERROR_INFO* errorInfo); 03405 03406 /** 03407 * \brief Copies the object into the target object of the parent container. 03408 * \ingroup container 03409 * 03410 * The target field needs to be of type RFCTYPE_ABAPOBJECT. 03411 * 03412 * \note If you want to avoid the copy operation, use RfcGetAbapObject() and if the instance already exists set the subfields here, 03413 * instead of the sequence RfcCreateAbapObject()/ setting the subfields/ #RfcSetAbapObject(). 03414 * 03415 * \in dataHandle A data container (function handle, structure handle, table handle or object handle). If dataHandle 03416 * is a table handle, the function will read the field value of the current row. 03417 * \in *name The name of the field to set. 03418 * \in value The object to copy. 03419 * \out *errorInfo Field does not exist or is not of type RFCTYPE_ABAPOBJECT? 03420 * \return RFC_RC 03421 */ 03422 DECL_EXP RFC_RC SAP_API RfcSetAbapObject(DATA_CONTAINER_HANDLE dataHandle, SAP_UC const* name, const RFC_ABAP_OBJECT_HANDLE value, RFC_ERROR_INFO* errorInfo); 03423 03424 /** 03425 * \brief Copies the object into the target object of the parent container. 03426 * \ingroup container 03427 * 03428 * This function works exactly like RfcSetAbapObject(), the difference being that the field is 03429 * addressed by its index within the structure/table/function module. The first field has index 0, 03430 * last field has index n-1, the order of the fields is as defined in the ABAP DDIC. 03431 * 03432 * 03433 * \in dataHandle A data container (function handle, structure handle, table handle or object handle). If dataHandle 03434 * is a table handle, the function will read the field value of the current row. 03435 * \in *index The index of the field to set. 03436 * \in value The object to copy. 03437 * \out *errorInfo Field does not exist or is not of type RFCTYPE_ABAPOBJECT? 03438 * \return RFC_RC 03439 */ 03440 DECL_EXP RFC_RC SAP_API RfcSetAbapObjectByIndex(DATA_CONTAINER_HANDLE dataHandle, unsigned index, const RFC_ABAP_OBJECT_HANDLE value, RFC_ERROR_INFO* errorInfo); 03441 03442 03443 /** 03444 * \brief Gets the ABAP exception object handle from the given function handle. 03445 * \ingroup container 03446 * 03447 * If a call to #RfcInvoke() returned RFC_ABAP_CLASS_EXCEPTION, the RFC client calls this function afterwards with the original function handle 03448 * in order to get access to the details of the class exception. 03449 * \in funcHandle Function module data container. 03450 * \out *errorInfo Should always return successfully. 03451 * \return A handle to an ABAP class exception object . 03452 */ 03453 DECL_EXP RFC_ABAP_OBJECT_HANDLE SAP_API RfcGetAbapClassException(RFC_FUNCTION_HANDLE funcHandle, RFC_ERROR_INFO* errorInfo); 03454 03455 /** 03456 * \brief Sets the ABAP exception object handle to the given function handle. 03457 * \ingroup container 03458 * 03459 * If an RFC server function wants to throw an ABAP class exception, it calls this function before it returns with RFC_ABAP_CLASS_EXCEPTION. 03460 * \in funcHandle Function module data container . 03461 * \in excpHandle Object handle to the class exception to be thrown. 03462 * \in exceptionText Exception text. 03463 * \out *errorInfo Should always return successfully. 03464 * \return RFC_RC 03465 */ 03466 DECL_EXP RFC_RC SAP_API RfcSetAbapClassException(RFC_FUNCTION_HANDLE funcHandle, RFC_ABAP_OBJECT_HANDLE excpHandle, const SAP_UC *exceptionText, RFC_ERROR_INFO* errorInfo); 03467 03468 /** 03469 * \brief Returns the metadata description for the given function module. 03470 * \ingroup container 03471 * 03472 * 03473 * \in funcHandle A function module. 03474 * \out *errorInfo Can't possibly go wrong... 03475 * \return The metadata description that had been used when creating the function module container. 03476 */ 03477 DECL_EXP RFC_FUNCTION_DESC_HANDLE SAP_API RfcDescribeFunction(RFC_FUNCTION_HANDLE funcHandle, RFC_ERROR_INFO* errorInfo); 03478 03479 /** 03480 * \brief Returns the metadata description of the given structure or table (RFC_STRUCTURE_HANDLE or RFC_TABLE_HANDLE). 03481 * \ingroup container 03482 * 03483 * 03484 * \in dataHandle A structure or table. 03485 * \out *errorInfo Can't possibly go wrong... 03486 * \return The type description of the given structure (in case dataHandle is a structure), or the 03487 * type description of the table line type (in case dataHandle is a table). 03488 */ 03489 DECL_EXP RFC_TYPE_DESC_HANDLE SAP_API RfcDescribeType(DATA_CONTAINER_HANDLE dataHandle, RFC_ERROR_INFO* errorInfo); 03490 03491 03492 /* ************************************************************************/ 03493 /* */ 03494 /* Metadata and Repository API */ 03495 /* */ 03496 /* ************************************************************************/ 03497 03498 /* 1. Repository API */ 03499 03500 /** 03501 * \brief Returns the function description that is valid for the system to which rfcHandle points to. 03502 * \ingroup repository 03503 * 03504 * If the function description is already in the repository cache for that system ID, it will be 03505 * returned immediately (from the cache), otherwise it will be looked up in the system's DDIC using 03506 * the rfcHandle. The result from the DDIC lookup will then be placed into the cache for later use. 03507 * 03508 * The RFC Runtime maintains a cache for every R/3 System ID, as the meta data could be different 03509 * from R/3 release to R/3 release. 03510 * This is the main API that should be used. 03511 * 03512 * \in rfcHandle Open client connection to the R/3 System, for which you need the function module description. 03513 * \in *funcName Name of the function module to look up. 03514 * \out *errorInfo More error details in case something goes wrong. 03515 * \return The metadata description of the given function module. 03516 */ 03517 DECL_EXP RFC_FUNCTION_DESC_HANDLE SAP_API RfcGetFunctionDesc(RFC_CONNECTION_HANDLE rfcHandle, SAP_UC const * funcName, RFC_ERROR_INFO* errorInfo); 03518 03519 /** 03520 * \brief Looks for a cached function description. 03521 * \ingroup repository 03522 * 03523 * This API should be used with care and is only for special scenarios, for example: 03524 * 1. You know for sure, that a function description has already been cached via RfcGetFunctionDesc(), 03525 * and don't want to open an extra rfcHandle that will never be used. 03526 * In this case simply use the SAP System ID as the repositoryID. 03527 * 2. You have created a hard-coded repository via RfcAddFunctionDesc(), which contains function modules 03528 * that do not exist in the backend's DDIC. 03529 * 03530 * If repositoryID is NULL, the "default repository" is used. 03531 * 03532 * \in *repositoryID System ID of R/3 System, for which this function module description has been cached, 03533 * or NULL in case you want to look for it in the default repository. 03534 * \in *funcName Name of the function module. 03535 * \out *errorInfo Requested function name not in cache? 03536 * \return The requested function description. 03537 */ 03538 DECL_EXP RFC_FUNCTION_DESC_HANDLE SAP_API RfcGetCachedFunctionDesc(SAP_UC const * repositoryID, SAP_UC const * funcName, RFC_ERROR_INFO* errorInfo); 03539 03540 /** 03541 * \brief Adds a function description to the cache for the specified R/3 System. 03542 * \ingroup repository 03543 * 03544 * This API should be used with care and is only for special scenarios, e.g. if you want to 03545 * write an RFC server that offers function modules, which do not exist in the R/3 system's DDIC. 03546 * If repositoryID is NULL, the description is added to the "default repository". 03547 * 03548 * 03549 * \in *repositoryID System ID of R/3 System, to whose cache you want to add the function description, 03550 * or NULL for the default repository. 03551 * \in funcDesc The function description. 03552 * \out *errorInfo Not much that can go wrong here. 03553 * \return RFC_RC 03554 */ 03555 DECL_EXP RFC_RC SAP_API RfcAddFunctionDesc(SAP_UC const * repositoryID, RFC_FUNCTION_DESC_HANDLE funcDesc, RFC_ERROR_INFO* errorInfo); 03556 03557 /** 03558 * \brief Removes a function description from the cache for the specified R/3 System. 03559 * \ingroup repository 03560 * 03561 * This API can be used, e.g. if the signature (imports, exports, etc.) of a function module has 03562 * been changed in the backend, while the external RFC program is still running. If the RFC library 03563 * continues using the old cached metadata description, garbage values (if fields have been deleted 03564 * from the function module) or missing values (if new fields have been added to the function module) 03565 * will result. 03566 * If repositoryID is NULL, the description is removed from the "default repository". 03567 * 03568 * 03569 * \in *repositoryID System ID of R/3 System, to whose cache you want to add the function description, 03570 * or NULL for the default repository. 03571 * \in *functionName The name of the function module, whose description is to be removed from the cache. 03572 * \out *errorInfo Not much that can go wrong here. 03573 * \return RFC_RC 03574 */ 03575 DECL_EXP RFC_RC SAP_API RfcRemoveFunctionDesc(SAP_UC const * repositoryID, SAP_UC const * functionName, RFC_ERROR_INFO* errorInfo); 03576 03577 /** 03578 * \brief Returns the structure description that is valid for the system to which rfcHandle points to. 03579 * \ingroup repository 03580 * 03581 * If the structure description is already in the repository cache for that system ID, it will be 03582 * returned immediately (from the cache), otherwise it will be looked up in the system's DDIC using 03583 * the rfcHandle. The result from the DDIC lookup will then be placed into the cache for later use. 03584 * 03585 * The RFC Runtime maintains a cache for every R/3 System ID, as the meta data could be different 03586 * from R/3 release to R/3 release. 03587 * \note Normally it should not be necessary to lookup separate structure descriptions. They are 03588 * already looked up as part of the function module, in which they are used. 03589 * 03590 * \in rfcHandle Open client connection to the R/3 System, for which you need the structure description. 03591 * \in *typeName Name of a DDIC structure or table. 03592 * \out *errorInfo More error details in case something goes wrong. 03593 * \return The metadata description of the given structure/table. 03594 */ 03595 DECL_EXP RFC_TYPE_DESC_HANDLE SAP_API RfcGetTypeDesc(RFC_CONNECTION_HANDLE rfcHandle, SAP_UC const * typeName, RFC_ERROR_INFO* errorInfo); 03596 03597 /** 03598 * \brief Looks for a cached structure/table description. 03599 * \ingroup repository 03600 * 03601 * Similar to RfcGetTypeDesc(), but it only looks into the cache. Again it should almost never 03602 * be necessary to get a metadata description of a single structure. 03603 * 03604 * \in *repositoryID System ID of R/3 System, for which this type description has been cached, 03605 * or NULL in case you want to look for it in the default repository. 03606 * \in *typeName Name of the DDIC structure/table. 03607 * \out *errorInfo Requested type name not in cache? 03608 * \return The requested type description. 03609 */ 03610 DECL_EXP RFC_TYPE_DESC_HANDLE SAP_API RfcGetCachedTypeDesc(SAP_UC const * repositoryID, SAP_UC const * typeName, RFC_ERROR_INFO* errorInfo); 03611 03612 /** 03613 * \brief Adds a type description to the cache. 03614 * \ingroup repository 03615 * 03616 * 03617 * \in *repositoryID System ID of R/3 System, to whose cache you want to add the type description, 03618 * or NULL for the default repository. 03619 * \in typeHandle The type description. 03620 * \out *errorInfo Not much that can go wrong here. 03621 * \return RFC_RC 03622 */ 03623 DECL_EXP RFC_RC SAP_API RfcAddTypeDesc(SAP_UC const * repositoryID, RFC_TYPE_DESC_HANDLE typeHandle, RFC_ERROR_INFO* errorInfo); 03624 03625 /** 03626 * \brief Removes a type description from the cache. 03627 * \ingroup repository 03628 * 03629 * 03630 * \in *repositoryID System ID of R/3 System, from whose cache you want to remove the type description, 03631 * or NULL for the default repository. 03632 * \in *typeName The name of the type, whose description is to be removed from the cache. 03633 * \out *errorInfo Not much that can go wrong here. 03634 * \return RFC_RC 03635 */ 03636 DECL_EXP RFC_RC SAP_API RfcRemoveTypeDesc(SAP_UC const * repositoryID, SAP_UC const * typeName, RFC_ERROR_INFO* errorInfo); 03637 03638 /** 03639 * \brief Returns the class description that is valid for the system to which rfcHandle points to. 03640 * \ingroup repository 03641 * 03642 * If the class description is already in the repository cache for that system ID, it will be 03643 * returned immediately (from the cache), otherwise it will be looked up in the system's DDIC using 03644 * the rfcHandle. The result from the DDIC lookup will then be placed into the cache for later use. 03645 * 03646 * The RFC Runtime maintains a cache for every R/3 System ID, as the meta data could be different 03647 * from R/3 release to R/3 release. 03648 * This is the main API that should be used. 03649 * 03650 * \in rfcHandle Open client connection to the R/3 System, for which you need the class description. 03651 * \in *className Name of the class to look up. 03652 * \out *errorInfo More error details in case something goes wrong. 03653 * \return The metadata description of the given function module. 03654 */ 03655 DECL_EXP RFC_CLASS_DESC_HANDLE SAP_API RfcGetClassDesc(RFC_CONNECTION_HANDLE rfcHandle, SAP_UC const * className, RFC_ERROR_INFO* errorInfo); 03656 03657 /** 03658 * \brief Looks for a cached class description. 03659 * \ingroup repository 03660 * 03661 * This API should be used with care and is only for special scenarios, for example: 03662 * 1. You know for sure, that a class description has already been cached via RfcGetClassDesc(), 03663 * and don't want to open an extra rfcHandle that will never be used. 03664 * In this case simply use the SAP System ID as the repositoryID. 03665 * 2. You have created a hard-coded repository via RfcAddClassDesc(), which contains classes 03666 * that do not exist in the backend's DDIC. 03667 * 03668 * If repositoryID is NULL, the "default repository" is used. 03669 * 03670 * \in *repositoryID System ID of R/3 System, for which this class description has been cached, 03671 * or NULL in case you want to look for it in the default repository. 03672 * \in *className Name of the class. 03673 * \out *errorInfo Requested class name not in cache? 03674 * \return The requested class description. 03675 */ 03676 DECL_EXP RFC_CLASS_DESC_HANDLE SAP_API RfcGetCachedClassDesc(SAP_UC const * repositoryID, SAP_UC const * className, RFC_ERROR_INFO* errorInfo); 03677 03678 /** 03679 * \brief Returns the metadata description of the given ABAP object handle. 03680 * \ingroup container 03681 * 03682 * 03683 * \in objectHandle An ABAP object. 03684 * \out *errorInfo Can't possibly go wrong... 03685 * \return The class description of the given ABAP object. 03686 */ 03687 DECL_EXP RFC_CLASS_DESC_HANDLE SAP_API RfcDescribeAbapObject(RFC_ABAP_OBJECT_HANDLE objectHandle, RFC_ERROR_INFO* errorInfo); 03688 03689 /** 03690 * \brief Adds a class description to the cache for the specified R/3 System. 03691 * \ingroup repository 03692 * 03693 * This API should be used with care and is only for special scenarios, e.g. if you want to 03694 * write an RFC server that offers/uses classes, which do not exist in the R/3 system's DDIC. 03695 * If repositoryID is NULL, the description is added to the "default repository". 03696 * 03697 * 03698 * \in *repositoryID System ID of R/3 System, to whose cache you want to add the class description, 03699 * or NULL for the default repository. 03700 * \in classDesc The class description. 03701 * \out *errorInfo Not much that can go wrong here. 03702 * \return RFC_RC 03703 */ 03704 DECL_EXP RFC_RC SAP_API RfcAddClassDesc(SAP_UC const * repositoryID, RFC_CLASS_DESC_HANDLE classDesc, RFC_ERROR_INFO* errorInfo); 03705 03706 /** 03707 * \brief Removes a class description from the cache for the specified R/3 System. 03708 * \ingroup repository 03709 * 03710 * If repositoryID is NULL, the description is added to the "default repository". 03711 * 03712 * 03713 * \in *repositoryID System ID of R/3 System, from whose cache you want to remove the class description, 03714 * or NULL for the default repository. 03715 * \in *className The name of the ABAP class, whose description you want to remove. 03716 * \out *errorInfo Not much that can go wrong here. 03717 * \return RFC_RC 03718 */ 03719 DECL_EXP RFC_RC SAP_API RfcRemoveClassDesc(SAP_UC const * repositoryID, SAP_UC const * className, RFC_ERROR_INFO* errorInfo); 03720 03721 03722 /* 2. Metadata API */ 03723 /* 2.1. Metadata API for structure descriptions */ 03724 03725 /** 03726 * \brief Creates an empty type description with the given name. 03727 * \ingroup structure 03728 * 03729 * API for creating hard-coded metadata descriptions, e.g. for function modules that 03730 * don't exist in the R/3 backend. 03731 * Add field descriptions to the type description using RfcAddTypeField() and at the end 03732 * set the total byte length of the structure using RfcSetTypeLength(). 03733 * \warning It is not easy to get the total length right, as you also need to take 03734 * alignment bytes into account... 03735 * 03736 * Finished type definitions can then be used for creating data containers (RfcCreateStructure() 03737 * or RfcCreateTable()) and for adding field/table descriptions to a function module description 03738 * (in RFC_PARAMETER_DESCs in RfcAddParameter()). 03739 * 03740 * After the handle was used for creating a container, any modifications are forbidden. 03741 * 03742 * \in *name An (arbitrary) name for the type. 03743 * \out *errorInfo Not enough memory? 03744 * \return The new type description. 03745 */ 03746 DECL_EXP RFC_TYPE_DESC_HANDLE SAP_API RfcCreateTypeDesc(SAP_UC const* name, RFC_ERROR_INFO* errorInfo); 03747 03748 /** 03749 * \brief Adds a new field to the type description. 03750 * \ingroup structure 03751 * 03752 * \note After a type description has been used (e.g. via RfcCreateStructure(), RfcCreateTable() or 03753 * RfcAddTypeDesc()), it can no longer be modified! 03754 * 03755 * \in typeHandle 03756 * \in *fieldDescr 03757 * \out *errorInfo 03758 * \return RFC_RC 03759 */ 03760 DECL_EXP RFC_RC SAP_API RfcAddTypeField(RFC_TYPE_DESC_HANDLE typeHandle, const RFC_FIELD_DESC* fieldDescr, RFC_ERROR_INFO* errorInfo); 03761 03762 /** 03763 * \brief Sets the total byte length of the type description. 03764 * \ingroup structure 03765 * 03766 * Before a type description can be used, this function needs to be called. 03767 * The RFC library does not automatically calculate the correct length based on 03768 * the fields that have been added, because this task is non-trivial and possibly 03769 * platform dependend. (Especially if the structure contains sub-structures.)\n 03770 * For integer and floating point types the correct alignments need to be taken into 03771 * account (start address divisible by 4 or 8), fixed sub-structures are inlined, 03772 * complex structures are referenced by an 8-byte pointer, etc. In general you will need 03773 * to do a bit of trial and error, before you get it right.\n 03774 * If you really need more details/tips for the process of hardcoding metadata, see 03775 * this <A HREF="https://scn.sap.com/docs/DOC-52888"> 03776 * article</A>. 03777 * 03778 * \in typeHandle The type description. 03779 * \in nucByteLength Total byte length of the structure in a non-Unicode system (1 byte per CHAR). 03780 * \in ucByteLength Total byte length of the structure in a Unicode system (2 bytes per CHAR). 03781 * \out *errorInfo The function returns an error, if the given byte lengths are smaller than 03782 * the sum of all field lengths, or if the nucByteLength is smaller than the ucByteLength. 03783 * \return RFC_RC 03784 */ 03785 DECL_EXP RFC_RC SAP_API RfcSetTypeLength(RFC_TYPE_DESC_HANDLE typeHandle, unsigned nucByteLength, unsigned ucByteLength, RFC_ERROR_INFO* errorInfo); 03786 03787 /** 03788 * \brief Returns the name of the type. 03789 * \ingroup structure 03790 * 03791 * 03792 * \in typeHandle The type description. 03793 * \out bufferForName Will receive the null-terminated DDIC name of the structure definition. 03794 * \out *errorInfo Should always return successfully... 03795 * \return RFC_RC 03796 */ 03797 DECL_EXP RFC_RC SAP_API RfcGetTypeName(RFC_TYPE_DESC_HANDLE typeHandle, RFC_ABAP_NAME bufferForName, RFC_ERROR_INFO* errorInfo); 03798 03799 /** 03800 * \brief Returns the number of fields in a structure definition. 03801 * \ingroup structure 03802 * 03803 * 03804 * \in typeHandle The type description. 03805 * \out *count The number of (direct) fields of this structure. 03806 * \out *errorInfo Should always return successfully... 03807 * \return RFC_RC 03808 */ 03809 DECL_EXP RFC_RC SAP_API RfcGetFieldCount(RFC_TYPE_DESC_HANDLE typeHandle, unsigned* count, RFC_ERROR_INFO* errorInfo); 03810 03811 /** 03812 * \brief Reads the field description of the structure's ith field. 03813 * \ingroup structure 03814 * 03815 * Useful mostly when looping over the fields of a structure. 03816 * 03817 * \in typeHandle The type description. 03818 * \in index The index of the field you are interested in. 03819 * \out *fieldDescr Will be filled with field's description. 03820 * \out *errorInfo Index out of bounds? 03821 * \return RFC_RC 03822 */ 03823 DECL_EXP RFC_RC SAP_API RfcGetFieldDescByIndex(RFC_TYPE_DESC_HANDLE typeHandle, unsigned index, RFC_FIELD_DESC* fieldDescr, RFC_ERROR_INFO* errorInfo); 03824 03825 /** 03826 * \brief Reads the field description of a field given by name. 03827 * \ingroup structure 03828 * 03829 * 03830 * \in typeHandle The type description. 03831 * \in *name The name of the field of interest. 03832 * \out *fieldDescr Will be filled with field's description. 03833 * \out *errorInfo No such field? 03834 * \return RFC_RC 03835 */ 03836 DECL_EXP RFC_RC SAP_API RfcGetFieldDescByName(RFC_TYPE_DESC_HANDLE typeHandle, SAP_UC const* name, RFC_FIELD_DESC* fieldDescr, RFC_ERROR_INFO* errorInfo); 03837 03838 /** 03839 * \brief Returns the total byte length of a structure definition. 03840 * \ingroup structure 03841 * 03842 * 03843 * \in typeHandle The type description. 03844 * \out nucByteLength Total byte length in a non-Unicode system. 03845 * \out ucByteLength Total byte length in a Unicode system. 03846 * \out *errorInfo Should always return successfully. 03847 * \return RFC_RC 03848 */ 03849 DECL_EXP RFC_RC SAP_API RfcGetTypeLength(RFC_TYPE_DESC_HANDLE typeHandle, unsigned* nucByteLength, unsigned* ucByteLength, RFC_ERROR_INFO* errorInfo); 03850 03851 /** 03852 * \brief Deletes the type description and releases the allocated resources. 03853 * \ingroup structure 03854 * 03855 * Only descriptions, which are not stored in a repository cache and not used by the application, can be deleted. 03856 * Deleting a cached description will cause an error, and deleting a description that is still in use, will lead 03857 * to a crash. 03858 * 03859 * 03860 * \inout typeHandle The type description to be deleted. 03861 * \out *errorInfo 03862 * \return 03863 */ 03864 DECL_EXP RFC_RC SAP_API RfcDestroyTypeDesc(RFC_TYPE_DESC_HANDLE typeHandle, RFC_ERROR_INFO *errorInfo); 03865 03866 03867 03868 /* 2.2. Metadata API for function modules */ 03869 03870 /** 03871 * \brief Creates an empty function description with the given name. 03872 * \ingroup function 03873 * 03874 * Add parameter descriptions and exception descriptions to the new RFC_FUNCTION_DESC_HANDLE 03875 * via RfcAddParameter() and RfcAddException().\n 03876 * 03877 * After the handle was used for creating a container, any modifications are forbidden. 03878 * 03879 * \in *name The name of the function module. 03880 * \out *errorInfo Probably not enough memory left?! 03881 * \return An empty function description that can be used for constructing hard-coded metadata. 03882 */ 03883 DECL_EXP RFC_FUNCTION_DESC_HANDLE SAP_API RfcCreateFunctionDesc(SAP_UC const* name, RFC_ERROR_INFO* errorInfo); 03884 03885 /** 03886 * \brief Returns a function module's DDIC name. 03887 * \ingroup function 03888 * 03889 * 03890 * \in funcDesc The function module description. 03891 * \out bufferForName Will receive the function module's DDIC name. 03892 * \out *errorInfo Should always return successfully. 03893 * \return RFC_RC 03894 */ 03895 DECL_EXP RFC_RC SAP_API RfcGetFunctionName(RFC_FUNCTION_DESC_HANDLE funcDesc, RFC_ABAP_NAME bufferForName, RFC_ERROR_INFO* errorInfo); 03896 03897 /** 03898 * \brief Adds a new parameter (IMPORTING, EXPORTING, CHANGING, TABLES) to the function description. 03899 * \ingroup function 03900 * 03901 * \note After the function description has been used via RfcCreateFunction() or RfcAddFunctionDesc(), 03902 * it can no longer be modified! 03903 * 03904 * \in funcDesc The function module description. 03905 * \in *paramDescr Metadata description of the new parameter. 03906 * \out *errorInfo More details in case something goes wrong. 03907 * \return RFC_RC 03908 */ 03909 DECL_EXP RFC_RC SAP_API RfcAddParameter(RFC_FUNCTION_DESC_HANDLE funcDesc, const RFC_PARAMETER_DESC* paramDescr, RFC_ERROR_INFO* errorInfo); 03910 03911 /** 03912 * \brief Returns the number of parameters in the function module definition. 03913 * \ingroup function 03914 * 03915 * 03916 * \in funcDesc The function module's metadata description. 03917 * \out *count The number of parameters (IMPORTING, EXPORTING, CHANGING, TABLES). 03918 * \out *errorInfo Nothing can go wrong here. 03919 * \return RFC_RC 03920 */ 03921 DECL_EXP RFC_RC SAP_API RfcGetParameterCount(RFC_FUNCTION_DESC_HANDLE funcDesc, unsigned* count, RFC_ERROR_INFO* errorInfo); 03922 03923 /** 03924 * \brief Reads the metadata description of the function module's ith parameter. 03925 * \ingroup function 03926 * 03927 * \note Mostly be useful when looping over all parameters of a function module. 03928 * 03929 * \in funcDesc The function module's metadata description. 03930 * \in index The index of the parameter to describe. 03931 * \out *paramDesc Metadata description of the specified parameter. 03932 * \out *errorInfo Index out of bounds? 03933 * \return RFC_RC 03934 */ 03935 DECL_EXP RFC_RC SAP_API RfcGetParameterDescByIndex(RFC_FUNCTION_DESC_HANDLE funcDesc, unsigned index, RFC_PARAMETER_DESC* paramDesc, RFC_ERROR_INFO* errorInfo); 03936 03937 /** 03938 * \brief Reads the metadata description of a function module parameter given by name. 03939 * \ingroup function 03940 * 03941 * 03942 * \in funcDesc The function module's metadata description. 03943 * \in *name The name of the parameter to describe. 03944 * \out *paramDesc Metadata description of the specified parameter. 03945 * \out *errorInfo No such parameter? 03946 * \return RFC_RC 03947 */ 03948 DECL_EXP RFC_RC SAP_API RfcGetParameterDescByName(RFC_FUNCTION_DESC_HANDLE funcDesc, SAP_UC const* name, RFC_PARAMETER_DESC* paramDesc, RFC_ERROR_INFO* errorInfo); 03949 03950 /** 03951 * \brief Adds a new ABAP Exception to the function description. 03952 * \ingroup function 03953 * 03954 * \note After the function description has been used via RfcCreateFunction() or RfcAddFunctionDesc(), 03955 * it can no longer be modified! 03956 * 03957 * 03958 * \in funcDesc The function module's metadata description. 03959 * \in *excDesc The description of the exception to add. 03960 * \out *errorInfo Not much that can go wrong here. 03961 * \return RFC_RC 03962 */ 03963 DECL_EXP RFC_RC SAP_API RfcAddException(RFC_FUNCTION_DESC_HANDLE funcDesc, const RFC_EXCEPTION_DESC* excDesc, RFC_ERROR_INFO* errorInfo); 03964 03965 /** 03966 * \brief Returns the number of ABAP Exceptions of the function module. 03967 * \ingroup function 03968 * 03969 * 03970 * \in funcDesc The function module's metadata description. 03971 * \out *count The number of the function module's ABAP Exceptions. 03972 * \out *errorInfo Not much that can go wrong here. 03973 * \return RFC_RC 03974 */ 03975 DECL_EXP RFC_RC SAP_API RfcGetExceptionCount(RFC_FUNCTION_DESC_HANDLE funcDesc, unsigned* count, RFC_ERROR_INFO* errorInfo); 03976 03977 /** 03978 * \brief Reads the metadata description of the function module's ith ABAP Exception. 03979 * \ingroup function 03980 * 03981 * 03982 * \in funcDesc The function module's metadata description. 03983 * \in index The index of the exception to describe. 03984 * \out *excDesc The ABAP Exception's metadata description. 03985 * \out *errorInfo Index out of bounds? 03986 * \return RFC_RC 03987 */ 03988 DECL_EXP RFC_RC SAP_API RfcGetExceptionDescByIndex(RFC_FUNCTION_DESC_HANDLE funcDesc, unsigned index, RFC_EXCEPTION_DESC* excDesc, RFC_ERROR_INFO* errorInfo); 03989 03990 /** 03991 * \brief Reads the metadata description of a function module's ABAP Exception given by name. 03992 * \ingroup function 03993 * 03994 * 03995 * \in funcDesc The function module's metadata description. 03996 * \in *name The name of the exception to describe. 03997 * \out *excDesc The ABAP Exception's metadata description. 03998 * \out *errorInfo No such ABAP Exception? 03999 * \return RFC_RC 04000 */ 04001 DECL_EXP RFC_RC SAP_API RfcGetExceptionDescByName(RFC_FUNCTION_DESC_HANDLE funcDesc, SAP_UC const* name, RFC_EXCEPTION_DESC* excDesc, RFC_ERROR_INFO* errorInfo); 04002 04003 /** 04004 * \brief Enables this function module for the basXML serialization format. 04005 * \ingroup function 04006 * 04007 * R/3 Systems from kernel release 7.10 on support a new serialization format: basXML (binary ABAP serialization). 04008 * Calling #RfcEnableBASXML() allows the RFC library to transport this function module's data via the 04009 * basXML format, if the target backend supports it. 04010 * 04011 * \in funcDesc The function module's metadata description. 04012 * \out *errorInfo Should always return successfully. 04013 * \return RFC_RC 04014 */ 04015 DECL_EXP RFC_RC SAP_API RfcEnableBASXML(RFC_FUNCTION_DESC_HANDLE funcDesc, RFC_ERROR_INFO* errorInfo); 04016 04017 /** 04018 * \brief Returns whether this function module has been enabled for basXML. 04019 * \ingroup function 04020 * 04021 * See RfcEnableBASXML() 04022 * 04023 * \in funcDesc The function module's metadata description. 04024 * \out *isEnabled 0 = false, 1 = true. 04025 * \out *errorInfo Should always return successfully. 04026 * \return RFC_RC 04027 */ 04028 DECL_EXP RFC_RC SAP_API RfcIsBASXMLSupported(RFC_FUNCTION_DESC_HANDLE funcDesc, int* isEnabled, RFC_ERROR_INFO* errorInfo); 04029 04030 /** 04031 * \brief Deletes the function description and releases the allocated resources. 04032 * \ingroup function 04033 * 04034 * Only descriptions, which are not stored in a repository cache and not used by the application, can be deleted. 04035 * Deleting a cached description will cause an error, and deleting a description that is still in use, will lead 04036 * to a crash. 04037 * 04038 * 04039 * \in funcDesc A function description. 04040 * \out *errorInfo Should always return successfully... 04041 * \return RFC_RC 04042 */ 04043 DECL_EXP RFC_RC SAP_API RfcDestroyFunctionDesc(RFC_FUNCTION_DESC_HANDLE funcDesc, RFC_ERROR_INFO *errorInfo); 04044 04045 /** 04046 * \brief Enables this function handle for ABAP class exception support. 04047 * \ingroup function 04048 * 04049 * R/3 Systems from kernel release 7.11 on support ABAP class exception. 04050 * Calling #RfcEnableAbapClassException() allows the RFC call invoked over this function handle to be able to 04051 * support the ABAP class exception, if the target backend supports it. 04052 * \in funcHandle function module data container . 04053 * \in rfcHandleRepository RFC connection handle to the repository system from where the missing metadata can be 04054 * dynamically retrieved during de-serializing the received ABAP class exceptions. This handle can be NULL but should not be 04055 * the same that's used for the RFC call itself. 04056 * \out *errorInfo Should always return successfully. 04057 * \return RFC_RC 04058 */ 04059 DECL_EXP RFC_RC SAP_API RfcEnableAbapClassException(RFC_FUNCTION_HANDLE funcHandle, RFC_CONNECTION_HANDLE rfcHandleRepository, RFC_ERROR_INFO* errorInfo); 04060 04061 /** 04062 * \brief Checks whether this function handle has been enabled for ABAP class exception support. 04063 * \ingroup function 04064 * 04065 * R/3 Systems from kernel release 7.11 on support ABAP class exception. 04066 * Typically, a RFC server uses function to is called by RFC server ll invoked over this function handle to be able to 04067 * support the ABAP class exception, if the target backend supports it. 04068 * 04069 * \in funcHandle function module data container. 04070 * \out *isEnabled flag indicates whether the function handle has been enabled for ABAP class based exception support 04071 * \out *errorInfo Should always return successfully. 04072 * \return RFC_RC 04073 */ 04074 DECL_EXP RFC_RC SAP_API RfcIsAbapClassExceptionEnabled(RFC_FUNCTION_HANDLE funcHandle, int* isEnabled, RFC_ERROR_INFO* errorInfo); 04075 04076 04077 /* 2.3. Metadata API for ABAP classes */ 04078 04079 /** 04080 * \brief Creates an empty class description with the given name. 04081 * \ingroup class 04082 * 04083 * Add attribute descriptions to the new RFC_CLASS_DESC_HANDLE via RfcAddAttribute().\n 04084 * 04085 * After the handle was used for creating a container, any modifications are forbidden. 04086 * 04087 * \in *name The name of the ABAP class. 04088 * \out *errorInfo Probably not enough memory left?! 04089 * \return An empty function description that can be used for constructing hard-coded metadata. 04090 */ 04091 DECL_EXP RFC_CLASS_DESC_HANDLE SAP_API RfcCreateClassDesc(SAP_UC const* name, RFC_ERROR_INFO* errorInfo); 04092 04093 /** 04094 * \brief Returns the class's DDIC name. 04095 * \ingroup class 04096 * 04097 * 04098 * \in classDesc The class description. 04099 * \out bufferForName Will receive the function module's DDIC name (zero terminated). 04100 * \out *errorInfo Should always return successfully. 04101 * \return RFC_RC 04102 */ 04103 DECL_EXP RFC_RC SAP_API RfcGetClassName(RFC_CLASS_DESC_HANDLE classDesc, RFC_ABAP_NAME bufferForName, RFC_ERROR_INFO* errorInfo); 04104 04105 /** 04106 * \brief Adds a new attribute (field, structure, table, method) to the class description. 04107 * \ingroup class 04108 * 04109 * \note After the function description has been used via RfcCreateAbapObject() or RfcAddClassDesc(), 04110 * it can no longer be modified! 04111 * 04112 * \in classDesc The class description. 04113 * \in *attrDesc Metadata description of the new class attribute. 04114 * \out *errorInfo More details in case something goes wrong. 04115 * \return RFC_RC 04116 */ 04117 DECL_EXP RFC_RC SAP_API RfcAddClassAttribute(RFC_CLASS_DESC_HANDLE classDesc, const RFC_CLASS_ATTRIBUTE_DESC* attrDesc, RFC_ERROR_INFO* errorInfo); 04118 04119 /** 04120 * \brief Returns the number of parameters in the function module definition. 04121 * \ingroup class 04122 * 04123 * 04124 * \in classDesc The class description. 04125 * \out *count The number of attributes. 04126 * \out *errorInfo Nothing can go wrong here. 04127 * \return RFC_RC 04128 */ 04129 DECL_EXP RFC_RC SAP_API RfcGetClassAttributesCount(RFC_CLASS_DESC_HANDLE classDesc, unsigned* count, RFC_ERROR_INFO* errorInfo); 04130 04131 /** 04132 * \brief Reads the metadata description of the class attribute. 04133 * \ingroup class 04134 * 04135 * \note Is useful mostly when looping over all attributes of a class. 04136 * 04137 * \in classDesc The class metadata description. 04138 * \in index The index of the attributes to describe. 04139 * \out *attrDesc Metadata description of the class attribute. 04140 * \out *errorInfo Index out of bounds? 04141 * \return RFC_RC 04142 */ 04143 DECL_EXP RFC_RC SAP_API RfcGetClassAttributeDescByIndex(RFC_CLASS_DESC_HANDLE classDesc, unsigned index, RFC_CLASS_ATTRIBUTE_DESC* attrDesc, RFC_ERROR_INFO* errorInfo); 04144 04145 /** 04146 * \brief Reads the metadata description of a class attribute given by name. 04147 * \ingroup class 04148 * 04149 * 04150 * \in classDesc The class metadata description. 04151 * \in *name The name of the parameter to describe. 04152 * \out *attrDesc Metadata description of the class attribute. 04153 * \out *errorInfo No such parameter? 04154 * \return RFC_RC 04155 */ 04156 DECL_EXP RFC_RC SAP_API RfcGetClassAttributeDescByName(RFC_CLASS_DESC_HANDLE classDesc, SAP_UC const* name, RFC_CLASS_ATTRIBUTE_DESC* attrDesc, RFC_ERROR_INFO* errorInfo); 04157 04158 04159 /** 04160 * \brief Returns the parent classes of the given class. 04161 * \ingroup class 04162 * 04163 * \in classDesc The class metadata description. 04164 * \in name The parent class name. 04165 * \in index Index of parent class. 04166 * \out *errorInfo Current class does not inherit from parent class? 04167 * \return RFC_RC 04168 */ 04169 DECL_EXP RFC_RC SAP_API RfcGetParentClassByIndex(RFC_CLASS_DESC_HANDLE classDesc, RFC_CLASS_NAME name, unsigned index, RFC_ERROR_INFO* errorInfo); 04170 04171 /** 04172 * \brief Returns the number of parent classes of the given class. 04173 * \ingroup class 04174 * 04175 * 04176 * \in classDesc The class metadata description. 04177 * \out *parentClassesCount Number of parent classes in the list. 04178 * \out *errorInfo Should always be successful. 04179 * \return RFC_RC 04180 */ 04181 DECL_EXP RFC_RC SAP_API RfcGetParentClassesCount(RFC_CLASS_DESC_HANDLE classDesc, unsigned* parentClassesCount, RFC_ERROR_INFO* errorInfo); 04182 04183 /** 04184 * \brief Sets the parent classes of the given class. 04185 * \ingroup class 04186 * 04187 * 04188 * \in classDesc The class metadata description. 04189 * \in name Parent class name to be added. 04190 * \out *errorInfo No such parameter? 04191 * \return RFC_RC 04192 */ 04193 DECL_EXP RFC_RC SAP_API RfcAddParentClass(RFC_CLASS_DESC_HANDLE classDesc, const RFC_CLASS_NAME name, RFC_ERROR_INFO* errorInfo); 04194 04195 /** 04196 * \brief Returns the implemented interfaces of the given class. 04197 * \ingroup class 04198 * 04199 * 04200 * \in classDesc The class metadata description. 04201 * \in index Index of the implemented interface. 04202 * \out name Buffer for the implemented interface's name. 04203 * \out *errorInfo Index out of bounds? 04204 * \return RFC_RC 04205 */ 04206 DECL_EXP RFC_RC SAP_API RfcGetImplementedInterfaceByIndex(RFC_CLASS_DESC_HANDLE classDesc, unsigned index, RFC_CLASS_NAME name, RFC_ERROR_INFO* errorInfo); 04207 04208 /** 04209 * \brief Returns the number of parent interfaces of the given class. 04210 * \ingroup class 04211 * 04212 * 04213 * \in classDesc The class metadata description. 04214 * \out *implementedInterfacesCount Number of implemented interfaces. 04215 * \out *errorInfo Should always be successful. 04216 * \return RFC_RC 04217 */ 04218 DECL_EXP RFC_RC SAP_API RfcGetImplementedInterfacesCount(RFC_CLASS_DESC_HANDLE classDesc, unsigned* implementedInterfacesCount, RFC_ERROR_INFO* errorInfo); 04219 04220 /** 04221 * \brief Adds an interface to the list of implemented interfaces of the given class. 04222 * \ingroup class 04223 * 04224 * 04225 * \in classDesc The class metadata description. 04226 * \in name Name of implemented interface to be added. 04227 * \out *errorInfo Not much can go wrong here except out of memory. 04228 * \return RFC_RC 04229 */ 04230 DECL_EXP RFC_RC SAP_API RfcAddImplementedInterface(RFC_CLASS_DESC_HANDLE classDesc, const RFC_CLASS_NAME name, RFC_ERROR_INFO* errorInfo); 04231 04232 /** 04233 * \brief Deletes the class description and releases the allocated resources. 04234 * \ingroup class 04235 * 04236 * Only descriptions, which are not stored in a repository cache and not used by the application, can be deleted. 04237 * Deleting a cached description will cause an error, and deleting a description that is still in use, will lead 04238 * to a crash. 04239 * 04240 * 04241 * \in classHandle The class description to be deleted. 04242 * \out *errorInfo More details in case the description can not be destroyed. 04243 * \return RFC_RC 04244 */ 04245 DECL_EXP RFC_RC SAP_API RfcDestroyClassDesc(RFC_CLASS_DESC_HANDLE classHandle, RFC_ERROR_INFO *errorInfo); 04246 04247 04248 typedef void* RFC_METADATA_QUERY_RESULT_HANDLE; ///< Handle to a metadata query result. 04249 04250 /** \struct _RFC_METADATA_QUERY_RESULT_ENTRY 04251 * \ingroup repository 04252 * 04253 * Structure containing the error occurred during metadata query. 04254 */ 04255 typedef struct _RFC_METADATA_QUERY_RESULT_ENTRY 04256 { 04257 RFC_ABAP_NAME name; 04258 SAP_UC errorMessage[512]; 04259 } RFC_METADATA_QUERY_RESULT_ENTRY; 04260 04261 /** \enum _RFC_METADATA_OBJ_TYPE 04262 * \ingroup repository 04263 * 04264 * RFC_METADATA_OBJ_TYPE is either function or type or class and is used in RfcGetMetadataQueryFailedEntry() 04265 * and RfcGetMetadataQuerySucceededEntry(). 04266 */ 04267 typedef enum _RFC_METADATA_OBJ_TYPE {RFC_METADATA_FUNCTION, RFC_METADATA_TYPE, RFC_METADATA_CLASS} RFC_METADATA_OBJ_TYPE; 04268 04269 /** 04270 * \brief Creates the metadata query result 04271 * \ingroup repository 04272 * 04273 * Metadata query result contains the names of functions, types and classes queried successfully, or errors, if the query failed. 04274 * 04275 * \out *errorInfo More details in error case 04276 * \return Handle to a metadata query result 04277 */ 04278 DECL_EXP RFC_METADATA_QUERY_RESULT_HANDLE SAP_API RfcCreateMetadataQueryResult(RFC_ERROR_INFO *errorInfo); 04279 04280 /** 04281 * \brief Destroys the metadata query result 04282 * \ingroup repository 04283 * 04284 * Releases all resources allocated by the metadata query result. 04285 * 04286 * \in handle Handle to a metadata query result 04287 * \out *errorInfo More details in error case 04288 * \return RFC_RC 04289 */ 04290 DECL_EXP RFC_RC SAP_API RfcDestroyMetadataQueryResult(RFC_METADATA_QUERY_RESULT_HANDLE handle, RFC_ERROR_INFO *errorInfo); 04291 04292 /** 04293 * \brief Describes the metadata query result 04294 * \ingroup repository 04295 * 04296 * Returns the number of succeeded and failed entries in the metadata query result. The entries' content can be read with 04297 * RfcGetMetadataQueryFailedEntry() and RfcGetMetadataQuerySucceededEntry(). 04298 * 04299 * \in handle Handle to a metadata query result 04300 * \in type Type of the requested object 04301 * \out *successful Number of metadata objects queried successfully 04302 * \out *failed Number of metadata objects that could not be queried 04303 * \out *errorInfo More details in error case 04304 * \return RFC_RC 04305 */ 04306 DECL_EXP RFC_RC SAP_API RfcDescribeMetadataQueryResult(RFC_METADATA_QUERY_RESULT_HANDLE handle, 04307 RFC_METADATA_OBJ_TYPE type, unsigned* successful, unsigned *failed, RFC_ERROR_INFO *errorInfo); 04308 04309 /** 04310 * \brief Returns the error entry from the metadata query result 04311 * \ingroup repository 04312 * 04313 * Returns the object name and the error text, if an error occurred during the query. 04314 * 04315 * \in handle Handle to a metadata query result 04316 * \in type Type of the requested object 04317 * \in index Index of the requested object 04318 * \inout *entry Pointer to the allocated structure to store the name of the metadata object and the error text 04319 * \out *errorInfo More details in error case 04320 * \return RFC_RC 04321 */ 04322 DECL_EXP RFC_RC SAP_API RfcGetMetadataQueryFailedEntry(RFC_METADATA_QUERY_RESULT_HANDLE handle, 04323 RFC_METADATA_OBJ_TYPE type, unsigned index, RFC_METADATA_QUERY_RESULT_ENTRY* entry, RFC_ERROR_INFO *errorInfo); 04324 04325 /** 04326 * \brief Returns a succeeded entry from the metadata query result 04327 * \ingroup repository 04328 * 04329 * Returns the object name queried successfully 04330 * 04331 * \in handle Handle to a metadata query result 04332 * \in type Type of the requested object 04333 * \in index Index of the requested object 04334 * \inout *succeedObj Pointer to the allocated buffer to store the name of the metadata object 04335 * \out *errorInfo More details in error case 04336 * \return RFC_RC 04337 */ 04338 DECL_EXP RFC_RC SAP_API RfcGetMetadataQuerySucceededEntry(RFC_METADATA_QUERY_RESULT_HANDLE handle, 04339 RFC_METADATA_OBJ_TYPE type, unsigned index, RFC_ABAP_NAME succeedObj, RFC_ERROR_INFO *errorInfo); 04340 04341 04342 /** 04343 * \brief Queries the meta data for function, type and class lists. 04344 * \ingroup repository 04345 * 04346 * Queries the meta data for function, type and class lists. All meta data is fetched using one roundtrip, 04347 * the result is cached in the repository cache. 04348 * 04349 * 04350 * \in rfcHandle Open client connection to the R/3 System, for which you need the function module, type or class descriptions. 04351 * \in *functionNames Names of the function modules to look up. 04352 * \in functionCount Length of the function name list 04353 * \in *typeNames Names of the types to look up. 04354 * \in typeCount Length of the type name list 04355 * \in *classNames Names of the classes to look up. 04356 * \in classCount Length of the class name list 04357 * \in handle Query result, may be null. 04358 * \out *errorInfo More error details in case something goes wrong. 04359 * \return RFC_RC 04360 */ 04361 DECL_EXP RFC_RC SAP_API RfcMetadataBatchQuery(RFC_CONNECTION_HANDLE rfcHandle, 04362 const SAP_UC** functionNames, unsigned functionCount, const SAP_UC** typeNames, unsigned typeCount, 04363 const SAP_UC** classNames, unsigned classCount, RFC_METADATA_QUERY_RESULT_HANDLE handle, RFC_ERROR_INFO *errorInfo); 04364 04365 #ifdef __cplusplus 04366 } 04367 #endif /*cplusplus*/ 04368 04369 #endif
1.5.5