4.1.2 Methods

discover(name="RFC_READ_REPORT")

Used to look up the definition of an RFC interface. Returns an instance of iface. This also automatically defines any associated parm, tab, struct, and field objects that come together to describe a complete RFC Interface.

structure(name="TRDIR")
Discover and return the definition of a valid data dictionary structure. This could be subsequently used in association with an parm, or tab object. Returns a struct object.

is_connected()
Test that the conn object is still connected to the SAP system. Returns true or false.

sapinfo()
Return a hash of the values supplied by the RFC_SYSTEM_INFO function module. This function is only properly called once, and the data is cached until the RFC connection is closed - then it will be reset next call.

callrfc(iface=iface)
Do the actual RFC call - this installs all the Export, Import, and Table Parameters in the actual C library of the extension, does the RFC call, Retrieves the table contents, and import parameter contents, and then cleans the libraries storage space again.

accept(wait=<RFC loop wait interval>, callback=callback handler instance)
Is the method that launches a registered RFC application into the wait, request, event loop cycle. The callback handler is as described in the above examples and must have the method LoopHandler if it is supplied at all (if it isnt supplied - the event is ignored):

class reg:

	def __init__(self):
		self.cnt = 0
		import os

	def LoopHandler(self, srfc):
		self.cnt += 1
		print "inside the customer loop handler - iter: %d ...\n" % self.cnt
		if self.cnt >= 30:
			return -1
		return 1
....

If the LoopHandler() returns < 1, then this is a signal for the accept() loop to exit.

close()
Close the current open RFC connection to an SAP system.