cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple adapters scenario

Former Member
0 Kudos

Hi there,

i am working on a multiple adapters scenario and would like to get some help from you experts.

I will try to explain the requirements of it:

1) An external system will send a request to XI (in order to "start" the process) --> SOAP adapter (sender/request)

2) XI will communicate with SAP and retrieve a table from there --> sRFC adapter (receiver)

3) XI will update a table (Oracle DB) of the source system (the external one from step1) --> JDBC adapter (??)

i have been involved in scenarios with SOAP adapter and JDBC separately but not all together.Thus i dont know how to elaborate the third step.In addition i would prefer avoiding the use of BPM if possible.

Questions:

a) What is the best practise here?

b) I am not using WS.response so i dont know how to retrieve back the data to the sorce (that is the target system at the same time) by using the JDBC (cause i need to update a table).

Could you please help me on this?

Thanks in advance and best regards,

David

Accepted Solutions (1)

Accepted Solutions (1)

former_member190389
Active Contributor
0 Kudos

To avoid BPM you will have to do the following

1. SOAP request comes to XI

2.Do a three step mapping,

i. Map the req to RFC req structure.

ii. Use java mapping and in that perform a lookup of the RFC table .

iii. you will get the responseRFC structure map it to jdbc structure to write.

3. call the jdbc adapter.

Former Member
0 Kudos

Hi,

the point here is that i do know how to obtain the data from SAP and make it reaches XI with sRFC as a receiver channel but the question is:

may i have to map these data to a JDBC receiver channel and it will work?

Best regards,

David

former_member240483
Contributor
0 Kudos

Hi there,

1,SOAP send request to XI(Java maping)

2,Use RFC look up in Java mapping to fetch data from SAP.

3,Map this structure to DB using JDBC adapter.

Regards

Rao

Former Member
0 Kudos

Hi all,

What do you mean with RFC lookup? I have done like this:

Create one DT for sender WS message: DT_sender (lets say)

Create one DT for receiver JDBC message: DT_receiver

Create MT for DT_sender: MT_Sender

Create MT for DT_receiver: MT_Receiver

Create MI (asynch) for the MT_Sender: MI_Sender

Create MI (synch) for the Z_RFC (request & response)

Create a MM to map MT_Sender with Z_RFC.Request

Create a MM to map Z_RFC.Response to MT_Receiver

Create 2 IM for the previous 2 MMs

So right now, i have to ellaborate on the JDBC receiver channel and its possible interfaces. could you please guide me through?

Thanks again and best regards,

David

Former Member
0 Kudos

Hi all,

I dont see the point of using RFC lookup as i do know the way to retrieve the data from SAP using Messae Mapping.

so right now, i would like to know the way to achieve the union of the RFC.Response and the JDBC adapter.

could you please give some support?

best regards,

David

Former Member
0 Kudos

David,

If I understand what you are asking properly and that is a big IF :-).

Then aside from doing what the guys above have suggested which is to only use the RFC as a mapping in the lookup but actually have a scenario which is:

SOAP --> PI --> JDBC

You would have to go for a BPM approach.

Neither of the above scenarios are very difficult. BPM is standard and if you want some info on how to perform an RFC lookup from within a UDF I have personally written a near idot proff step by step guide last year that would show you this...

Let me know your email and I'll send it to you if you decide to go this way. Believe me it really isnt to difficult.

**********

Please read the Forum's Rules of Engagement,

i.e.,

[/thread/117188 [original link is broken];

and refrain from using email correspondence as the main objective of the Forums is to share knowledge.

SDN PI/XI Forum Moderator

Former Member
0 Kudos

Hi Alex,

My scenario is sthg like: SOAP --> PI <-> RFC and once the data is in PI, it is sent to a DB using JDBC.

SOAP: sender CC used to start the process (by using it, PI starts the process)

sRFC: receiver CC used to retrieve data from SAP

JDBC: receiver? CC used to send this data to a table in an Oracle DB.

I know how to perform the first two steps but i am feeling confused about how to go through the third one....

i could try to ellaborate by using BPM (i am not familiar with it, though) but first of all i would like to know if this could be done without using it as we want to try to maximize the performance...

at first, i thought it wouldnt be necessary as we dont have to wait for some steps, the whole process can be done in sequence but right now, i am not sure.

could you please, give some guidelines?

Thanks in advance and best regards,

David

former_member240483
Contributor
0 Kudos

Hi there,

sRFC: receiver CC used to retrieve data from SAP

after u trigger the interface from SOAP u saying RFC as reciever at the same time retrieve could you tell me how u going to achive this.

JDBC: receiver? CC used to send this data to a table in an Oracle DB.

as above posts suggested..

if u want to retrieve data from R3 and updated JDBC..u have to use RFC lookup....either through BPM or some java mapping.

Regards

Rao

Former Member
0 Kudos

Hi,

Yes, i have already done scenarios in which i have used SOAP <->PI <-> RFC and the RFC retreives data. Just importing an RFC in IR (this RFC has import and export parameters) and mapping to the WS.response the contents were sent properly to the sender synchronously!!

Thus, i thought i could do the same by mapping to a JDBC adapter, but i dont know how to achieve this.

could you please tell me how to do that using java mapping ( can i use graphical mapping?)

thanks

david

Former Member
0 Kudos

Hi David,

OK I'll try to explain.

Any scanerio in PI without BPM is Sender --> PI --> Receiver

You cannot go Sender ---> PI --> Receiver --> another receiver

But the work around (hack) that people are suggesting is to do a

SOAP -->. PI --> JDBC

Notice that there is no RFC above. This because to achieve what you want without BPM you need to implement the RFC call from within a Mapping. Can be done in a Graphical Mapping with a UDF.

It is really quite a simple sceanrio.

Do you want me to send you a how to guide I wrote on how to perform RFC Mapping lookups from within a UDF?

former_member240483
Contributor
0 Kudos

ok u used for Synchronous interface.

in this case u r interface is like this SOAPPIJDBC..

u trigger the interface through SOAP adapter.

when data comes into XI with the help of BPM ( RFC suncronous) u fetch data from the SAP system..

or

In java mapping u call the RFC to fetch data from SAP and map this data to target structure after that with the help of JDBC adapter it updates in DB.

Hope u clear.

Regards

Rao

Former Member
0 Kudos

Ok guys, finally i got you!!!

So, if i am right you mean that there is no need to use the RFC adapter as its results can be obtained directly from Message Mapping (with UDF or whatever).

Alex,

please, send the documentation to me, if possible! "david.miguel @ ciber.com"

i will try to implement it.

**********

Please read the Forum's Rules of Engagement,

i.e.,

[/thread/117188 [original link is broken];

and refrain from using email correspondence as the main objective of the Forums is to share knowledge.

SDN PI/XI Forum Moderator

Former Member
0 Kudos

ok i am sending it now.

You still need the RFC adapter but you just call it from within a UDF.

All is explained in the document.

former_member240483
Contributor
0 Kudos

So, if i am right you mean that there is no need to use the RFC adapter as its results can be obtained directly from Message Mapping (with UDF or whatever).

you have to use RFC adapter in mapping level to call the RFC in SAP system..

Regards

Rao

Former Member
0 Kudos

Hi Deivid,

Basically you have to import the RFC in the IR to be able to use the request / response structures, create a CC for the RFC and use this CC into a UDF in the mapping to get the values from the table. Please take a look to these blogs of the greats Michal and Bhavesh:

[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1b439]

[https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/5001] [original link is broken] [original link is broken] [original link is broken];

Best Regards,

Paco

former_member190389
Active Contributor
0 Kudos

Hi,

Here is a sample code for RFC lookup


package com.ibis.mapping.lookup.websiteorders;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;

import com.sap.aii.mapping.api.AbstractTrace;
import com.sap.aii.mapping.api.MappingTrace;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import com.sap.aii.mapping.api.StreamTransformationException;
import com.sap.aii.mapping.lookup.Channel;
import com.sap.aii.mapping.lookup.LookupException;
import com.sap.aii.mapping.lookup.LookupService;
import com.sap.aii.mapping.lookup.Payload;
import com.sap.aii.mapping.lookup.RfcAccessor;
import com.sap.aii.mapping.lookup.XmlPayload;

public class RFCLookup implements StreamTransformation
{
	public Map param = null;

	public static void main(String[] args)
	{
		try
		{
			InputStream in = new FileInputStream(new File(
					"TestFile.xml"));
			OutputStream out = new FileOutputStream(
					new File(
							"Test.xml"));
System.out.println("Hello");
			RFCLookup rfcLookup = new RFCLookup();
			rfcLookup.execute(in, out);
			

		}
		catch (Exception e)
		{
			System.out.println("ERROR IS :" + e.getMessage());
		}

	}

	public void execute(InputStream inputStream, OutputStream outputStream)
			throws StreamTransformationException
	{
		

		MappingTrace importanttrace;
		importanttrace = (AbstractTrace)param.get(StreamTransformationConstants.MAPPING_TRACE );
		RfcAccessor accessor = null;

		try
		{
			
			// 1. Determine a channel (Business system, Communication channel)
			Channel channel = LookupService.getChannel("BS_name", "Comm_channel_name");
			
			// 2. Get a RFC accessor for a channel.
			accessor = LookupService.getRfcAccessor(channel);
			importanttrace.addInfo("Accessor Looked up.");
			
			// 4. Create xml payload from the inputStream
			XmlPayload payload = LookupService.getXmlPayload(inputStream);
			importanttrace.addInfo("Input stream payload fetched");
			
			// 5. Execute lookup.
			Payload result = accessor.call(payload);
			importanttrace.addInfo("Called the RFC");

			// 6. Get the lookup response in new InputStream
			InputStream in = result.getContent();
			importanttrace.addInfo("got output");
			// 7. Transfer the inputstream into outputstream
			
			
			
			byte[] buffer = new byte[1024];
			for (int read = in.read(buffer); read > 0; read = in.read(buffer)) 
			{
				outputStream.write(buffer, 0, read);
				outputStream.write('\n');
			}
			outputStream.flush();
		}
		catch (LookupException e)
		{
			importanttrace.addWarning("Error while lookup " + e.getMessage());
		}
		catch (IOException e)
		{
			importanttrace.addWarning("Error " + e.getMessage() );
		}
		finally
		{
			
			// 8. close the accessor in order to free resources.
			if (accessor != null)
			{
				try
				{
					accessor.close();
				}
				catch (LookupException e)
				{
					 importanttrace.addWarning("Error while closing accessor " + e.getMessage() );
				}
			}
		}
		

	}

	public void setParameter(Map param)
	{
		this.param = param;		
		if (param == null) 
		{
	         this.param = new HashMap();
	    }


	}

}

This code works and all you need is the source RFC interface and target RFC interface.

compile this code and import it as java mapping in interface mapping..

now specify some RFC request in the test tab of interface mapping. the o/p will be response from RFC

Dont forget to modify the name of ur comm channel and business system in the code

Channel channel = LookupService.getChannel("BS_name", "Comm_channel_name");

Edited by: Progirl Progirl on Jul 21, 2008 4:25 PM

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I will explain your scenario like this :-- >

1) Some data will come to XI using SOAP

2) Data will be sent through RFC receiver

3) RFC will provide some data from the SAP system and pass back to XI.

4) Once data is received by XI it should update the database using JDBC.

Please correct if i am wrong in understanding the problem.

You can proceed like this :

1) Map SOAP message to RFC.

2) Use java mapping and use RFC lookup for passing and receiving data to RFC Channel.

3) Map response received from RFC lookup to JDBC receiver statement stucture.

4) Pass it to JDBC receiver.

Kulwinder

Reward if helpful