Calling BAPIs through JCo

I am working on a java application which need to connect to SAP R/3. Through my java code I am trying to call BAPI functions. We are using JCO 1.1. While creating a salesorder I use BAPI_SALESORDER_CREATEFROMDAT1. I have set all the necessary input parameters like header, items and partner role. Before and after executing the function I am taking an HTML dump. In that HTML after execution it gives me an error in the return parameter(BAPIRETURN) "No customer master record exists for sold-to party" and since the function is not executed properly as usual it is not giving me a salesdocument number, since the order is not properly created. In the case above my document type was "ZOR1" . Then I tried creating another order (through java) using document type "TA" which is the german version for "OR". This time I didn't get any error and document number was also generated, but it was unable to set the sold-to-party and ship-to-party informations. The number generated for the document was also not similar to those for successfully created orders. But with the same input I could create a salesorder from SE37 function module (which also successfully sets the sold-to-party and ship-to-party info).
Please

    Requires Free Membership to View

    When you register, you will start receiving targeted emails from my award-winning team of editorial writers. Our goal is to keep you informed on the hottest topics and biggest challenges faced by SAP professionals today.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchSAP.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchSAP.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

enlighten me with the solution for the problems I am facing. As In case of "OR" I have used "TA". What are the other mappings for other document types like ZOR1, ZSH1, etc. Where do I get all these mappings? Also please tell me why the same parameters which successfully created an order in se37 are unable to create the same through BAPI call from java application. What changes need to be done? Can you elaborate on the German - English issue while passing the input parameters?


The BAPIs usually use the internal format (e.g., German codes, leading zeroes) for all fields. SE37 calls the GUI conversion exits, whereas the BAPIs themselves do not (see my article in www.sappro.com). My company offers a component (ARAsoft Java BAPI ObjectFactory) that helps with the necessary conversions (send email for trial version). Otherwise you have to study the conversion BAPIs and use them in your client code. Check the dictionary definitions for all fields you are using to see whether they have associated conversion exits.


This was first published in October 2001