Re: [Pysaprfc-users] Need some help for writing a simple SAP interface using pysap
Brought to you by:
klvon
From: vivek k. g. <gup...@re...> - 2006-08-07 09:26:07
|
Thanks for helping me out. There are some more things where I am a little b= it confused. I will be grateful if you can help me out in that. There are s= ome points where I fell I need some more help.=0A=0A1. On my machine if I a= m not having SAP GUI installed then also is it possible to connect to SAP a= nd act as a RFC Server ?=0A2. Do I need some other information (e.g. some i= ni file, some parameters to be passed to RFC Server) for server to work?=0A= 3. Do I need to run my python RFC Server exe file in advance so that SAP RF= C client can use it? Or the SAP RFC client will invoke my app automatically= ?=0A=0AI have also gone through the help available on net for setting up a = SM59 RFC connection, from pysaprfc site and other sites also. In my case as= I don't have SAPGUI on my machine then most probably on SAP SM59 it needs = to be registered as __explicit host__ . Please correct me if I am going wro= ng here. And AFAIK in general to work as a server the application need to b= e already running and listening to incoming connections or the client shoul= d know the path from which the server application has to be started. So, I = just want to know whether is it necessary to have SAP GUI installed and con= figured on my machine before it can host the RFC Server application? Actual= ly I just want to prepare myself before negotiating with this proposed clie= nt.=0A=0AThanks and Regards,=0AVivek Kumar=0A=0AKlavdij Voncina wrote:=0A> = You definitely need access to a SAP system to test your application. The li= brfc32.dll alone is not enough. In order to call a function defined in SAP = you need at least connection settings (IP or name of the host, and system n= umber) plus username, password and client number. In the simplest and most = often case the connection string is something like 'ASHOST =3D <ip or hostn= ame of SAP system> SYSNR=3D<system number> CLIENT=3D<client> USER=3D<userna= me> PASSWD=3D<password>'.=0A> In case of a server function (as in your exam= ple) the connection should be defined from SAP system using transaction sm5= 9 as described in SAP documentation.=0A> If I understand your situation cor= rectly your client gave you librfc32.dll but you don't have access to their= system. In that case you should negociate access to their test or dev syst= em in order to be able to test your app. The example you sent should work i= f SAP system is accessible and configured properly (sm59).=0A>=0A> Best reg= ards,=0A> Klavdij=0A>=0A>=0A>=0A> =0A>> Dear All, Recently I am given= a task to try interfacing with SAP R/3=0A>> using RFC. The task is as foll= owing..I have to write an app which should be=0A>> able to call a simple fu= nction in SAP and show the output on screen. Also=0A>> the SAP should be ab= le to call a simple function in this app.As I have no=0A>> previous experie= nce of SAP I was very nervous. I googled for the options=0A>> available for= interfacing and found pySAP, .net connector and JCo while=0A>> searching f= or interfaces. In my organization as most of the work is on=0A>> windows pl= atform so noboy here uses any open source languages. I have some=0A>> prior= experience of Python and I thought it will be a good chance to push=0A>> i= t in my organization. I somehow managed to convince my pm that this job=0A>= > can be done in python. Now let me tell you what softwares I have availabl= e=0A>> at my hand..OS : Windows XPPython : version 2.4.3ctypes : version=0A= >> 1.0.0pysaprfc : version 1.0.0mxdatetime : version 2.0.3We don\'t have a= =0A>> license for SAP but I somehow managed to get librfc32.dll from the cl= ient=0A>> (possibly, if this test app is through :) ) the version for= =0A>> librfc32.dll is 4640.5.378.3114. I created two simple scripts after r= eading=0A>> the documentation. Here is the code for the simple server=0A>> = function..------------------------------------------import pysapimport=0A>>= sysclass SAP_RFC_SRV(pysap.RFC_SERV_FUNC): =0A>> _name_=3D\'ZTE= ST_ABC\' =0A>> _importing_=3D[(\'Strdata\',\'C\',10)]  = ;=0A>> _exporting_=3D[(\'Msg_reached\',\'C\',1)] def=0A>= > run(self,handle): print \'Message Fro= m=0A>> Sap : \',self[\'Strdata\'] =0A>> = self[\'Msg_reached\']=3D\'1\'srv=3Dpysap.RfcServerEx()try: =0A>>= srv.register_func(SAP_RFC_SRV) srv.main_loop(sys.argv)except= =0A>> pysap.SapRfcError,E: print \'Error returned while trying = to=0A>> register sap rfc server...\',E raw_input(\'Press any ke= y to=0A>> exit...\') sys.exit(1)----------------------------- I= even=0A>> created an exe from the script using the py2exe after reading a = previous=0A>> post on mailing list dated 2005-08-31. But still when I run t= his exe I=0A>> still get this \'connection failed\' message.Is it neccessar= y to have a=0A>> running SAP server to run this server app or is there some= thing I am=0A>> missing? Also, do I have to create some ini file for this s= erver to work?=0A>> Please help me as this is my only chance to get some wo= rk in Python after=0A>> more then 2 years :( and I definitely don\'t want t= o miss it.THX and=0A>> Regards,Vivek Kumar=0A>> =0A>=0A> --------------= -----------------------------------------------------------=0A> Take Survey= s. Earn Cash. Influence the Future of IT=0A> Join SourceForge.net's Techsay= panel and you'll get the chance to share your=0A> opinions on IT & busines= s topics through brief surveys -- and earn cash=0A> http://www.techsay.com/= default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDEVDEV=0A> ______________= _________________________________=0A> Pysaprfc-users mailing list=0A> Pysap= rfc...@li...=0A> https://lists.sourceforge.net/lists/lis= tinfo/pysaprfc-users=0A>=0A>=0A>=0A> =0A=0A=0A |