Skip to Content

Problems to configure SAP NW RFC in PHP

Hello guys, I am to configuring the SAP NW RFC for PHP 5.6. I maked all necessary for this, so when I printing phpinfo at my server SAP NW RFC appears enabled but I having the next error to make a instance to sapnwrfc in a file PHP.

Error:
ERROR partner '30.123.321.111:sapms02' not reached TIME Wed Feb 14 19:29:09 2018 RELEASE 721 COMPONENT NI (network interface) VERSION 40 RC -10 MODULE nixxi.cpp LINE 3289 DETAIL NiPConnect2: 30.123.321.111:3300 SYSTEM CALL connect ERRNO 111 ERRNO TEXT Connection refused COUNTER 2


Script PHP:

use sapnwrfc;
use sapnwrfcConnectionException;
use sapnwrfcCallException;
/**
 * Get some system informations
 */
if (! extension_loaded('sapnwrfc')) {
    throw new \Exception('Extension "sapnwrfc" not loaded. Please see https://github.com/piersharding/php-sapnwrfc#installation');
}
// @see the available connection paraemters here
// http://help.sap.com/saphelp_nwpi711/helpdata/en/48/c7bb09da5e31ebe10000000a42189b/content.htm
$config = [
    'MSHOST' => '30.123.321.111',
    'CLIENT' => '500',
    'R3NAME' => '02',
    'CODEPAGE' => '1102',
    'user' => 'myuser',
    'passwd' => 'mypass'
];

try {
    $conn = new sapnwrfc($config);
} catch(sapnwrfcConnectionException $e){
    // do something!
 print $e->getMessage();
}
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Feb 14 at 10:20 PM

    You mix up connection type "A" and "B", see link in your code.

    Type "A" = _A_pplication server = "ASHOST", "SYSNR"

    Type "B" = Message server (load _b_alancing) = "MSHOST", "R3NAME", "GROUP"

    R3NAME is always three characters, SYSNR is number 00-99.

    Your connection parameter should work with ASHOST and SYSNR.

    $config =[
    'ASHOST'=>'30.123.321.111',
    'SYSNR'=>'02',
    'CLIENT'=>'500',
    'user'=>'myuser',
    'passwd'=>'mypass',
    'CODEPAGE'=>'1102'];
    Add comment
    10|10000 characters needed characters exceeded