Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

ajt (2546)

  (email not shown publicly)

UK based. Perl, XML/HTTP, SAP, Debian hacker.

  • PerlMonks: ajt []
  • Local LUG: AdamTrickett []
  • Debian Administration: ajt []
  • LinkedIn: drajt []

Journal of ajt (2546)

Thursday June 10, 2004
04:29 AM

Perl SAP Integration

[ #19177 ]

Since being moved from marketing back to IT/SAP I've been working on a new, interesting and exciting project. We have a web enabled SAP process that uses the SAP Business Connector (BC) Server as it's middleware layer. While it's fair to say that we didn't use it in the best possible way, it's still a steaming pile of Java cow poo.

Basically I'm writing a simple application server in Perl, that uses the SAP::Rfc module to communicate with SAP at the backend, and some templating module (probably TT2) to generate xhtml pages at the front end. It uses configuration files to control behaviour, and has virtually no business logic in it. So far I've written about half of the core module, so I can now process input forms, deal with sessions, put things in the right SAP input structures, and call SAP. It's all nice OO stuff, with plenty of error handling and lots of tests.

It's not quite XP, but I'm doing my best to write documentation and tests as I go along. It's proving very easy to write. I start to add a new method, document it, write tests, make sure they are okay, amend other methods, add more tests, make sure that's okay, then add more code to my method, and add more tests and so on. Mostly it's been a dream, mostly tests pass first time, and even some of the hard bits pass first time.

Test driven development is one of the things I'm now a clear convert in favour of. I know it's not a panacea for all development, but it's a very powerful technique, and well worth thinking about.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Is there a possibility of open sourcing your work? It sounds really interesting. For a school project I developed a framework to integrate BAPI with JavaBeans and eventually Struts. It's much easier to use than what you get with NetWeaver, but I pobably missed at least 1 Million special cases :)

    • One never knows! Previous attempts to get the company to approve open sourcing code fell on deaf ears.

      It's really DEAD simple. You have a global configuration file that tells the AppServer where SAP is, and basic stuff like that. Then for each RFC enabled BAPI you want to do something with, you create a BAPI config file, which tells the AppServer which fields to scrape via CGI and how to build up the SAP input structure. It then runs the RFC enabled BAPI via SAP::Rfc, and then using TT2, it merges the SAP

      -- "It's not magic, it's work..."
    • What I did is write a code generator for Java (in Perl, obviously :) that gets a configuration file for each SAP-Table you want to deal with:

      COUNTER        CHAR

      The generator produces a java bean that holds the data and a decorator around the JCO.Table that comes out of SAP that converts between the bean and JCO on the fly. The interface is not bound to a technology, could be HTML or Swing, but you have to do it yourself.

      We had a competition against 3 peopl

      • Interesting. I considered auto-discovery type stuff but went instead for a xhtml->config->sap->TT2->xhtml model. Making the input xhtml requires some knowledge of the SAP input structures, but you can't make a xhtml page without knowing what shape the data is when you put it in. The config stage does a screen scrape, and puts things in the correct tables and inputs. Calling SAP via the RFC module is the easy bit. Finally I plan to merge the config selected template with the SAP output structure

        -- "It's not magic, it's work..."