on 03-11-2010 11:47 PM
I have written RFC Lookup.
But I am getting the belows errors
/usr/sap/XPD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f873e902d6811df9e460017a451d38e/source/com/sap/xi/tf/_MM_RFCLookup_.java:3: <identifier> expected import com.sap.aii.mappingtool.tf3.;import com.sap.aii.mappingtool.tf3.rt.;import java.util.;import java.io.; import java.lang.reflect.;import java.io.InputStream;import javax.xml.parsers.DocumentBuilder;import java.util.Iterator;import com.sap.aii.mapping.api.AbstractTrace;import java.util.Map;import org.w3c.dom.;import javax.xml.parsers.DocumentBuilderFactory;import import;import java.io.ByteArrayInputStream;import com.sap.aii.mapping.lookup.; ^ /usr/sap/XPD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f873e902d6811df9e460017a451d38e/source/com/sap/xi/tf/_MM_RFCLookup_.java:3: '.' expected import com.sap.aii.mappingtool.tf3.;import com.sap.aii.mappingtool.tf3.rt.;import java.util.;import java.io.; import java.lang.reflect.;import java.io.InputStream;import javax.xml.parsers.DocumentBuilder;import java.util.Iterator;import com.sap.aii.mapping.api.AbstractTrace;import java.util.Map;import org.w3c.dom.;import javax.xml.parsers.DocumentBuilderFactory;import import;import java.io.ByteArrayInputStream;import com.sap.aii.mapping.lookup.; ^ /usr/sap/XPD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f873e902d6811df9e460017a451d38e/source/com/sap/xi/tf/_MM_RFCLookup_.java:119: 'try' without 'catch' or 'finally' try { ^ /usr/sap/XPD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f873e902d6811df9e460017a451d38e/source/com/sap/xi/tf/_MM_RFCLookup_.java:130: illegal start of type } catch (Exception e) { ^ /usr/sap/XPD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f873e902d6811df9e460017a451d38e/source/com/sap/xi/tf/_MM_RFCLookup_.java:135: <identifier> expected trace.addInfo("RFC Request XML: " + docReq.toString()); ^ /usr/sap/XPD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f873e902d6811df9e460017a451d38e/source/com/sap/xi/tf/_MM_RFCLookup_.java:139: illegal start of type try { ^ /usr/sap/XPD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f873e902d6811df9e460017a451d38e/source/com/sap/xi/tf/_MM_RFCLookup_.java:151: <identifier> expected Document docRsp = null; ^ /usr/sap/XPD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f873e902d6811df9e460017a451d38e/source/com/sap/xi/tf/_MM_RFCLookup_.java:152: illegal start of type try { ^ /usr/sap/XPD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f873e902d6811df9e460017a451d38e/source/com/sap/xi/tf/_MM_RFCLookup_.java:167: <identifier> expected trace.addInfo("RFC Response XML: " + docRsp.toString()); ^ /usr/sap/XPD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f873e902d6811df9e460017a451d38e/source/com/sap/xi/tf/_MM_RFCLookup_.java:170: illegal start of type try { ^ /usr/sap/XPD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f873e902d6811df9e460017a451d38e/source/com/sap/xi/tf/_MM_RFCLookup_.java:176: <identifier> expected return res; ^ /usr/sap/XPD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f873e902d6811df9e460017a451d38e/source/com/sap/xi/tf/_MM_RFCLookup_.java:181: 'class' or 'interface' expected public static void main(String[] args) throws Exception{/!_$ClNRep_/_MM_RFCLookup_ st = new /!_$ClNRep_/_MM_RFCLookup_(); st.testExecute(); } ^ /usr/sap/XPD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f873e902d6811df9e460017a451d38e/source/com/sap/xi/tf/_MM_RFCLookup_.java:182: 'class' or 'interface' expected } ^ /usr/sap/XPD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f873e902d6811df9e460017a451d38e/source/com/sap/xi/tf/_MM_RFCLookup_.java:183: 'class' or 'interface' expected
Can someone please help to resolve this issue
Hi Prabhu,
Are you using udf for RFC Lookup or dirctly java mapping?
Can you paste here the code?
Regards
Suraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
I have resolved the problem. There was an extra bracket in the code.
I need other help.
Currently i get the Output as below
<rfc:Z_COMP.Response xmlns:rfc="urn:sap-com:document:sap:rfc:functions"> <E_FLAG>Y</E_FLAG> </rfc:Z_COMP.Response>
But I just want the Output of the whole UDF to be the value in the "E_FLAG"
Can you tell me how can i do it. The Code written for parsing the document is as below:
{
Document docRsp = null;
try {
docRsp = builder.parse(result.getContent());
} catch (Exception e) {
trace.addWarning("Error when parsing RFC Response - " + e.getMessage());
return null;
}
trace.addInfo("RFC Response XML: " + docRsp.toString());
String res = "";
try {
res = docRsp.getElementsByTagName(TAG_RES).item(0).getNodeValue();
} catch (Exception e) {
trace.addWarning("Result value not found in DOM - " + e);
return VALNOTFOUND;
}
return res;
}
Hi Prabhu,
If you exactly whatever mentioned in this document you should be able to solve your issue:
http://wiki.sdn.sap.com/wiki/display/Snippets/User-definedMappingFunctionforRFC+Lookup
Else can you give your compelte code so that somebody can help you out here.
Regards,
---Satish
Hello Satish,
Here is my complete code
{
final String CHANNEL_NAME = "cc_Rfc_Receiver_Lookup",
SERVICE = "Sys_EPD_110" ,
VALNOTFOUND = "VALUE_NOT_FOUND",
SAPRFCNS = "urn:sap-com:document:sap:rfc:functions",
TAG_FM = "Z_COMPARE_ADDRESS",
TAG_RES = "E_FLAG",
TAG_I_ALLIANCEID = "I_ALLIANCEID",
//TAG_I_OVRDFLAG = "I_OVRDFLAG",
TAG_I_PSTLZ = "I_PSTLZ",
TAG_I_CITY1 = "I_CITY1",
TAG_I_STATE = "I_STATE",
TAG_I_COUNTRY = "I_COUNTRY";
MappingTrace trace;
trace = container.getTrace();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
factory.setNamespaceAware(false);
factory.setValidating(false);
try {
builder = factory.newDocumentBuilder();
} catch (Exception e) {
trace.addWarning("Error creating DocumentBuilder - " + e.getMessage());
return null;
}
Document docReq = null;
try {
// Building up RFC Request Document
docReq = builder.newDocument();
Node root = docReq.appendChild(docReq.createElementNS(SAPRFCNS, TAG_FM));
root.appendChild(docReq.createElement(TAG_I_ALLIANCEID)).appendChild(docReq.createTextNode(I_ALLIANCEID));
//root.appendChild(docReq.createElement(TAG_I_OVRDFLAG)).appendChild(docReq.createTextNode(I_OVRDFLAG));
root.appendChild(docReq.createElement(TAG_I_PSTLZ)).appendChild(docReq.createTextNode(I_PSTLZ));
root.appendChild(docReq.createElement(TAG_I_CITY1)).appendChild(docReq.createTextNode(I_CITY1));
root.appendChild(docReq.createElement(TAG_I_STATE)).appendChild(docReq.createTextNode(I_STATE));
root.appendChild(docReq.createElement(TAG_I_COUNTRY)).appendChild(docReq.createTextNode(I_COUNTRY));
} catch (Exception e) {
trace.addWarning("Error while building RFC Request - " + e);
return null;
}
trace.addInfo("RFC Request XML: " + docReq.toString());
// Lookup
Payload result = null;
try {
Channel channel = LookupService.getChannel(SERVICE, CHANNEL_NAME);
RfcAccessor accessor = LookupService.getRfcAccessor(channel);
InputStream is = new ByteArrayInputStream(docReq.toString().getBytes());
XmlPayload payload = LookupService.getXmlPayload(is);
result = accessor.call(payload);
} catch (LookupException e) {
trace.addWarning("Error during lookup - " + e);
return null;
}
// Parsing RFC Response Document
Document docRsp = null;
try {
docRsp = builder.parse(result.getContent());
} catch (Exception e) {
trace.addWarning("Error when parsing RFC Response - " + e.getMessage());
return null;
}
trace.addInfo("RFC Response XML: " + docRsp.toString());
String res = "";
try {
res = docRsp.getElementsByTagName(TAG_RES).item(0).getNodeValue();
} catch (Exception e) {
trace.addWarning("Result value not found in DOM - " + e);
return VALNOTFOUND;
}
return res;
}
The Output of this RFC lookup is
<RFC Response XML: <rfc:Z_COMPARE_ADDRESS.Response xmlns:rfc="urn:sap-com:document:sap:rfc:functions"> <E_FLAG>Y</E_FLAG> </rfc:Z_COMPARE_ADDRESS.Response>
But the field value shows null
Thanks
hi,
Are you using any try block in your code?
in trace it is visible " 'try' without 'catch' or 'finally' try "
Check this wiki:
http://wiki.sdn.sap.com/wiki/display/Snippets/User-definedMappingFunctionforRFC+Lookup
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prabhu,
Format your question,its not in understandable format.
Regards,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.