SapServer Bean
Properties Methods Events Configuration Settings Errors
The SapServer component provides a simple, easy to use interface for receiving remote function calls from the SAP R/3 NetWeaver system. You can register multiple functions and call them from inside NetWeaver, as if they were standard transactions.
Syntax
InERP.Sapserver
Remarks
The purpose of this bean is to create an application that executes your custom code, written in the language of your choice, but which is called from the SAP NetWeaver system.
There are just a few steps necessary to creating a server application, which will allow you to receive and process remote function calls from a SAP NetWeaver system. First we must connect to NetWeaver. Unlike the SapClient, no credentials are required to connect to the SAP system as a server. Just specify a unique name used to identify this program to the SAP system in the AcceptConnections method, along with the GatewayHost and GatewayService you wish to connect through.
Then use the InstallFunction method to install and register one or more functions with the SAP NetWeaver system.
Once you're connected to the SAP system, and your functions are installed, set Listening to True to begin listening for incoming function calls. Incoming function calls will fire in the FunctionCall event. When the event fires the FunctionName parameter will indicate which installed function that SAP NetWeaver wishes to execute.
To implement the function call, first set the names of the ReceiveParams you expect NetWeaver to submit, and call UpdateReceiveParams. This does whatever work your function implements, then set the ReplyParams and call SendReply when you're finished.
For example:
First, set up the connection, install the function, and begin listening for calls from the SAP system.
SapServer1.AcceptConnections("Hello.App", "localhost", "sapgw00"); SapServer1.InstallFunction("Z_HELLO", "Simple greeting app."); SapServer1.Listening = true;Then, implement the function you installed inside the FunctionCall event.
void SapServer1_OnFunctionCall(object sender, SapserverFuncionCallEventArgs e) { if (e.FunctionName.Equals("Z_HELLO")) { SapServer1.ReceiveParams.Add(new nsoftware.InERP.SapParam("FIRSTNAME", "",ptCharacters)); SapServer1.ReceiveParams.Add(new nsoftware.InERP.SapParam("LASTNAME", "", ptCharacters)); SapServer1.UpdateReceiveParams(); String greeting = "Hello " + SapServer1.ReceiveParams.ElementAt(0).Value + " " + SapServer1.ReceiveParams.ElementAt(1).Value + ", I hope that you are well."; SapServer1.ReplyParams.Add(new nsoftware.InERP.SapParam("GREETING", greeting, ptCharacters)); SapServer1.SendReply(); } }
Errors can be sent to the SAP system with RaiseException, and CloseConnection is used to terminate a connection to the SAP NetWeaver system. Internal tables are also supported; see the Table properties (TableCount, TableIndex, etc) for more information on using tables with remote function calls.
This bean also supports transactional mode, which ensures that a transaction is only executed once, and is rolled back if an error occurs during processing. If TransactionMode is set to tmTransactional, the CheckId event will fire before the SAP server starts a transaction. The SAP system will supply a unique identifier in the TransactionId parameter. You are responsible storing the TransactionId and ensuring that the client system (SAP server) does not try to start the same transaction a second time. To do this simply set the Accept parameter of the CheckId event to False. This will indicate to the connecting client that the transaction is already completed, and to skip the request. If you set Accept to True the client will continue the connection, and FunctionCall will fire next.
After processing the request in the FunctionCall event the SAP system will cause the Commit event to fire. This indicates that the transaction has been completed on the SAP system's end, and that. If instead the RollBack event fires, you should roll back and undo all the changes you made when processing the transaction inside the FunctionCall event.
Finally, the ConfirmId event will fire once the transaction is completed on both sides, and the TransactionId is released. The transactional process is now completed.
Note that CheckId, Commit, RollBack, and FunctionCall will not fire unless TransactionMode is set to tmTransactional.
Dependency Notes
If the bean is not configured to use the SOAP interface, it will use the sapnwrfc.dll, librfc32.dll, librfc32u.dll, or the Java Connector (JCo) to connect to the SAP system. Although the Java Connector is only available when programming in Java on Windows.
The NetWeaver RFC SDK (sapnwrfc.dll) offers both a 32 bit and 64 bit version. Likewise, the SAP RFC SDK offers as 32 bit and 64 bit version of both a unicode (librfc32u.dll) and non-unicode (librfc32.dll) library.
The NetWeaver RFC SDK will be used if the ConnectionType is set to ctNetWeaver (0). The following libraries from the NetWeaver RFC SDK must be available at runtime:
- sapnwrfc.dll
- icudt30.dll
- icuin30.dll
- icuuc30.dll
- libicudecnumber.dll
- libsapucum.dll
The non-unicode library will be used if the ConnectionType is set to ctClassic (1). This simply requires that the librfc32.dll be placed in a location that is accessible at runtime. (0).
The unicode library will be used if the ConnectionType is set to ctClassicUnicode (2). The following libraries from the SAP RFC SDK must be available at runtime:
- librfc32u.dll
- icudt30.dll
- icuin30.dll
- icuuc30.dll
The Java Connector (JCo) will be used if the ConnectionType is set to ctJavaConnector (4). In order to use this, you must first add the sapjco3.jar file to your project.
The 32 bit and 64 bit versions do not require any special settings within the beans. The only requirement is that your application target the same platform as the DLL.
In addition to the dependencies above, the following services must be added to %WINDIR%\system32\drivers\etc\services, or /etc/services if your system is running Linux or Mac OS X. If SAP NetWeaver is already installed on the machine,then no further action is required.
Service Name | Port Number/Protocol |
sapdp00 | 3200/tcp |
sapdp01 | 3201/tcp |
sapdp02 | 3202/tcp |
sapdp03 | 3203/tcp |
sapdp04 | 3204/tcp |
sapdp05 | 3205/tcp |
sapdp06 | 3206/tcp |
sapdp07 | 3207/tcp |
sapdp08 | 3208/tcp |
sapdp09 | 3209/tcp |
sapdp10 | 3210/tcp |
sapdp11 | 3211/tcp |
sapdp12 | 3212/tcp |
sapdp13 | 3213/tcp |
sapdp14 | 3214/tcp |
sapdp15 | 3215/tcp |
sapdp16 | 3216/tcp |
sapdp17 | 3217/tcp |
sapdp18 | 3218/tcp |
sapdp19 | 3219/tcp |
sapdp20 | 3220/tcp |
sapdp21 | 3221/tcp |
sapdp22 | 3222/tcp |
sapdp23 | 3223/tcp |
sapdp24 | 3224/tcp |
sapdp25 | 3225/tcp |
sapdp26 | 3226/tcp |
sapdp27 | 3227/tcp |
sapdp28 | 3228/tcp |
sapdp29 | 3229/tcp |
sapdp30 | 3230/tcp |
sapdp31 | 3231/tcp |
sapdp32 | 3232/tcp |
sapdp33 | 3233/tcp |
sapdp34 | 3234/tcp |
sapdp35 | 3235/tcp |
sapdp36 | 3236/tcp |
sapdp37 | 3237/tcp |
sapdp38 | 3238/tcp |
sapdp39 | 3239/tcp |
sapdp40 | 3240/tcp |
sapdp41 | 3241/tcp |
sapdp42 | 3242/tcp |
sapdp43 | 3243/tcp |
sapdp44 | 3244/tcp |
sapdp45 | 3245/tcp |
sapdp46 | 3246/tcp |
sapdp47 | 3247/tcp |
sapdp48 | 3248/tcp |
sapdp49 | 3249/tcp |
sapdp50 | 3250/tcp |
sapdp51 | 3251/tcp |
sapdp52 | 3252/tcp |
sapdp53 | 3253/tcp |
sapdp54 | 3254/tcp |
sapdp55 | 3255/tcp |
sapdp56 | 3256/tcp |
sapdp57 | 3257/tcp |
sapdp58 | 3258/tcp |
sapdp59 | 3259/tcp |
sapdp60 | 3260/tcp |
sapdp61 | 3261/tcp |
sapdp62 | 3262/tcp |
sapdp63 | 3263/tcp |
sapdp64 | 3264/tcp |
sapdp65 | 3265/tcp |
sapdp66 | 3266/tcp |
sapdp67 | 3267/tcp |
sapdp68 | 3268/tcp |
sapdp69 | 3269/tcp |
sapdp70 | 3270/tcp |
sapdp71 | 3271/tcp |
sapdp72 | 3272/tcp |
sapdp73 | 3273/tcp |
sapdp74 | 3274/tcp |
sapdp75 | 3275/tcp |
sapdp76 | 3276/tcp |
sapdp77 | 3277/tcp |
sapdp78 | 3278/tcp |
sapdp79 | 3279/tcp |
sapdp80 | 3280/tcp |
sapdp81 | 3281/tcp |
sapdp82 | 3282/tcp |
sapdp83 | 3283/tcp |
sapdp84 | 3284/tcp |
sapdp85 | 3285/tcp |
sapdp86 | 3286/tcp |
sapdp87 | 3287/tcp |
sapdp88 | 3288/tcp |
sapdp89 | 3289/tcp |
sapdp90 | 3290/tcp |
sapdp91 | 3291/tcp |
sapdp92 | 3292/tcp |
sapdp93 | 3293/tcp |
sapdp94 | 3294/tcp |
sapdp95 | 3295/tcp |
sapdp96 | 3296/tcp |
sapdp97 | 3297/tcp |
sapdp98 | 3298/tcp |
sapdp99 | 3299/tcp |
sapgw00 | 3300/tcp |
sapgw01 | 3301/tcp |
sapgw02 | 3302/tcp |
sapgw03 | 3303/tcp |
sapgw04 | 3304/tcp |
sapgw05 | 3305/tcp |
sapgw06 | 3306/tcp |
sapgw07 | 3307/tcp |
sapgw08 | 3308/tcp |
sapgw09 | 3309/tcp |
sapgw10 | 3310/tcp |
sapgw11 | 3311/tcp |
sapgw12 | 3312/tcp |
sapgw13 | 3313/tcp |
sapgw14 | 3314/tcp |
sapgw15 | 3315/tcp |
sapgw16 | 3316/tcp |
sapgw17 | 3317/tcp |
sapgw18 | 3318/tcp |
sapgw19 | 3319/tcp |
sapgw20 | 3320/tcp |
sapgw21 | 3321/tcp |
sapgw22 | 3322/tcp |
sapgw23 | 3323/tcp |
sapgw24 | 3324/tcp |
sapgw25 | 3325/tcp |
sapgw26 | 3326/tcp |
sapgw27 | 3327/tcp |
sapgw28 | 3328/tcp |
sapgw29 | 3329/tcp |
sapgw30 | 3330/tcp |
sapgw31 | 3331/tcp |
sapgw32 | 3332/tcp |
sapgw33 | 3333/tcp |
sapgw34 | 3334/tcp |
sapgw35 | 3335/tcp |
sapgw36 | 3336/tcp |
sapgw37 | 3337/tcp |
sapgw38 | 3338/tcp |
sapgw39 | 3339/tcp |
sapgw40 | 3340/tcp |
sapgw41 | 3341/tcp |
sapgw42 | 3342/tcp |
sapgw43 | 3343/tcp |
sapgw44 | 3344/tcp |
sapgw45 | 3345/tcp |
sapgw46 | 3346/tcp |
sapgw47 | 3347/tcp |
sapgw48 | 3348/tcp |
sapgw49 | 3349/tcp |
sapgw50 | 3350/tcp |
sapgw51 | 3351/tcp |
sapgw52 | 3352/tcp |
sapgw53 | 3353/tcp |
sapgw54 | 3354/tcp |
sapgw55 | 3355/tcp |
sapgw56 | 3356/tcp |
sapgw57 | 3357/tcp |
sapgw58 | 3358/tcp |
sapgw59 | 3359/tcp |
sapgw60 | 3360/tcp |
sapgw61 | 3361/tcp |
sapgw62 | 3362/tcp |
sapgw63 | 3363/tcp |
sapgw64 | 3364/tcp |
sapgw65 | 3365/tcp |
sapgw66 | 3366/tcp |
sapgw67 | 3367/tcp |
sapgw68 | 3368/tcp |
sapgw69 | 3369/tcp |
sapgw70 | 3370/tcp |
sapgw71 | 3371/tcp |
sapgw72 | 3372/tcp |
sapgw73 | 3373/tcp |
sapgw74 | 3374/tcp |
sapgw75 | 3375/tcp |
sapgw76 | 3376/tcp |
sapgw77 | 3377/tcp |
sapgw78 | 3378/tcp |
sapgw79 | 3379/tcp |
sapgw80 | 3380/tcp |
sapgw81 | 3381/tcp |
sapgw82 | 3382/tcp |
sapgw83 | 3383/tcp |
sapgw84 | 3384/tcp |
sapgw85 | 3385/tcp |
sapgw86 | 3386/tcp |
sapgw87 | 3387/tcp |
sapgw88 | 3388/tcp |
sapgw89 | 3389/tcp |
sapgw90 | 3390/tcp |
sapgw91 | 3391/tcp |
sapgw92 | 3392/tcp |
sapgw93 | 3393/tcp |
sapgw94 | 3394/tcp |
sapgw95 | 3395/tcp |
sapgw96 | 3396/tcp |
sapgw97 | 3397/tcp |
sapgw98 | 3398/tcp |
sapgw99 | 3399/tcp |
Property List
The following is the full list of the properties of the bean with short descriptions. Click on the links for further details.
Columns | Contains a list of the columns that make up each row. |
Connected | Indicates whether or not the component is connected to the SAP system. |
InstalledFunctions | Contains a list of all installed functions. |
Listening | If True, the component listens for and accepts incoming connections from the SAP system. |
ReceiveIDoc | Determines if IDocs will be received. |
ReceiveParams | List of parameters to receive from the SAP system. |
ReplyParams | Parameters sent in reply to a remote function call. |
RowCount | The total number of rows in the table. |
RowData | The raw binary data that makes up a row. |
RowIndex | The index of the current row. By default, this is set to 0. When a table is returned Name will be populated with the name of the column and Value will be populated with the data for the column that correspond to the row specified here. In the event the table contains no data, set this to -1 to retrieve information about the fields. When set to -1, Name , Length , and ColumnType will be populated with the field information for each column. |
SapAttributes | Describes the SAP R/3 system you're connected to. |
SapConnection | These properties are used to connect to the SAP system. |
TableCount | Total number of tables used by the remote function call. |
TableIndex | Current index of the table being operated upon. |
TableName | The name of the current table. |
TableRowLength | Length of each row in the current table. |
Timeout | Length of time in seconds the component waits for a response from the SAP system. |
TransactionMode | Determines whether this server component behaves in a transactional manner. |
Method List
The following is the full list of the methods of the bean with short descriptions. Click on the links for further details.
abortConnection | Used to terminate a connection to the SAP system. |
acceptConnections | Opens a connection to and begins accepting connections from the SAP system. |
addReceiveParam | Adds a parameter to the ReceiveParams collection. |
addReplyParam | Adds a parameter to the ReplyParams collection. |
closeConnection | Closes a connection to the SAP system. |
config | Sets or retrieves a configuration setting . |
doEvents | Processes events from the internal message queue. |
getAttributes | Retrieves attributes about the SAP system you're currently connected to. |
installFunction | Registers your function with the sap system. |
interrupt | Interrupt the current method. |
raiseException | Used to reply with an error response to a function call request received from the SAP system. |
reset | Resets the component to its initial state. |
sendReply | Used to respond to a remote function call received from the sap server. |
updateReceiveParams | Retrieves the receive parameters for the function that was called. |
Event List
The following is the full list of the events fired by the bean with short descriptions. Click on the links for further details.
CheckId | Used to check if the transaction is already running or was already completed. |
Commit | SAP system indicates transaction completed on its end, and that you may commit any changes to your local database. |
ConfirmId | Fired when the client SAP system has completely finished processing your response, and intends to discard the TransactionId. |
Error | Information about errors during data delivery. |
FunctionCall | Fired when the component receives a remote function call request from the SAP system. |
IDocControlRecord | Fired when the client SAP system receives IDoc Control record data. |
IDocDataRecord | Fired when the client SAP system receives an IDoc data record segment. |
IDocEnd | Fired when the client SAP system is done receiving IDoc data. |
IDocStart | Fired when the client SAP system begins receiving IDoc data. |
RollBack | Fired when the client SAP system has encountered an error and wishes to roll back the transaction, if necessary. |
Status | Detailed status messages for debugging purposes. |
Configuration Settings
The following is a list of configuration settings for the bean with short descriptions. Click on the links for further details.
EnableClassicRFCTrace | Whether to enable trace files when working with the Classic RFC SDK. |
UseClientConnection | Use a client connection to retrieve function meta data. |
Group | The logon group. |
MessageServer | Service name of load balancer service. |
SncLibPath | The external security product's library. |
SncMode | The SNC activation indicator. |
SncName | The Initiator's SNC name. |
SncPartnerName | The communication partner's SNC name. |
SncQop | The quality of protection level. |
SystemID | The system ID of the SAP system. |
CodePage | The system code page used for Unicode to Multibyte translations. |