NetWeaver RFC gives the Next generation Ruby and Perl Connectors
SAP has undertaken a project to re-engineer the RFC SDK (creating the SAP NetWeaver RFC SDK), which is good news for the Connectors (RFC APIs).
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 through the comments, ensuring that I know how to contact you, and what your platform requirements are, and with the help of the NW RFC team I will get the relevant details to you (Please see notes below).
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} "
# lookup the dictionary definition of an Function Module
fds = conn.discover("STFC_DEEP_STRUCTURE")
$stderr.print "Parameters: #{fds.parameters.keys.inspect} "
# 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} "
$stderr.print "ECHOSTRUCT: #{fs.ECHOSTRUCT.inspect} "
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} "
$stderr.print "ECHOSTRUCT: #{fs.ECHOSTRUCT.inspect} "
print STDERR "RESPTEXT: ".Dumper($fs->RESPTEXT)." ";
ok($c eq 'AbCdEf');
print STDERR "ECHOSTRUCT: ".Dumper($fs->ECHOSTRUCT)." ";
# 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 /community [original link is broken].
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.
More recent Notes:-)
SAP has released the official NW RFC SDK. For more details read SAP NW RFCSDK – it’s here!.
Notes/Updates:
The permanent home for the NW RFC SDK is now:
http://service.sap.com/patches
-> Entry by Application Group
-> Additional Components
-> SAP NW RFC SDK
-> SAP NW RFC SDK 7.11
-> SAP NW RFC SDK 7.11
Greetings,
Blag.
I will be happy to help testing. I can test doing some Ruby on both NW04 and NW04s. I will need the Windows RFC SDK.
-ewH
For keeping your eye on the REAL ball, much congratulations and gratitude should come your way.
Often times, what advances IT (or a particular company) is NOT new technology tricked-out in whatever buzzwords and bling happen to be in fashion.
It is new technology stripped to its unglamorous essenatials.
Of course, it is also to SAP's credit that as a company, it recognizes the need to deliver unglamourous technology as well as the rest of the glam stuff cluttering up SDN and too many other web-sites.
Regards
djh
awesome!!
I am looking forward to dive into it.
I am working with an IDESPortalNWDH (EP 6.0 NW04) and have a windows machine.
(stefan.huettenrauch@sap.com)
Thanks for everything
Stefan
The new SAP NW RFC SDK will be delivered through the usual official channels (SAP Market Place) soon (hopefully in the beginning of Q2, but please don't take this as a "legally binding statement"...).
For now there are pre-release versions available for download via SAPMats container. During the ramp-up phase the following 7 platforms will be supported: Windows x86 32bit, Windows x86 64bit, Windows Itanium, Linux x86 64bit, Solaris SPARC 64bit, HP-UX PA-RISC 64bit and AIX 64bit.
The following OS releases have been used for compiling/testing the SDK: Windows 2003, SuSE SLES9, RedHat EL4, Solaris 10, HP-UX 11.23, AIX 5.3. (Others may be ok, except for two: Windows Vista and SuSE SLES10. There are just too many incompatibilities compared to Win2003/SLES10 respectively. So please don't try these yet, they will most definitely lead to problems.)
So for all of you volunteering as testers for Piers' Ruby and Perl Connectors: check the download links at the end and have fun!
If you have trouble compiling the Connectors on the Unix Platforms, Piers and me will certainly try to help you.
I also want to thank Piers for making this happen! He really put in a lot of determination and hard work! Originally we only planned to do the Ruby Connector, but then he "caught fire" and did the Perl Connector as an "encore"...
Thanks a lot!
Ulrich, RFC team
______________________________________________
nwrfcsdk_win_x86_32.zip 6188986 byte
https://sapmats-de.sap-ag.de/download/download.cgi?id=TI7VTUFNCADPPHVYFW0CBQH6DNRHEJW7UBSAZLM0B0YGQO6HWI
nwrfcsdk_win_x86_64.zip 6605960 byte
https://sapmats-de.sap-ag.de/download/download.cgi?id=ZG4NY7NFDMY1PH53BQOQASSFCZ60ZQMX1DUFQUC34ZG4JEXZ4O
nwrfcsdk_win_itanium_64.zip 7926295 byte
https://sapmats-de.sap-ag.de/download/download.cgi?id=6QUX96UFYLMP9YSCTIR0XN8MK2I93PRKWDK3QM11KJ7Z89HDSF
nwrfcsdk_sun_sparc64.zip 9550190 byte
https://sapmats-de.sap-ag.de/download/download.cgi?id=GRXV7IUJT87E4VODPKUCA7YGUSF065LU6C39K5E90Q14XWV4T6
nwrfcsdk_hp_parisc64.zip 12450563 byte
https://sapmats-de.sap-ag.de/download/download.cgi?id=G45LDHIRKZ7CKYP2T3LSR4F9NGW2ZMDSYFMWNGDZJOG2EO1ZRQ
nwrfcsdk_linux_x86_64.zip 12884211 byte
https://sapmats-de.sap-ag.de/download/download.cgi?id=JE0XUKENDS1YCAOOFFLOMEZ3BJLQIHJM33DCN1G2JWJ11N9REK
(AIX is still causing a bit of a problem at the moment, but I will provide the last missing link as soon as we got it to compile...)
https://sapmats-de.sap-ag.de/download/download.cgi?id=6SMDW9FYE8LAXAZAHEPAKYPYU11CVLAV86XU00SY1T24NQ9IKL
Cheers.
I think Python maybe picking up a bit of traction, because of Perl6 issues with Perl, and the fact that it is used by some high profile outfits such as Yahoo, and Google.
So- yes - Python is in the pipeline - but I've got my hands full with Ruby, and Perl, and looking for a new job at the moment.
Cheers.
Cheers.
Is the Python implementation available?
Eventually these will all be replaced with the proper product download links.
Cheers.
$p = 8000000324; $rc->PARAM{$p}; # Bad
<>; m/\d+/; $p = $& $rc->PARAM{$p}; # Bad
$p = '8000000324'; $rc->PARAM{$p}; # Good
$p = 8000000324; $p.=''; $rc->PARAM{$p}; # Good
It's likely to be converted automatically, because every string might looks like a number.
PS. Thanks for a great job.
Cheers.
Inexperienced perl's user as a rule does not know, that string literal '11' implicitly converted to int. And perl does not destine to surcharge one.
Experienced user should always add a trick conversion .'' for every CHAR argument, because, if a string looks like a number, perl every time converts it to INT. While loading data provided by user input or a file, we must not expect that every string contains at least one non-digit.
So, in my opinion, it natural to check and convert types in connection.dll. At least INT to CHAR. It costs just a few if clauses but gives a real comfort fot users.
Cheers.
Nevertheless concerning NUMC ABAP type it's true, because validating user or file input with /\d+/, result gets type IV and one needed to convert it back to PV before using with the module.
Excuse me for insistence, but converting INT to CHAR will never cause an error or any kind of mistake, as well as INT to FLOAT.
Cheers.
Just the same way INT converts to FLOAT by the SvNV().
Converting INT to NUMC is left padded with zeros. AFAIK, there is no corresponding function in perl API. It needs special, but quite simple, handling.
On the contrary, providing CHAR for a NUMC argument of an RFC f.m. is possibly erroneous and may raise an exception.
Any conversion should cause an exception in case of data length overflow. E.g. converting INT > 99 to NUMC(2).
But why not to convert CHAR to INT when it possible and raise an exeption otherwise? If a perl user have had declarative tools to keep a variable strictly typed and to perform explicit convertion, I'd agree with you. But preventing implicit conversion from pure numerical CHAR to INT in perl doesn't improve safety but just complicate perl code.
In any case, a perl user will always use $_.='' for char arguments and $_+=0 for integer. And it's has almost the same effect as an implicit conversion, let alone additional runtime warnings before RFC call fails.
On the other hand, I'm agree that while adding .='' and +=0 a user will be obliged to take a look on a f.m. interface definition. And these additions leave traces of argument types and plays role of type declaration that missed in perl syntax.
Well, it's rather philosophic issue.
Cheers.
I am developing a small rails applications; I dont want to store userid/password in the yml file but would like to get it from user and connect; how do I do that? I tried using SAPNW::Base.rfc_connect(with parameters like :user => "XXX") and it does not work
Any help is appreciated
thanks
Cheers.
thanks for the information, but the download links are expired.
Matthias
Cheers.