The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

sapnwrfc - SAP Netweaver RFC support for Perl

SYNOPSIS

  SAPNW::Rfc->load_config;
  my $conn = SAPNW::Rfc->rfc_connect;

  my $rd = $conn->function_lookup("RPY_PROGRAM_READ");
  my $rc = $rd->create_function_call;
  $rc->PROGRAM_NAME("SAPLGRFC");
        eval {
  $rc->invoke;
        };
        if ($@) {
          die "RFC Error: $@\n";
        }
  print "Program name: ".$rc->PROG_INF->{'PROGNAME'}."\n";
  my $cnt_lines_with_text = scalar grep(/LGRFCUXX/, map { $_->{LINE} } @{$rc->SOURCE_EXTENDED});
  $conn->disconnect;

DESCRIPTION

sapnwrfc is an RFC based connector to SAP specifically designed for use with the next generation RFC SDK supplied by SAP for NW2004+ .

The next generation RFCSDK from SAP provides a number of interesting new features. The two most important are:

  • UNICODE support

  • deep/nested structures

The UNICODE support is built fundamentally into the core of the new SDK, and as a result this is reflected in sapnwrfc. sapnwrfc takes UTF-8 as its only input character set, and handles the translation of this to UTF-16 as required by the RFCSDK.

Deep and complex structures are now supported fully. Please see the test_deep.rb example in tests/ for an idea as to how it works.

sapnwrfc is a departure to the way the original SAP::Rfc (http://search.cpan.org/search?module=SAP::Rfc) works. It aims to simplify the exchange of native Perl data types between the user application and the connector. This means that the following general rules should be observered, when passing values to and from RFC interface parameters and tables:

  • Tables expect Arrays of Hashes.

  • Parameters with structures expect Hashes.

  • CHAR, DATE, TIME, STRING, XSTRING, and BYTE type parameters expect String values.

  • BCD, and FLOAT expect a string representing the number.

  • all INT types must be Perl ints.

There are a lot of examples of passing data in and out of the connector in the test suite - please refer to these to gain a better understanding of how to make it work.

Connection Parameters

Connection parameters can be either passed into SAPNW::Rfc->rfc_connect() as a hash of permited values, or more conveniently they can be stored in a YAML based config file. Refer to the the file "sap.yml" that comes with this distribution for an example like this:

  ashost: ubuntu.local.net
  sysnr: "01"
  client: "001"
  user: developer
  passwd: developer
  lang: EN
  trace: 2
  debug: 1

Note: if you supply your config via the YAML based file, you can override any or all of those parameters at the time a call is made to SAPNW::Rfc->rfc_connect().

AUTHOR

Piers Harding, piers@cpan.org.

Many thanks to:

  • Craig Cmehil - for making the connnections

  • Ulrich Schmidt - for tireless help in development

  • Olivier Boudry - the build and test meister

SEE ALSO

perl(1), ABAP(101).