cancel
Showing results for 
Search instead for 
Did you mean: 

Integration to SAP thru BAPI(s)

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (10)

Answers (10)

Former Member
0 Kudos

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.

athavanraja
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

athavanraja
Active Contributor
0 Kudos

<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

Former Member
0 Kudos

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

athavanraja
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

athavanraja
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

Raja,

I am not a Java expert, as far as I know these are Java libraries and can be used in your program by importing the same.

I will let you know if I can find some info on the same.

Regards,

Ravi

Note : Please mark the helpful answers

athavanraja
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

<b>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>

<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.

Former Member
0 Kudos

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.

Regards,

Ravi

Note : Please mark the helpful answers

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

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