Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

RFC lookup parsing

Hi All,

I have wriiten a RFC lookup for mapping the company code. But I am not getting the result while parsing the XML. I have tested the code and without parsing I am getting the correct value in XML. Can anybody send the code for parsing the XML data using DOM.

Below is the code which I am using .

try {

docResponse = builder.parse(in);

if (docResponse == null) {

importanttrace.addWarning("docResponse is null");


res = docResponse.getElementsByTagName("COMPANYID").item(0).getFirstChild().getNodeValue();

if (res == null) {

importanttrace.addWarning("res is null");



catch (Exception e) {

importanttrace.addWarning("Error when parsing RFC Response - " + e.getMessage());


try {

// Free resources, close the accessor..

if (accessor != null) {

try {


} catch (LookupException e) {

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



} catch (Exception e) {

importanttrace.addWarning("Result value not found in DOM - " + e);


// return the result obtained above

return res;



Former Member
Former Member replied

Hi Aparna,

Check this:

1. Your response is having COMPANY_CODE and not COMPANYID

res = docResponse.getElementsByTagName("COMPANY_CODE").item(0).getFirstChild().getNodeValue();

2. why <bukrs> comes as start and end node of the result. If it is there then the result is not a valid XML message and you will get an error

The processing instruction target matching "[xX][mM][lL]" is not allowed.

If you make the above changes your parsing code will work



0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question