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