Skip to Content

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:

 dl("sapnwrfc.so");
echo "sapnwrfc version: ".sapnwrfc_version()." ";
echo "nw rfc sdk version: ".sapnwrfc_rfcversion()." ";
$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 sapnwrfc a PHP extension for the NW RFC SDK.

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

  1. Nigel James
    Piers,
    thank you thank you thank you thank you thank you
    thank you thank you thank you thank you thank you
    thank you thank you thank you thank you thank you
    thank you thank you thank you thank you thank you
    thank you thank you thank you thank you thank you

    Thank you,
    Nigel

    (0) 
  2. Gregor Wolf
    Hi Piers,

    thank you for your big effort to provide a new NetWeaver RFC based connector for PHP. That news made my day. I’ve informed already my colleagues and hope they will have success compiling it also on Windows. I will try it out on my Debian Linux that weekend.

    All the best with your Moodle project.

    Cheers
    Gregor

    (0) 
    1. Piers Harding Post author
      Hi Gregor –
      thanks for pitching in with the testing (and thanks to eveyone else getting involved too).
      I’m updating the code, and build system frequently, so you need to be aware that there are regular updates coming through.
      In fact – I should really keep track of this in the forums (/me goes off to post there too)

      Cheers.

      (0) 

Leave a Reply