Skip to Content
Author's profile photo Former Member

Debugging a RFC call using JCo API

imageimage

Most of the JCO classes like JCO.Function, JCO.Table, JCO.ParameterList, JCO.Record and JCO.Structure supports writeHTML(String) and writeXML(String) method.

writeHTML(String filename) -> method takes the file name as an input parameter and writes the dump of the corresponding object into a file in the form of HTML document.

writeXML(String filename) -> method takes the file name as an input parameter and writes the dump of the corresponding object into a file in the form of XML document.

This can serve as a very easy tracing mechanism while making a RFC call using JCo API to verify whether everything went as expected or not.

Java Code Snippet:

The following were the dump files created as a result of the code.

HTML Dump:

image

XML Dump:

image

Similar dump files can also be created for other JCO Objects like Table, ParameterList, Structure etc by calling their corresponding writeHTML(String) or writeXML(String) function.

Assigned tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      also jco.setAbapDebug(true) just before execution will launch the function module in sapgui and you can debug all the way through (from java to SAP)
      Author's profile photo Former Member
      Former Member
      Hi,
      Thanks for the information. This I have covered in my next weblog Debugging a RFC call using JCo API, Part-2.

      Regards,
      Tarun

      Author's profile photo Former Member
      Former Member
      Hi Tarun,

      Nice to see the blog.
      I have one question here. I would appreciate if you answer my query. (since your area of intrest include opens source and ur blog is abt RFC Connection)
      I would like to know, Is there a way by which i can connect to SAP r/3 (to bapi's rfc etc etc) by any open source standard means(not through any SAP propriety means bcos i dont want to spenf on anything more other than r/3 installation..) and get the data and show it to a user? Is there some way by the bapi's or rfc's can we made as web services etc?
      Hope you understand my question?

      Regards
      Gaurav

      Author's profile photo Gregor Wolf
      Gregor Wolf
      Hello Gaurav,

      starting with SAP Basis aka SAP Web AS 6.20 you can call all BAPI's and RFC Enabled Function Modules as a Web Service. So if you have SAP R/3 4.70 and higher just go on.

      Regards
      Gregor

      Author's profile photo Former Member
      Former Member
      Hi Gregor,

      Can you provide me with some more details as to how to achieve this?
      How can i expose the rfc's as web services and then i hope it will be possible for me to access that web service through Java and show the data.

      Regards
      Gaurav Gandhi

      Author's profile photo Former Member
      Former Member
      Hi,

      To expose RFCs as web services, please check out http://help.sap.com/saphelp_nw04/helpdata/en/e5/a68d10f4eb894087fc9c1c3f9ae433/content.htm.

      Regards

      Shehryar

      Author's profile photo Former Member
      Former Member
      Hi Gregor & Shehryar,

      Thanx for the link.

      Gaurav

      Author's profile photo Former Member
      Former Member
      You can also check out Thomas Jung's presentation on exposing RFCs as webservices in both 620 and 640. The presentation is available at https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/a4433436-0301-0010-f2a9-9281ad574054

      Regards