If things always went to plan, I guess I would now be writing part 2 and not 1.5! The truth is, I’ve had so many ideas lately that I just had to test them out and so this is how 1.5 came to be. In this post I’m going to show you how I used PHP/SAP/PEAR/AJAX together to come up with I’m sure you’ll agree, a pretty cool result.

To set the scene this is what will be shown:

  • We will first call a PHP script that uses BAPI BAPI_PRODORD_GET_LIST to retrieve a list of SAP production orders.
  • As time goes by the amount of production orders that live in a system can be quite staggering and I didn’t want to bombard the user with thousands of production orders in one go. To solve that problem I’m using PEAR, to be more specific I’m using the Structures_DataGrid package to setup the paged navigation and render the data in html format (I highly recommend this package as it takes care of everything for you and you can even style the output as you want it)
  • Once we have the data output (a list of production orders) we will then want to see a bit more detail for a chosen production order. This is where AJAX comes in. We will make an asynchronous call to another PHP script that calls the BAPI BAPI_PRODORD_GET_DETAIL.
  • The result of that AJAX call, is that the current page (or part of it) will be refreshed with new content. The content will be detailed production order information.

If you can’t wait to read this post to the end, I’ve recorded a small flash animation that demonstrates exactly what I have outlined above. The animation can be viewed here (Give the file time to load as it makes approx 4.8Mb).

So we start out with a list of orders:


Clicking on the detail icon will reveal detailed data about the production order:


Finally we’ve added an image which shows an overlay of:

  • The list of orders
  • The order detail showing the operations and the components of the order
  • A screenshot of the operations (in SAP)
  • A screenshot of the components (in SAP)


What? No code? do I hear you say. Well as there are very rarely comments made on the code, I’m not going to bother including any in this post – it’s up to you to change that….

As usual these tests have been made using an HP (Compaq nc6220) laptop running on MS Windows XP Pro, the Apache server version 1.3.33 and the PHP scripting engine in version 4.3.10 and of course the SAPRfc library (the Apache/PHP install was that installed via the EasyPhp package). SAP side I was using SAP ERP ECC (ERP Central Component) 5.0. I also used the script.aculo.us javascript libraries. You can download them here.

Privacy Preference Center