Skip to Content

Making SAPConnect-oids with Perl

Recently I had to rebuild a faxing solution that we had in the office, as the necessary SAPComm support disappeared after 4.6x. What we were doing before was hijacking the spool process, by creating a dummy printer that was really a perl program. The program parsed the (PostScript) print output to find the recipient details (embedded variables in the standard SAP Header page) and parceled it up as a fax (using GhostScript)that was then duly emailed (or rather UUCP’ed) to AT&TMail and their EFax solution. This enabled us to have one central faxing solution for the entire Global company – all centrally managed, billed etc.

Anyway – with the demise of our 4.6c system, and upgrade to Enterprise, I needed to couple these things together in a different way, and that way was SAPConnect. SAPConnect (admin transaction SCOT) allows the processing of various address forms – external email, faxing, paging, and print-to-email printing etc., which can be handled by various 3rd party products that coupled together via a registered RFC interface – ANY old Registered RFC! At this – I thought, wouldn’t it be great to write a little Perl based RFC server that picks up the SAPConnect messages and passes these onto AT&TMail. And then a little later I thought “hey – if you could write RFC servers in Perl, then you could reformat SAPConnect messages and send them ANYWHERE on ANY PROTCOL you choose! – how cool!”.

What you need to do

For your Perl based registered RFC server you need to:

  1. create a TCP-IP logical destination in transaction SM59, specifying the name (TPNAME – goes in the “Registered Server Program – Program ID” field) that you will give to your reg.RFC to dial into the gateway on.
  2. configure transaction SCOT to syphon off a particular address range, specifying the above created RFC destination (not the TPNAME). The easiest thing to test out is setting up a specific email address range that you can send to from SAP Office.
  3. write and run your reg.RFC program in Perl – this is an example to get you going.

Note: my environment is RedHat 9, Perl 5.8.0, and SAP::Rfc 1.30 – you can get this from CPAN at

Once you have kicked off the reg.RFC server (modifying the startup parameters if you are using my example, and specify the TPNAME defined in (1) above), fire off a message that will be picked up by SAPConnect eg. run a report and then choose from your menu – System -> List -> Send, fill in the address details and press Send.

Note: In Enterprise (4.7) there is the ability to test out the conectivityof your reg.RFC with “Connection Test”, and “Status Trace” under the individual nodes config.

After this – the message should now be stored within SAPConnect – you now need to trigger the actual sending process. Go to transaction SCOT, and select the “Start the Send Process” button. Specify the address type that you configured the address range in (INT for internet Email), and let it rip!

Note: the send process can also be scheduled as a periodic batch job to do this automatically – see transacton SCOT for this.

At this point, you should see the message come through to your registered RFC program. If you are using my example, then it will print out the entire contents of parameters passed through to the reg.RFC – including the details about the sender, receiver, and message contents.

Happy Hacking!
Piers Harding -JaSH.

You must be Logged on to comment or reply to a post.