« Calling Perl from Java | Main | Stop Energy »

April 21, 2004

Release 1.25 - SAP::Rfc for Perl

Release 1.25 for Perl SAP::Rfc brings two new features for registered RFC calls. These are:

Raise EXCEPTIONS

When enabled - SAP style exception keywords thrown in ABAP, allow you to use "die" anywhere in your RFC callback handler to trigger the appropriate EXCEPTION. eg.

use SAP::Rfc;
...
$SAP::Rfc::EXCEPTION_ONLY = 1;
...
$rfc->accept();
...

sub do_my_special_callback{

  # some code that needs to throw an EXCEPTION...
  die "MY_CUSTOM_EXCEPTION_FOR_ABAP";
  
  return 1;

}
The above code would cause the MY_CUSTOM_EXCEPTION_FOR_ABAP EXCEPTION to be triggered in the ABAP code that accessed the registered RFC.

System information for Registered RFCs

you can now access comprehensive information regarding the current incoming RFC call from within a registered RFC callback.
The first parameter passed into the callback sub is an instance of SAP::Iface. This now has a new method sysinfo() that returns a hash ref of all the details regarding the current call - the partner system, the user etc.
eg.

...
# The main callback for handling faxes
sub do_sx_object_receive {

  my $iface = shift;
  debug("Running do_sx_object_receive...");
  my $sysinfo = $iface->sysinfo();
  warn "The system Id is: ".$sysinfo->{'sysid'}."\n";

  ...

Further information on SAP::Rfc for Perl can be found at: SAP::Rfc.

Posted by PiersHarding at April 21, 2004 9:45 AM