In my recent work I've been working in the Education Software area, more specifically LMSs (Learning Managment Systems).  As my current employer is a completely Open Source oriented company (yay!), we work with Moodle.

Moodle is PHP based, so when it came to the question of integrating this with SAP, we had a stumbling block.  The existing connector is a very good one, but it doesn't give full UNICODE support, and it doens't take advantage of the NetWeaver RFC SDK such as complex structures, and strings.

To this end I've written sapnwrfc for PHP.

You can download sapnwrfc from here.

Follow the INSTALL instructions, and here is a bit of a taster:

 <?php
dl("sapnwrfc.so");
echo "sapnwrfc version: ".sapnwrfc_version()."\n";
echo "nw rfc sdk version: ".sapnwrfc_rfcversion()."\n";
$config = array('ashost' => 'ubuntu.local.net',
                'sysnr' => "01",
                'client' => "001",
                'user' => 'developer',
                'passwd' => 'developer',
                'lang' => 'EN',
                'trace' => '1' );

// we must have a valid connection
try {
    $conn = new sapnwrfc($config);
    $fds = $conn->function_lookup("STFC_DEEP_STRUCTURE");
    $fdt = $conn->function_lookup("STFC_DEEP_TABLE");
    $parms = array('IMPORTSTRUCT' => array('I' => 123, 'C' => 'AbCdEf', 'STR' => 'The quick brown fox ...'));
    $results = $fds->invoke($parms);
    var_dump($results);
    $parms = array('IMPORT_TAB' => array(array('I' => 123, 'C' => 'AbCdEf', 'STR' => 'The quick brown fox ...')));
    $results = $fdt->invoke($parms);
    var_dump($results);
    $conn->close();
}
catch (Exception $e) {
    echo "Exception message: ".$e->getMessage();
    throw new Exception('Assertion failed.');
}

 sapnwrfc is a work in progress, so testing and feedback is welcome.

A discussion has been started in the forums here.

Posted by PiersHarding at January 27, 2009 8:49 PM