Skip to Content
avatar image
Former Member

Integration to SAP thru BAPI(s)

HI Experts,

i wud like to know high level process on the below mentioned requirement,as i have a requirement on the same.

Is there anyway to upload transaction data (PO to b received and Sales order has to b generated), which is in XML format, into SAP.

(Note there is no scope to go for IDOCs & NO SAP XI)

your help is appreciated.

Thanks,

Raja.

Message was edited by: raja gurrala

Message was edited by: raja gurrala

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

10 Answers

  • avatar image
    Former Member
    Apr 08, 2006 at 04:18 PM

    Hi Ravi,

    Thanks for the clarification.

    This is new req from client like...

    they will send PO (Not from SAP) info in XML format ..it goes to particular middleware for validations.

    From their our work starts...we've to incorporate our code in that middleware.To capture the PO..and do necessary things to make it to create an SO in SAP thru a comm protocol...

    <b>Hope i am clear...any suggestions?</b>

    My concern is how to capture the XML and how to make calls to SAP from middleware thru our code( I think this is where we've to think of SAP java connector r some thing)

    Thanks,

    Raja.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Raja,

      Alright, which ever middleware is that looks like you can do Java coding in that. Given that you will write some Java code to parse the XML and understand the data. Once that is done, you can make a JCo call using the Java Connector API's and call the appropriate RFC.

      There are two types of parsers - SAX and DOM parsers, depending on your requirement choose the right one.

      When you say you have to incorporate our code, do you mean writing ABAP code in there, which middleware we are talking about here. To me, I can't see any ABAP coding here. You might have to write some wrapper code for the RFC's if calling the RFC directly doesn't solve your purpose.

      There is a thread in the XI Forum talking about the different parsers, take a look.

      in-java-mapping-whether-to-sax-or-dom

      Regards,

      Ravi

      Note : Please mark the helpful answers

  • avatar image
    Former Member
    Apr 08, 2006 at 03:51 PM

    Ravi,

    Even i thought exactly in the similar way.

    But how to capture the XML file..??

    how the mapping done from SAP to XML..?

    what is the role of SAP Java Connector (SAP JCo)? and SAP ADAPTER?

    Thanks

    Raja.

    Message was edited by: raja gurrala

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Raja,

      Well whether your data is in presentation server file or app server file, upload the file into a internal table accordingly. Once that is done, you can parse the XML and call the appropriate BAPI's.

      SAP JCo, is a Java Connector API which is used to connect to SAP from a Java Application.

      SAP Adapter - is a part of XI, which is used to connect to different applications. For example, RFC adapter is used to connect to SAP from XI and this internally using JCo.

      well given that there is no question of SAP XI not sure what is the significance of SAP Adapter is, please explain.

      Regards,

      Ravi

      Note : Please mark the helpful answers

  • avatar image
    Former Member
    Apr 11, 2006 at 08:03 AM

    Raja,

    Thanks for the clarification,learnt a lot from ur posts.

    Am i able to test this CL_XML_DOCUMENT??

    simply i have an XML file in presentaion server...is that OK ??

    IF so how i can do test( as i found test button in se24) with which parameters to supply??

    Thanks

    Raja.

    Add comment
    10|10000 characters needed characters exceeded

    • check out this sample code

      REPORT Y_TEST_XML

      NO STANDARD PAGE HEADING.

      DATA : l_xml TYPE REF TO cl_xml_document ,

      node type ref to if_ixml_node ,

      stream type string ,

      size type i.

      data: filename type LOCALFILE .

      filename = 'C:\xxxx.xml' .

      CREATE OBJECT l_xml.

      l_xml->import_from_file( filename = filename ).

      l_xml->render_2_string(

      EXPORTING

      PRETTY_PRINT = 'X'

      IMPORTING

      • RETCODE = RETCODE

      STREAM = STREAM

      SIZE = SIZE

      ).

      you can use this as a base to paly around with the other methods of the class cl_xml_document.

      Regards

      Raja

  • avatar image
    Former Member
    Apr 08, 2006 at 02:54 PM

    Raja,

    I think you can do it.

    Look at the following links.

    /people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach

    /people/thomas.jung3/blog/2005/05/15/abap-46c-to-640-delta-training

    Also, look at the following thread, where there are quite a few suggestions.

    Upload XML to internal table and vice versa in SAP 4.6C

    Once you are able to succesfully upload the XML data into internal tables, its a matter of calling the right BAPI's for the respective transactions.

    Assuming you are receiving the PO of a customer, that means you will receiving the data of materials, quantities, delivery dates, etc. Get the data and call BAPI_SALESORDERCREATE*.

    regards,

    Ravi

    Note : Please mark the helpful answers

    Message was edited by: Ravikumar Allampallam

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 10, 2006 at 06:34 AM

    Hi Ravi,

    Thanks for the reply.

    I wud like to know the things in details.Let me start from XML file.

    So how i can we convert it to a format that is to make it allowable format in JCO (where i can call bapi to generate a SO)

    As u mentioned SAX/DOM parsers , r these available in JCo to use those tool/progs (Parsing what will done here...is it like the XML data is going to store in a flatfile / Double dimensional array)?

    Rgds,

    Raja.

    Add comment
    10|10000 characters needed characters exceeded

    • if you are on WAS6.20 and above and the middleware/sending system is can handle http or soap you can easily achieve this by using class CL_HTTP_CLIENT (turing your ABAP program as http client)

      lets say, the sending system sends a xml file and based on that you have to create the PO in the SAP system. all that the sending system needs to do is call a url and post the xml messages. is the sending system is without your network or in internet?

      Regards

      Raja

  • avatar image
    Former Member
    Apr 10, 2006 at 06:56 AM

    Raja,

    I think there is no provision for WAS (i think this appears as part in XI).

    Just there is a middle ware (java based)..

    XML file wud b available in in this middle ware..

    I've convert this to a format which i can supply to my BAPI input parameters to generate an SO.

    ( i am novice here , correct if i am wrong or if u need any more info to provide better answer)

    Thanks,

    Raja.

    Add comment
    10|10000 characters needed characters exceeded

    • WAS is not part of XI.

      Which version of SAP you are using.

      if the file stored in the middle ware is accessible via http address (URL)

      once you have the xml within your abap environment converting that to a required format (say to fill a itab) is not difficult.

      Regards

      Raja

  • avatar image
    Former Member
    Apr 10, 2006 at 07:27 AM

    SAP version is 4.6c...

    there is 3 entities involved here.

    1(Buyer)partner sys -> 2 middleware (java) -> 3(seller) SAP 4.6c

    1 PO (XML format)->2 ?? -> 3 SO creation (sap 4.6C)

    |

    Our role will come at entity 2, we have to write some code which shud connect to SAP and has to generate SO in 3. As per my research it has to something with Java connector/Business conncector which will connect to SAP and will generate SO( By using BAPIs) this is the main objective of our work..

    Hope i am clear and wud b greatful if u provide any guidelines or solutions to provide a solution.

    (I am not aware of WAS whether available with SAP or we have install it separatley)

    <i>if the file stored in the middle ware is accessible via http address (URL)</i>

    --still i've to get proper answer for the above

    Rgds,

    Raja.

    Message was edited by: raja gurrala

    Message was edited by: raja gurrala

    Add comment
    10|10000 characters needed characters exceeded

    • clarification on WAS

      after 4.6D its called WAS (WAS6.10.6.20 and the current version is WAS6.40)

      since you want to connect to R/3 from the middleware and not the R/3 calling the middle ware to get the xml file you can ignore the question <i>is the file stored in the middle ware is accessible via http address (URL)</i>

      so for your case you have to use JCO, in this case either the middleware parse the xml and pass it to our SO BAPI or simply pass the xml to a custom RFC which should parse the xml and call the SO BAPI.

      code sample on using JCO calling BAPI check out these weblogs

      /people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection

      /people/gregor.wolf3/blog/2005/03/05/create-users-in-an-abap-system-with-bapi-ostermiler-java-utilities

      /people/gregor.wolf3/blog/2004/09/23/from-function-module-to-jco-application--part-1-of-3

      /people/gregor.wolf3/blog/2004/09/24/from-function-module-to-jco-application--part-2-of-3

      /people/gregor.wolf3/blog/2004/09/25/from-function-module-to-jco-application--part-3-of-3

      Regards

      Raja

  • avatar image
    Former Member
    Apr 10, 2006 at 09:16 AM

    Hi Raja,

    Thanks for clarification abt WAS.

    I have two Qs on solutions, which u've provided.

    <i>either the middleware parse the xml and pass it to our SO BAPI</i>

    We will supply this parsed data (PO info) to BAPI FM(BAPI_SALESORDER_CREATEFROMDAT2) that's ok but XML parsed data shud appear in which format so that we can supply the same info to this FM to create a sales order?

    <i>simply pass the xml to a custom RFC which should parse the xml and call the SO BAPI.</i>THis part i did not get properly cud u please elaborate...

    One more concern..i have to provide acknowledgement about SO generation and it's status to partner from R/3 to middleware...is there any specific guidelines to b follwed for this (interms of outbound connectivity from R/3 to middleware).

    I appreciate your invaluable help.

    Rgds,

    Raja.

    Message was edited by: raja gurrala

    Add comment
    10|10000 characters needed characters exceeded

    • <i>We will supply this parsed data (PO info) to BAPI FM(BAPI_SALESORDER_CREATEFROMDAT2) that's ok but XML parsed data shud appear in which format</i>

      check out the weblogs , i have mentioned, you have the sample on how to pass parameter to BAPIs when calling the BAPIs from Java

      <i>simply pass the xml to a custom RFC which should parse the xml and call the SO BAPI.</i>

      in this case your custom RFC will have a importing parameter to receive the xml once its received within your code in the RFC you can parst it using CL_XML_DOCUMENT and convert the xml content to a itab.

      for acknolwedgement, just send a exporting param from your RFC and the calling system can receive it.

      In WAS 6.40 you can received the xml, over HTTP or SOAP or the old method RFC

      Regards

      Raja

  • avatar image
    Former Member
    Apr 10, 2006 at 02:06 PM

    Hi folks,

    please do let me know If we go for WAS(4.6D)..how to get the XML into SAP environment??

    can anybody help me out

    Thanks

    Raja.

    Message was edited by: raja gurrala

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      You can proceed as following:

      1. Java Code takes XML Data from middleware and passes it to an RFC (You have to create this RFC) using Java Connector API.

      2. In that RFC call a Function Module TEXT_CONVERT_XML_TO_SAP to convert XML raw data to SAP Format.

      3. Take that converted data and call relevant BAPI from ur RFC to update it.

  • avatar image
    Former Member
    Apr 11, 2006 at 07:03 AM

    Hi Anuj,

    Is this process is same for any SAP version 4.6c or 4.7D(WAS 6.20)??

    Can u guide a bit detail in Custom RFC process,which takes care of connection to SAP and calling BAPI to create a SO from the respective available data from XML file?

    i appreciate ur help.

    Rgds,

    Raja.

    Add comment
    10|10000 characters needed characters exceeded