Hi, my name is Pascal and I am a SAP & Supply Chain specialist. I work for PLAUT and I do things others can't.
This blog only contains my personal views, thoughts and opinions. It is not endorsed by my employer nor does it constitute any official communication of PLAUT. You can contact me via email at pascal[at]renet-web.net or use the contact form that you will find by following the 'Contact' link and you can follow me on twitter here.
Posted on April 28, 2006 | Category: SAP
[country-filter code="in" display="0"] This is just a quick update to my previous post in which I dealt with using the BAPI (Business Programming Application Interface)
QkFQSV9NQVRFUklBTF9HRVRMSVNU
. This update does not change – greatly – the code that makes the rfc (remote function call) call itself. It now gives you the possibility to fill in a form where you can input the number range for which you want to run the query, i.e it is no longer hard coded in the script. You also have to bear in mind that this is ‘quick and dirty’ code. I.e it assumes that :
As I indicated in my previous post, the BAPI seems to work better if you parse numbers that occupy 18 positions. I.e if you type
MjAw
, then it is
MDAwMDAwMDAwMDAwMDAwMjAw
that has to be passed to the query. The script will therefore take whatever number you type in and transform it so that it obeys that rule (left fill with 0 – zeroes).
If on the other hand, in your system you have material masters that are a mixture of numerical and alphanumerical numbers (ot just alphanumerical values), then you will need to change the code in order to deal with those occurences. In other words, just get rid of the following lines or add your bit of code to handle various formats:
DQovLyBzZXQgbnVtZXJpY2FsIHZhbHVlcyB0byAxOCBwb3NpdGlvbnMNCi8vIFRha2UgbGluZXMgYmVsb3cgb3V0IGlmIE1BVE5SIGlzIG5vdCBOVU1FUklDQUwNCiAgICBmb3IgKCRpID0gMCA7ICRpID0gKCRtYXRudW1sZW5ndGggLSBzdHJsZW4oJG1hdG5ybG93KSkgOyAkaSsrKSB7DQogICAgCSRtYXRucmxvdyA9ICIwIiAuICRtYXRucmxvdzsNCiAgIAl9DQogICAgZm9yICgkaSA9IDAgOyAkaSA9ICgkbWF0bnVtbGVuZ3RoIC0gc3RybGVuKCRtYXRucmhpZ2gpKSA7ICRpKyspIHsNCiAgICAJJG1hdG5yaGlnaCA9ICIwIiAuICRtYXRucmhpZ2g7DQogICAJfSAgIA0K
In this script the plant also becomes a variable. I.e you can select it in the form prior to running the query. The plant code is however ‘hard coded’ in the html form (and I think that this is acceptable as you do not add a plant every day). As example plants I have coded Hamburg, Paris and New York. Selecting on of those will respectively parse the values 1000, 2000 and 3000 to the query.

If you need to change this to suit your environment, just amend the following lines in the script:
DQo8b3B0aW9uIHZhbHVlPSIxMDAwIj5IYW1idXJnPC9vcHRpb24+DQo8b3B0aW9uIHZhbHVlPSIyMDAwIj5QYXJpczwvb3B0aW9uPg0KPG9wdGlvbiB2YWx1ZT0iMzAwMCI+TmV3IFlvcms8L29wdGlvbj4gICANCg==
Once you execute the query, the system will simply return a couple of lines indicating the values that it passed to the query and if it finds any, the material numbers corresponding to your search.

As usual, the code is released under Creative Commons License:
![]()
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.
You can grab the code here. If you can improve on this code (which should not be too difficult), give back to the community and post your findings. Comments and suggestions are also very welcome.
[/country-filter]
[country-filter code="in" display="1"]
This content is not available on your region.
[/country-filter]
» Filed Under SAP
May 13th, 2006 at 6:34 pm
[...] Don’t let the title fool you, I’m not quite there yet. I’ve already written a few posts that dealt with integrating SAP and PHP (which you can find here and here to get you started), but I thought it was time to take it to another level. So what I’ve done here is to try and build a portal of sorts and bundled together scripts that will allow one to perform various request to a SAP system. All the scripts I’ve written so far deal with material masters in one way or another. [...]
July 31st, 2006 at 9:05 pm
the link of the files is broken can you fix it. thanks :D, I’d really want to learn about php sap.
regard
August 10th, 2006 at 12:26 pm
Hello Farid,
Thank you for your interest in the code. The link to the code has been broken on purpose. I always get people asking me for the code, but no one ever gives back to the community. Until that changes the code will remain offline.