« December 2003 | Main | June 2004 »

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 9:45 AM

April 17, 2004

Calling Perl from Java

Something that I have been playing with of late is calling Perl from Java, and it is something that I can see people needing more and more as time goes by.
Java-|
     |--> Perl (and maybe back again at some later date)
After talking with Patrick Leboutillier of Inline::Java, I decided to have a crack at building this functionality myself (at the time Inline::Java's focus was on calling Java from Perl, and the reverse was not complete).
What I needed was to be able to communicate with a custom built Perl based application server that we use to abstract our business logic from our Business Portal, to SAPs new J2EE enable server technology.
If anyone is interested in having a go, the results of this so far is org.perl.java.
The README explains the difficulties with JVMs, and the build requirements of Perl. So far, there is the ability to load an initial perl program, eval an arbitrary piece of Perl, call a static Perl method, and do an instance method call, on a previously defined Perl object reference. All return values are either further Perl object references or strings currently.

Posted by PiersHarding at 9:43 PM