Controlling SAP from the linux command-line

I'm currently writing a program to automate the setup and configuration of a complex linux/SAP/benchmark system on a three-system setup (DB/BW/benchmark driver)

I can do just about everything with standard Linux commands, but at one point, I needed to run a BW process chain.

Not easy from within a program - especially since it's a naked BW installation, so I couldn't set the chain to run on event and then create a file in some directory (or some other ugly hack)

So what to do?

The answer as usual comes from SAP themselves. They provide a NetWeaver SDK, with a sample program called startrfc. It allows you to run one of two function modules (EDI stuff, of no interest to anyone), passing parameters.

A handful of code changes, a quick SAP Notes search to find the appropriate gcc commands to rebuild, another search to find some specific perl file used in the compilation, and bam...a new linux command which allows me to run the RSPC_API_CHAIN_START function module, passing the name of the chian I want to run.

Game over, I win