cancel
Showing results for 
Search instead for 
Did you mean: 

Lookup Problem

Former Member
0 Kudos

MappingTrace rfcLookupTrace;

rfcLookupTrace = container.getTrace();

String rfcRequest = "<?xml version = \"1.0\" encoding=\"UTF-8\"?><ns1:ZBAPI xmlns:ns1= \"urn:sap-com:document:sap:rfc:functions \"><EBELN>5400030033</EBELN></ns1:ZBAPI> ";

String rfcResponse = "";

RfcAccessor rfcAccessor = null;

ByteArrayOutputStream rfcOutput = null;

try{

Channel rfcChannel = LookupService.getChannel ( "lookupchanel","RFCCh2" ) ;

rfcAccessor = LookupService.getRfcAccessor(rfcChannel);

InputStream inputStream = new ByteArrayInputStream(rfcRequest.getBytes());

XmlPayload rfcPayload = LookupService.getXmlPayload(inputStream);

Payload rfcReponse = rfcAccessor.call(rfcPayload);

InputStream reponseStream = rfcReponse.getContent();

rfcOutput = new ByteArrayOutputStream(1024);

byte[] buffer = new byte[1024];

for (int read = reponseStream.read(buffer); read > 0; read = reponseStream.read(buffer))

{

rfcOutput.write(buffer, 0, read);

}

rfcResponse = rfcOutput.toString();

}

catch(LookupException e)

{

rfcLookupTrace.addWarning("Error while RFC Lookup " + e.getMessage() );

}

catch(IOException e)

{

rfcLookupTrace.addWarning("Error " + e.getMessage() );

}

finally

{

if (rfcOutput!=null){

try

{

rfcOutput.close();

}

catch (IOException e)

{

rfcLookupTrace.addWarning("Error while closing stream " + e.getMessage() );

}

}

if(rfcAccessor!=null)

{

try

{

rfcAccessor.close();

}

catch(LookupException e)

{

rfcLookupTrace.addWarning("Error while closing accessor " + e.getMessage() );

}

}

}

return "";

IAIn Target System i am getting these Erros ?xml version="1.0" encoding="UTF-8 .

Can any one done Lookup for PO in checking R/3 before sending to Target System.

Rged's

Raj

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

HI I have writen Custom RFC and i In UDF iam giveing right input i think. while in responce i need it

can any one who worked on LOokup they miht know what mistake i am doing.

I am following excatly RFC lookup with Communication Channel. Blog.

Regd's

Raj

Former Member
0 Kudos

Hi ,

can any help me to solve the problem

Former Member
0 Kudos

Hi Raj,

Can You have a look at yr code containing the problem I have mentioned regarding the return.

Also first chk the RFC manually with the value and see whether it is working fine or not.

Also when U will execute the RFC the response will be an XML string and You will have to extract the required field from the Response XML and put this extracted field in yr return

esle thee node will contain the xml returned from Lookup

Regards

Edited by: Amit K Singh on Jan 2, 2008 10:48 AM

Former Member
0 Kudos

Hi Amit,

I understand we need to extract the Value i need it it.

Can you help me to Lookup the in Table of SAP.

The RFC is working FIne. and i am able to get responce alli need to pass the Value to Target system when i get a responce from RFC.

Regd's

Raj

Former Member
0 Kudos

Hi Raj,

As u have mentioned that RFC is working fine then U must be getting the response back in the Lookup as XML .

So please tell me what is the problem Do u want to extract the value and facing problem there ?:

Regards

former_member194677
Participant
0 Kudos

Please check the below blogs.

Lookup method from GUI mapping can be called using any of the following ways.

· 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

Thnx

Santosh

Former Member
0 Kudos

Hi,

Can u confirm if dis value is present inside the table which u r sending to target by executing ur BAPI first.

Regards,

Anoop

Former Member
0 Kudos

Hi Anoop,

I sending the Value from Soucre.

I need to check the value exist in R/3 if its exist then send to Target.

Lookup will do only checking . I am confused to write a java Code.

yes i agree i am returing Null .

Regd's

Raj

Former Member
0 Kudos

Hi,

U r sending value from the source.This value will be an input to ur UDF which is doing RFC lookup corresponding to that value.For that u must have written code in SE37.just confirm if u r giving the same value as from the source to ur function module,does it return something while executing?

Regards,

Anoop

Former Member
0 Kudos

Hi Raj,

Please check the code you are returning null strign in the return statement .Please correct the return content and then check the same.

Regards