12-13-2004 11:14 AM
Hello techies..
I want to call one RFC in PHP, RFC being defined in SAP system.
Can anyone just guide me.. or sample code will help
Regards
Sriram
12-13-2004 11:29 AM
Well,
I'm using this approach to call RFC from an ASP (or J/VBScript). You should check SAP DCOM Connector (if it's a Windows platform at all). After creating a DCOM object with your RFC FM as its method, you could call it in a way DCOM objects are called via any script language - including php.
HTH
Ivaylo
12-13-2004 11:29 AM
Well,
I'm using this approach to call RFC from an ASP (or J/VBScript). You should check SAP DCOM Connector (if it's a Windows platform at all). After creating a DCOM object with your RFC FM as its method, you could call it in a way DCOM objects are called via any script language - including php.
HTH
Ivaylo
12-13-2004 11:49 AM
thnx
But itwould be of great help if u explain bit more
Regards
Sriram
12-13-2004 12:33 PM
Ok,
I'll try to explain it further:
1. Creation of DCOM object - it's quite well explained in SAPHelp 'DCOM Connector Logon Component'. You should also install DCOM Connector component from your SAPGui. After installing the component and following the docu and the link 'SAP Frontend->Development Tools->DCOM Connector' you should have an HTML page opened with quite a lot of info related to DCOM. Creation of a new DCOM object is possible following the links in this 'page' > 'Components -> Object Builder'. You should log-in to your destination SAP system where your RFC module/s is/are. (note - if my memory doesn't betrades me, there was some clue with a user > it should be RFC-enabled, or something like that - check possibilities for user creation).
2. After successfull login via 'DCOM Connector Object Builder' select RFC Functions instead of BAPIs, put your wildcard to get list of your RFC-FModule/s.
3. Follow the docu related to creation of the DCOM object further. As a result you will have few C resource files with defined methods and class/es of your DCOM object/s, which need to be compiled to dll-s. This all is related to creation of the DCOM object - and to the support tools supplied by SAP with your SAPGui to do that.
4. How to check if your DCOM works? You need first to have this DCOM working in your COM environment (check Microsoft Component Services -> and components under 'My Computer' - there should be a COM+ Application with you DCOM object just defined). Next, you should call the point (well, method) from your DCOM object with respect of SAP logon information from your PHP (whatever) code and to pass/retrieve needed information.
Just to be clear - I do not supply any sample code, because:
1. It's ASP, and highly modularizated - in a several different files.
2. My DCOM environment is broken from some time (well, that'a another issue, related to MS ), and I don't want to supply you a piece of code, which would possibly be with misleading mistake.
Finaly, it's closely depending on your environment - something I have in my envy may not work in the same way in yours. You should check related docu and examples (there are a few).
HTH
Ivaylo
P.S. One specific: In order to compile dll-s you should have VisualStudio 6, it would generate a make-files for your dll-s.
Message was edited by: Ivaylo Mutafchiev
12-13-2004 1:00 PM
Hey thanx a lot Mr.Ivaylo Mutafchiev
Calling Bapi is different from calling an RFC? i think its same right.. i'm just a beginner in this field.. so pls bare with me
Regards
12-13-2004 1:16 PM
Hi,
calling BAPI is not different from calling RFC - usualy BAPIs are RFC enabled FM (RFC-FM in other words), but, I can't say why, DCOM connector distinguish them when you try to create a DCOM object - perhaps it's some internal logic - there are a lot of guru-s at this forum, it would be interesting to find out what do they think
Regards,
Ivaylo
12-15-2004 4:39 AM
You might want to refer this as well:
/people/sap.user72/blog/2004/06/17/php-and-sap-together-at-last
Regards,
Subramanian V.