cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with SQL Where statement: SAPSQL_INVALID_FIELDNAME

Former Member
0 Kudos

Hello,

I am using SAPJCo3 to get data from SAP into my java application. I have one problem with SQL Where statement. Hear is a piece of code.

u2026

JCoFunction function = this.createFunction(repository, "RFC_READ_TABLE");

function.getImportParameterList().setValue("QUERY_TABLE", "DD02L");

function.getImportParameterList().setValue("DELIMITER", "\t");

JCoTable options = function.getTableParameterList().getTable("OPTIONS");

options.appendRow();

options.setValue("TEXT", "TABCLASS = 'TRANSP' or TABCLASS = 'POOL' or TABCLASS = 'CLUSTER' or TABCLASS = 'VIEW'");

try {

function.execute(destination);

} catch (JCoException e) {

e.printStackTrace();

}

u2026

I get an SAPSQL_INVALID_FIELDNAME exception.

If I set just 3 fields

options.setValue("TEXT", " TABCLASS = 'POOL' or TABCLASS = 'CLUSTER' or TABCLASS = 'VIEW'");

or

options.setValue("TEXT", "TABCLASS = 'TRANSP' or TABCLASS = 'POOL' or TABCLASS = u2018CLUSTERu2019");

everything works fine.

I would understand if the problem lies in the length of the value that I set. I could append more rows and split the where clause into several. But stupid example is working fine:

options.setValue("TEXT", "VIEWCLASS = 'D' or VIEWCLASS = 'P' or VIEWCLASS = 'D' or VIEWCLASS = 'P' or VIEWCLASS = 'D' or VIEWCLASS = 'P'");

So I believe that the problem is somewhere else. Do you have any idea where it could be?

Best regards

Evgenia

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

OK, resolved the problem. The string should be splitted into substrings, length <=70 chars. The stupid example was working because by chance it was splitted in the "right" place.