on 02-06-2008 3:32 PM
Hi,
I am trying to call a BAPI that exists in XI system,in the Message Mapping in same XI system.
If I run the BAPI,it is working fine.
But if I call this in XI Message Mapping using RFC lookup,it returns garbage.
I am not getting any RFC error.
Can anyone please tell me what could be the reason for this.
Thanks.
Best Regards,
Shweta
Hi,
Try to do the Lookup using the XSLT with a java helper class(if graphical mapping is not a mandatrory requirment , .........since you can avoid the java prasing and handle the same with a line of x-path.
Cheers
Sunil.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shwetha,
Please refer the below weblog:
RFC lookup using JCO (without communication channel)
/people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
RFC lookup with communication channel.
/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
Sample code:
public void createAlert(String InterfaceID, String AlertCategory, String errorString,String RFCReceiverCommunicationChannel,String BusinessService)
{
try{
final String SAPRFCNS = "urn:sap-com:document:sap:rfc:functions",
FUNCTION_MODULE= "Z_FI_RAISE_ALERT";
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
factory.setNamespaceAware(false);
factory.setValidating(false);
try {
builder = factory.newDocumentBuilder();
} catch (Exception e) {
}
Document docReq =null;
try {
docReq = builder.newDocument();
Node root = docReq.appendChild(docReq.createElementNS(SAPRFCNS, FUNCTION_MODULE));
// Creates XML structure which is passed to ABAP function module
root.appendChild(docReq.createElement("I_INTERFACE_ID")).appendChild(docReq.createTextNode(InterfaceID));
root.appendChild(docReq.createElement("I_ERROR")).appendChild(docReq.createTextNode(errorString));
root.appendChild(docReq.createElement("I_ALERTCAT")).appendChild(docReq.createTextNode(AlertCategory));
} catch (Exception e) {
}
// XML Payload
Payload result1 = null;
try {
Channel channel = LookupService.getChannel(BusinessService, RFCReceiverCommunicationChannel);
RfcAccessor accessor = LookupService.getRfcAccessor(channel);
InputStream is = new ByteArrayInputStream(docReq.toString().getBytes());
XmlPayload payload = LookupService.getXmlPayload(is);
result1 = accessor.call(payload);
} catch (LookupException e) {
// trace.addWarning("Error during lookup - " + e);
// System.out.println(e.toString());
}
}
catch(Exception e)
{
// System.out.println(e.toString());
}
}
Thnx
Chirag
Shweta, what garbage does it return?
Don't forget, you'll receive back an XML document and it needs to be parsed! Your UDF must handle the response and return only relevant value.
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.