So I’m a PHP developer and my company runs SAP now what?
So you’re a PHP developer and your company is running SAP, the problem though is you have no clue about SAP or what it does – you are curious though. The following are a few tips on making the cross over from building web applications to building SAP based web applications using PHP.
I won’t pretend to be an expert on how things work in the corporate/enterprise world nor will I even attempt at telling you how to do something inside your company. What I intend to do is is give you some tips/suggestions on approaching your SAP administrative team and ABAP developers in order to get you started.
Ok so let’s get some basics out of the way and then move into some possible secanrio’s on getting started.SAP is easy to describe but at the same time it is not easy to describe, it started back in the 70’s with R/1, followed then by R/2, then R/3 which is still in use quite a bit. The newest version of SAP software runs on the SAP NetWeaver platform. SAP also has it’s own programming language called ABAP.
Now the first step in getting started is find out what version/release of SAP your company is running, be prepared there could be multiple different versions and releases running. Perfect group to ask are those who setup, maintain and monitor your systems which is usually the administrative group, although the ABAP developers will know as well. For you as a PHP developer it’s very important to know what is running because it will determine with which means you can connect to the system.
4.0B – 7.0 (NetWeaver 04s) you can use RFC connections through the SAPRFC connector for PHP.
6.40 – 7.0 (NetWeaver 04s) you can use Web services
6.20 – with the help of a BSP (Business Server Page) application you can also use Web services.
Now that you know what version and release of the system you have available (let’s say 4.6C) then you can move forward. The next question to ask is if you can have a user on one of the development or test servers. Let them know you are only wanting “read” access and will not be changing any data, the user will need the proper access rights for RFC connections and the calling of ABAP Function Modules (FM’s for short) and BAPI’s (these are complete interfaces written for remote access). Most SAP landscapes inside of a company consist of the Development – Test – Production servers, applications, coding, modifications, etc. are made in the Development server and then “transported” (transaction STMS) to the Test server. Once they are checked out they are then “transported” to the production server.
Remember you won’t be accessing the tables in SAP directly like you would in other applications but rather through these FM’s and BAPI’s. These are written with ABAP and so if you have questions about them be sure to ask your ABAP development group.
Now if you are on a Windows platform then you have all the information you need for getting started provided here or even better here. For those of you on a Linux platform you will need to do a few things. One of which will be to get the RFCSDK from SAP which is usually available on the SAP GUI CD or from the SAP Service Marketplace, you will also need the SAPRFC connector for PHP. The instructions are contained within the downloads for installing, I hope to provide a Linux based development environment in the future.
Also I would suggest installing the SAP GUI (Java version is available), once you have a login to your system you will be able to use the GUI to login. To login though you will need to create an entry into your GUI (might already have one) this entry will also give you most of the information you need to login into the system using PHP.
The System ID or SID is the system identifier and it’s unique to each system, the system number is a number which designates the ports/services for communication and ranges from 00 to 99, and of course the application server is a hostname or IP address to the actual system in your netwwork.
The other key piece of information is the “client”, each SAP system has multiple clients and they are for different purposes or for different groups. Some data exists across all clients and some is specific to each individual client, so it is important to know which client you should be working with as you may not find the data you need if you are logged into the wrong client. You will enter the client on the login screen.
In the top left corner is a input field where you can type in “SE37” which is the transaction for ABAP Function Modules. Here you will be able to find your FM’s to play around with – easiest to find are the “BAPI” ones. Simply type “BAPI*” into the box and press your F4 key which will bring up the search box, or you can just use the examples I have provided in my previous entry.
That all seemed rather easy, it’s the getting to this point which is usually the problem. There are so many things happening inside of a SAP system that the system administrators are often overly protective of allowing someone access especially by applications not running within the system where they can easily monitor and troubleshoot should something happen. In this case it might be a good idea to show a friendly interest in the whole setup, this will of course help you to understand what is there and let you appreciate their caution in terms of security for the system, I mean maybe your personal data is in there so it’s in your best interest as well to observe and cooporate with the security policies.
Share your application coding with them show them that you are simply calling the FM or BAPI and nothing more, let them sit with you as you make your first connection to the system
// Create saprfc-instance
$sap = new saprfc(array(
"ASHOST"=>"localhost" // application server
,"SYSNR"=>"00" // system number
,"CLIENT"=>"000" // client
,"USER"=>"bcuser" // user
,"PASSWD"=>"minisap" // password
,"show_errors"=>false // let class printout errors
,"debug"=>false)) ; // detailed debugging information
// Now echo status
Once you run that piece of your PHP code, ask them to show you the transaction “al08” in the system, this will show you “logged into” the system and they will see it and see what you are doing, that worry about not being able to monitor should be eliminated now.
Hopefully at this point they will be interested enough at how easy it was, to watch you pull the user list provided in my previous example.
Another possible way of getting started is to go through the ABAP development group, they are developers just like you they just happen to have a different platform that they work on.
Show them your code, and how PHP works, ask if you could try connecting to the SAP system – do so by building a login form in PHP and allow them to actually dynamically login. Find out some of the applications they are working for “reporting” data and see if they might be interested in showing that data inside of a web page instead of ABAP Report (transaction “se38”). Offer to show them some of the examples you have (see previous entry), see if they might be interested in doing something together with you, you’re going to eventually need their help with the ABAP side anyway.
Team work is the key.
More examples to come…