May 11, 2007
sapnwrfc for Python
The first version of sapnwrfc for Python is now available. Like the sapnwrfc for Ruby, and Perl, this is a complete rewrite to take advantage of the new SAP NW RFCSDK, with unicode support, and support for deep structures. This version provides Client side RFC support only. The download is available herePosted by PiersHarding at 6:27 AM
May 10, 2007
NW RFC SDK is now officially available
The new SAP NW RFCSDK
The new SAP NetWeaver RFCSDK is now available for official download - this opens the way for supported next generation Open Source Connectors such as sapnwrfc for Perl, and sapnwrfc for Ruby.
Where to get it?
You need to go to the SAP service Portal for Software downloads, and follow the path of: Download -> Support Packages and Patches -> Entry by Application Group -> Additional Components -> SAP NW RFC SDK -> SAP NW RFC SDK 7.10 -> SAP NW RFC SDK 7.10 .
There is an accompanying OSS note: 1025361.
Impact on Connectors
As mentioned in a previous blog (but so much better in Ulrichs' blog), the new NW RFCSDK not only updates the implementation of the library that all 3rd party products use, but it also provides a better interface to develop to, and exposes several key features such as Unicode, and complex structures.Clearly - this is SAPs way forward in the RFC area of closely bound system integration, so all existing connectors (and 3rd party products) will eventually have to migrate to it.
This is also true of code that is based on the existing connectors for Perl and Ruby. For Perl - there will be a migration from SAP::Rfc -> sapnwrfc, and likewise for Ruby moving from saprfc -> sapnwrfc (The client side implementation for the new sapnwrfc connector for Python is nearly finished, with the same implications).
My thanks and congratulations go out to the SAP NW RFC Team (NW AS ABAP Connectivity) - through their efforts, and willingness to engage the community, they have made it possible for us frustrated hackers to have a little more fun :-)
Posted by PiersHarding at 8:49 AM
March 1, 2007
sap4rails updated to support new sapnwrfc
sap4rails has been upgraded to support the new RFC Connector for Ruby - sapnwrfc.Posted by PiersHarding at 9:39 AM
February 28, 2007
New RFC Connector - sapnwrfc
SAP has undertaken a project to re-engineer the RFC SDK (creating the SAP NetWeaver RFC SDK), which is good news for the Connectors (ref.).
This means that eventually - all the RFC connectors, and 3rd party products will need to be updated to use the new under-carriage.
So whats the big deal?
RFC is a stable technology, and has been for many years, so I can understand why this revelation may not seem very exciting. What is exciting is the unprecedented level of cooperation, understanding and good will that has come out in a relatively short time, as I have moved through the process of redeveloping the Ruby and Perl RFC Connectors. The result is (and will be more so), a better fit in terms of how the SDK works with Dynamic Languages, allowing the API that the Dynamic Languages offer for RFC connectivity, to better reflect the nature of those programming languages. For example - there are better features in the new NW RFC SDK that allow for easy translation of ABAP types to Ruby/Perl types.
New Features
If we set aside the rationalisation, and simplification of the NW SDK (which is a bonus in itself), there are new features of the NW SDK that can be drawn upon -- unicode in the core, with utf-8 to utf-16 conversion tools
- intelligent ABAP <=> X helper functions to ease type translations
- deep structures
- interface discovery
- interface, and structure caching
This has lead to a complete overhaul of the Ruby, and Perl Connectors, with the aim to take advantage of the new NW SDK features, and to produce connectors that create a more intuitive bond between the underlying RFC API, and the natural features of each Dynamic Language.
Call for testers
As the new Ruby and Perl RFC Connectors are a complete rewrite and Alpha, I am calling for testers/early adopters from the Community.
Obtaining the Connectors, and Netweaver RFC SDK
Download the new sapnwrfc connector for Ruby, and get the new RFC SDK, port your applications to it, and let me know how you get on. I'm interested in usability feedback, problems, and feature requests.For Ruby - download from the RAA. Follow the instructions in the included README file. Documentation is available Here. A GEM install package for Win32 has been built available here.
For Perl - download from CPAN. Again - follow the instructions in the included README file. Documentation is available Here. A PPM install package for Win32 has been built available here.
If you are interested in trialling/testing the new connectors, then along with the installing the new connectors (above) you will need to obtain the new Netweaver RFC SDK. in order to do this, please register your interest with me, ensuring that I know how to contact you, and what your platform requirements are, and with the help of the NW RFC team at SAP I will get the relevant details to you.
Ruby Examples
There are plenty of examples in the tests/ directory of the sapnwrfc download, but here is a basic walk through of the new API:
# specify a YAML base config file or pass connection
# parameters directly to rfc_connect()
SAPNW::Base.config_location = './config_file.yml'
SAPNW::Base.load_config
conn = SAPNW::Base.rfc_connect
# get the system and connection details
attrib = conn.connection_attributes
$stderr.print "Connection Attributes: #{attrib.inspect}\n"
# lookup the dictionary definition of an Function Module
fds = conn.discover("STFC_DEEP_STRUCTURE")
$stderr.print "Parameters: #{fds.parameters.keys.inspect}\n"
# create an instance of a Function call
fs = fds.new_function_call
# populate the parameters - structures and table rows now take hashes of field name/value pairs
fs.IMPORTSTRUCT = { 'I' => 123,
'C' => 'AbCdEf',
'STR' => 'The quick brown fox ...',
'XSTR' => ["deadbeef"].pack("H*") }
# execute the RFC call
fs.invoke
$stderr.print "RESPTEXT: #{fs.RESPTEXT.inspect}\n"
$stderr.print "ECHOSTRUCT: #{fs.ECHOSTRUCT.inspect}\n"
Config file (refer to the sap.yml file in the download):
ashost: ubuntu.local.net sysnr: "01" client: "001" user: developer passwd: developer lang: EN trace: 2
Test it out - and give your feedback.
Perl Examples
As with Ruby, there are plenty of examples in the software download in the t/* directory. Again - here is a taster showing the new API:
use sapnwrfc;
use Data::Dumper;
# specify a YAML base config file or pass connection
# parameters directly to rfc_connect()
SAPNW::Rfc->load_config;
my $conn = SAPNW::Rfc->rfc_connect;
# lookup the Function Module
my $fds = $conn->function_lookup("STFC_DEEP_STRUCTURE");
# initialise a call instance
my $fs = $fds->create_function_call;
# set the parameters
$fs->IMPORTSTRUCT({ 'I' => 123,
'C' => 'AbCdEf',
'STR' => 'The quick brown fox ...',
'XSTR' => pack("H*", "deadbeef")});
# invoke the Function Module and then play with the results
$fs->invoke;
$stderr.print "RESPTEXT: #{fs.RESPTEXT.inspect}\n"
$stderr.print "ECHOSTRUCT: #{fs.ECHOSTRUCT.inspect}\n"
print STDERR "RESPTEXT: ".Dumper($fs->RESPTEXT)."\n";
ok($c eq 'AbCdEf');
print STDERR "ECHOSTRUCT: ".Dumper($fs->ECHOSTRUCT)."\n";
# cleanup
$conn->disconnect;
Config file format is the same as for Ruby - refer to the sap.yml file in the download:
ashost: ubuntu.local.net sysnr: "01" client: "001" user: developer passwd: developer lang: EN trace: 2
Test it out - and give your feedback. The best place would be to carry on the discussion through the Forums.
Special thanks go to:
- Ulrich Schmidt for fielding all my questions, and the whole of the NW RFC Team (NW AS ABAP Connectivity), for their support, and quick response.
- Olivier Boudry - building and testing
- and lastly (but by no means least) Craig Cmehil for tirelessly getting people together and making it all possible.
Notes/Updates:
See the download instructions for the SAP NW RFCSDK here.
Posted by PiersHarding at 12:28 PM
November 11, 2006
RFC_STRING and RFC_XSTRING type support for saprfc for Ruby
Support for string types now available in saprfc for Ruby from version 1.52. This opens the way for interaction with RFC calls that require variable length storage eg. true strings in either character or binary form. This was particularily useful for manipulating logon tickets, as shown by this example:
isusr = rfc.discover("SUSR_CHECK_LOGON_DATA")
isusr.AUTH_METHOD.value = "E"
isusr.AUTH_DATA.value = "p:ompka\\piers"
isusr.EXTID_TYPE.value = "NT"
rfc.call(isusr)
puts "RESULT: "
# access an interface parameter value
print "TICKET: #{isusr.TICKET.value.to_s}\n"
ticket = isusr.TICKET.value.to_s
rfc2 = SAP::Rfc.new(:ashost => "192.168.1.2",
:sysnr => 00,
:lang => "EN",
:client => "010",
:mysapsso2 => ticket,
:trace => 1
)
This code snippet demonstrates using one RFC connection to generate login tickets for another - a very useful trick for brokering connections within an external application. The login tickets in the standard RFC are carried in an RFC_STRING (isusr.TICKET) type parameter.
Note: Thanks to Gregor for pointing this out.
Posted by PiersHarding at 11:00 AM