on 2012 Jan 04 5:00 PM
Hello all. I (and a group of contractors) have been struggling with this issue for a few months at this point and are pretty much out of ideas. We are upgrading from a PA-RISC to an Itanium machine and have been able to update all of our software except for the RFC handling.
<p>We are using the libraries and objects from NWRFC_9-20004304.SAR.
<p>We first use rfcexec with the following data:
<p>/* for AU2 on ahq***** */
<p>DEST=au2server
<p>TYPE=R
<p>PROGID=isnts40_ia_trilogy.AU2
<p>GWHOST=10.100.89.177
<p>GWSERV=sapgw06
<p>RFC_TRACE=1
<p>
<p>And the resulting output is:
<p>
<p>cat dev_rfc
<p>
<p>**** Trace file opened at 20120104 112228 EST SAP-REL 640,0,303 RFC-VER 3 1100046
<p>======> Destination 'aurserver' not found in 'saprfc.ini'
<p>
<p>**** Trace file opened at 20120104 112231 EST SAP-REL 640,0,303 RFC-VER 3 1100046
<p>*> RfcRegisterProgram ...
<p> Server Program ID = isnts40_ia_trilogy.AU2
<p> Host name of Gateway = 10.100.89.177
<p> Service of Gateway = 3306
<p> RFC-Trace = ON
<p> SNC Own Name =
<p> SNC Library Name =
<p> RFC Handle = 1
<p><* RfcRegisterProgram ended successfully
<p>
<p>
<p>>>>> RfcAbort called by external program ...
<p> handle = 1
<p> text = Could not open file rfcexec.sec
<p>
<p>>>>> rfcAbort called by RFC Library in file: abrfc.c, line: 612
<p> handle = 1
<p> text = Could not open file rfcexec.sec
<p>>>>> [1] < accepted > : REG <ac: 1> L >>> FLUSH (READ)
<p>Error RFCIO_ERROR_SYSERROR in abrfcio.c : 2446
<p>---> RFC MESSAGE/ERROR : 102
<p>* RFC_ERROR_COMMUNICATION
<p>* connection closed
<p>>>>> [1] < accepted > : REG <ac: 2> L >>> ABORT abrfc.c 732
<p>>>>> [1] < accepted > : REG <ac: 3> L >>> CLOSE abrfcio.c 3247
<p>>>>> [1] < accepted > : REG <ac: 4> L >>> FREE abrfcio.c 3248
<p>
<p>**** Trace file opened at 20120104 112231 EST SAP-REL 640,0,303 RFC-VER 3 1100046
<p><<<< RfcAbort
<p>
<p><* rfcAbort
<p><* RfcAbort
<p>
<p>First thing, I'm assuming this was successful though the Abort at the end concerns me.
<p>
<p>Using the rfcexec.cpp program as a basis, the contractors provided a sample program of their own code attempting to <p>connect through RFC. Here is what they are doing:
<p>
<p>
<p>
#include "sapnwrfc.h"
<p>#include "sapdecf.h"
<p>#include <string>
<p>
<p>// We are using non Unicode verision of SAP NW API and SAP_UC datatype is char is our case
<p>// But it turned out that we received non char buffer from SAP.
<p>// converts SAP_UC buffer to char buffer.
<p>// In GDB we can see that key field for example is following:
<p>// key = "\000R\000F\000C\000_\000I\000N\000V\000A\000L\000I\000D\000_\000P\000A\000R\000A\000M\000E\000T\000E\000R"
<p>// instead of "RFC_INVALID_PARAMETER".
<p>// The purpose of the function to trim extra zeros to see human readable error decription.
<p>char * sap_uc2c(char * dest, SAP_UC * src, size_t len)
<p>{
<p> memset(dest, 0, len);
<p> for (int i = 0, j = 0; i < len; ++i) {
<p> if ( src<i> != '\0' )
<p> dest[j++] = src<i>;
<p> }
<p> return dest;
<p>}
<p>
<p>void errorHandling(RFC_RC rc, SAP_UC description[], RFC_ERROR_INFO* errorInfo, RFC_CONNECTION_HANDLE connection){
<p> printfU(cU("Connection Failed......in errorHandling"));
<p> const size_t err_key_size = sizeof(errorInfo->key) / sizeof(errorInfo->key[0]);
<p> const size_t err_message_size = sizeof(errorInfo->message) / sizeof(errorInfo->message[0]);
<p>
<p> char err_key[err_key_size];
<p> char err_message[err_message_size];
<p> sap_uc2c(err_key, errorInfo->key, err_key_size);
<p> sap_uc2c(err_message, errorInfo->message, err_message_size);
<p>
<p> printfU(cU("\n== ERROR_INFO ==\nKey: %s\nMessage: %s\n"), err_key, err_message);
<p>
<p> // It's better to close the TCP/IP connection cleanly, than to just let the
<p> // backend get a "Connection reset by peer" error...
<p> if (connection != NULL) RfcCloseConnection(connection, errorInfo);
<p>
<p> exit(1);
<p>}
<p>int mainU(int argc, SAP_UC** argv){
<p> RFC_RC rc = RFC_OK;
<p> RFC_CONNECTION_PARAMETER serverCon[3];
<p> RFC_CONNECTION_HANDLE serverHandle;
<p> RFC_ERROR_INFO errorInfo;
<p>
<p> // Connection information is configured in below three lines of code
<p> serverCon[0].name = cU("program_id"); serverCon[0].value = cU("isnts40_ia_trilogy.AU2");
<p> serverCon[1].name = cU("gwhost"); serverCon[1].value = cU("10.100.89.177");
<p> serverCon[2].name = cU("gwserv"); serverCon[2].value = cU("sapgw06");
<p>
<p> const char * str1 = serverCon[0].value;
<p> const char * str2 = serverCon[1].value;
<p> const char * str3 = serverCon[2].value;
<p> printfU(cU(str1));
<p> printfU(cU("\n"));
<p> printfU(cU(str2));
<p> printfU(cU("\n"));
<p> printfU(cU(str3));
<p> printfU(cU("\n"));
<p> printfU(cU("Registering Server..."));
<p>
<p> serverHandle = RfcRegisterServer(serverCon, 6, &errorInfo);
<p> if (serverHandle == NULL)
<p> errorHandling(errorInfo.code, cU("Error Starting RFC Server"), &errorInfo, NULL);
<p> printfU(cU(" ...done\n"));
<p>
<p> printfU(cU("Starting to listen...\n\n"));
<p> while(RFC_OK == rc || RFC_RETRY == rc || RFC_ABAP_EXCEPTION == rc){
<p> rc = RfcListenAndDispatch(serverHandle, 120, &errorInfo);
<p> printfU(cU("RfcListenAndDispatch() returned %s\n"), RfcGetRcAsString(rc));
<p> switch (rc){
<p> case RFC_RETRY: // This only notifies us, that no request came in within the timeout period.
<p> // We just continue our loop.
<p> printfU(cU("No request within 120s.\n"));
<p> break;
<p> case RFC_ABAP_EXCEPTION: // Our function module implementation has returned RFC_ABAP_EXCEPTION.
<p> // This is equivalent to an ABAP function module throwing an ABAP Exception.
<p> // The Exception has been returned to the SAP system and our connection is still open.
<p> // So we just loop around.
<p> printfU(cU("ABAP_EXCEPTION in implementing function: %s\n"), errorInfo.key);
<p> break;
<p> case RFC_NOT_FOUND: // The SAP system tried to invoke a function module, for which we did not supply
<p> // an implementation. The SAP system has been notified of this through a SYSTEM_FAILURE,
<p> // so we need to refresh our connection.
<p> printfU(cU("Unknown function module: %s\n"), errorInfo.message);
<p> case RFC_EXTERNAL_FAILURE: // Our function module implementation raised a SYSTEM_FAILURE. In this case
<p> // the connection needs to be refreshed as well.
<p> printfU(cU("SYSTEM_FAILURE has been sent to backend.\n\n"));
<p> case RFC_ABAP_MESSAGE: // And in this case a fresh connection is needed as well
<p> serverHandle = RfcRegisterServer(serverCon, 3, &errorInfo);
<p> rc = errorInfo.code;
<p> break;
<p> }
<p> }
<p>
<p> return 0;
<p>}
<p>As you can see, the connection data is hard coded rather than read from the *.ini file just for testing purposes. Our main thing to accomplish is to successfully establish a connection somehow.
<p>Currently we are getting the following as the output from the above program:
<p>
<p>sapConnServ
<p>isnts40_ia_trilogy.AU2
<p>10.100.89.177
<p>sapgw06
<p>Registering Server...Connection Failed......in errorHandling
<p>== ERROR_INFO ==
<p>Key: RFC_INVALID_PARAMETER
<p>Message: Parameter ASHOST, GWHOST or MSHOST is missing.
<p>
<p>Any ideas or suggestions on how we can get this working?
Edited by: Brad Smith on Jan 4, 2012 12:10 PM
Request clarification before answering.
Hello Smith
Do you maintain entries in "saprfc.ini". If not please try that. Below is the link
http://help.sap.com/saphelp_nw04/helpdata/en/22/042a58488911d189490000e829fbbd/content.htm
Thanks & regards
bala
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.