cancel
Showing results for 
Search instead for 
Did you mean: 

A condition specified dynamically has an unexpected format.]

Former Member
0 Kudos

Hi,

Iam getting this Error When i test the mapping at Mapping Test tab.

RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /WPUTAB01/IDOC/E1WPZ01/E1WPZ02/ZAHLART. The message is: Exception:[com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: A condition specified dynamically has an unexpected format.] in class com.sap.xi.tf._MM_POS_PaymentType_IB_ method

I have used the RFCLookup in the mapping.

Iam pasting the sample code here have a look at and reply back with valuable ans

com.sap.mw.jco.*;

-


public void myproglkp(String[] tabname,String[] sourcefld,String[] fldvalue,String[] sourcefld2,String[] fldvalue2,String[] lkpfld,ResultList result,Container container){

-


//write your code here

//write your code here

String DBTABLE = tabname[0];

String lookUpField = lkpfld[0];

String WHERE_CLAUSE = sourcefld[0]" = ""'"fldvalue[0]"'" + "AND" + sourcefld2[0]" = ""'"fldvalue2[0]"'";

String sapClient = "500";

String hostName = "Xi Hostname";

String systemNumber = "00";

String userName = "User name";

String password = "pwd";

String language = "EN";

JCO.Repository mRepository;

JCO.Client mConnection = JCO.createClient(

sapClient,

userName,

password,

language,

hostName,

systemNumber );

// connect to SAP

mConnection.connect();

// create repository

mRepository = new JCO.Repository( "GenericRFCMappingLookup", mConnection );

// create function template to select data from any table

JCO.Function function = null;

IFunctionTemplate ft = mRepository.getFunctionTemplate("RFC_READ_TABLE");

function = ft.getFunction();

// Obtain parameter list for function

JCO.ParameterList input = function.getImportParameterList();

// Pass function parameters

// set import parameters table name and RFC

input.setValue( DBTABLE, "QUERY_TABLE");

input.setValue( "," , "DELIMITER");

//Fill the where clause of the table

JCO.ParameterList tabInput = function.getTableParameterList();

JCO.Table inputTable = tabInput.getTable("OPTIONS");

inputTable.appendRow();

inputTable.setValue(WHERE_CLAUSE,"TEXT");

mConnection.execute( function );

//Find the position of the field that has to be lookedUp

JCO.Table lookupFieldPos = function.getTableParameterList().getTable("FIELDS");

int pos = -1;

for (int i = 0; i < lookupFieldPos.getNumRows(); i++)

{

lookupFieldPos.setRow(i);

if (lookupFieldPos.getString("FIELDNAME").equals(lookUpField))

pos = i;

}

//Get the exact lookupvalue from the position obtained above

JCO.Table valueSet = function.getTableParameterList().getTable("DATA");

for (int i = 0; i < valueSet.getNumRows(); i++)

{

valueSet.setRow(i);

String resultSet [] = valueSet.getString("WA").split(",(?=(?:[\"]*\"[\"]\")(?![^\"]*\"))");

result.addValue(resultSet[pos]);

}

mConnection.disconnect();

Regards

Bopanna

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Ans

GabrielSagaya
Active Contributor
0 Kudos

String WHERE_CLAUSE1 = sourcefld[0]" = ""'"fldvalue[0]"'" ;

String WHERE_CLAUSE2 = sourcefld2[0]" = ""'"fldvalue2[0]"'" ;

...............

inputTable.setValue(WHERE_CLAUSE1,"TEXT");

inputTable.setValue(WHERE_CLAUSE2,"TEXT");

please check the code

Former Member
0 Kudos

Hi Gabriel,

Thanks for your valuable response.

We tried this .But the thing is it is giving the success but it is not placing the condition for both fields.

its taking the value with respect of the second field and the first field it ignores and not checking

By writing the code as u said , i thought that here we are not doing any condition check for both the fields combindly

\Please let me know the way to achieve

Regards

Bopanna

Edited by: BOPANNA B on Mar 26, 2008 6:59 AM

Former Member
0 Kudos

Hi,

If i check the condition by passing a single parameter means its giving the success. like the code will be like this

public void Payment_Method_Lkp(String[] tabname,String[] sourcefld,String[] fldvalue,String[] lkpfld,ResultList result,Container container){

String WHERE_CLAUSE = sourcefld[0]" = ""'"fldvalue[0]"'" ;

If i check the condition by passing two parameters means i am getting that error.the code i used here to check the condition on two fields is

public void Sample(String[] tabname,String[] sourcefld,String[] fldvalue,String[] sourcefld2,String[] fldvalue2,String[] lkpfld,ResultList result,Container container){

String WHERE_CLAUSE = sourcefld[0]" = ""'"fldvalue[0]"'"+ "AND" + sourcefld2[0]" = ""'"fldvalue2[0]"'" ;

Is there any problem in checking the condition on two fields. Is there any syntax error on this WHERE CLAUSE.

Regards

Bopanna

GabrielSagaya
Active Contributor
0 Kudos

String WHERE_CLAUSE = sourcefld[0]" = ""'"fldvalue[0] "'"+ "AND" + sourcefld2[0]" = ""'"fldvalue2[0]"'" ;

Here I have added '+' between flvalue[0] and fldvalue2[0].

Former Member
0 Kudos

Hi,

Now this time iam getting this error

Source code has syntax error: /usr/sap/SXD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapdb774b00f9d911dcc50e0003ba2ce5c5/source/com/sap/xi/tf/_MM_POS_PaymentType_IB_.java:207: ';' expected String WHERE_CLAUSE = sourcefld[0]" = ""'"fldvalue[0] "'"+ "AND" + sourcefld2[0]" = ""'"fldvalue2[0]"'" ; ^ 1 error

Regards

Bopanna

Former Member
0 Kudos

Hi,

This syntax is working fine when iam passing one parameter to check the condition

String WHERE_CLAUSE = sourcefld[0]" = ""'"fldvalue[0]"'" ;

According to this please make the WHERE_CLAUSE condition for Two fields

and iam sure that iam getting the error in this WHERE_CLAUSE only.

Regards

Bopanna

GabrielSagaya
Active Contributor
0 Kudos

The error is due to missing of "+'". in the query...

please add "" after "'"fldvalue[0]"'""AND"+...

/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer

/people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups

Former Member
0 Kudos

Hi,

According to this blog she used one field and did the condition , accordng to that she fetched the corresponding value from the mapping table.

But in my case i want to put the condition on two parameters.

I changed in the code WHERE_CLAUSE .and i passed the parameters according to the inputs. is there any place to change some thing else when we are passign two parameters.???

How to do this by WHERE CLAUSE. please construct the CLAUSE and send me

/people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups

Regards

Bopanna

GabrielSagaya
Active Contributor
0 Kudos

String WHERE_CLAUSE = sourcefld[0]" = ""'"fldvalue[0]"' AND " + sourcefld2[0]" = ""'"fldvalue2[0]"'";

Please check the code that i have modified

Former Member
0 Kudos

Hi,

No Gabriel, if i mention the code given by you means iam getting the same error which i have posted in my previous post.

If you observe the code given in the Sravya's blog. she has given for one field can u please make the condition for two fields???

the code which u have given is giving the error

Source code has syntax error: /usr/sap/SXD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map37ab5520f9e311dcaa680003ba2ce5c5/source/com/sap/xi/tf/_MM_POS_PaymentType_IB_.java:208: ';' expected String WHERE_CLAUSE = sourcefld[0]" = ""'"fldvalue[0]"' AND " + sourcefld2[0]" = ""'"fldvalue2[0]"'"; ^ 1 error

Regards

Bopanna

Former Member
0 Kudos

Hi Gabriel Sagaya Selvam,

Please update the thread

Regards

Bopanna

GabrielSagaya
Active Contributor
Former Member
0 Kudos

No Gabriel,

This is talking abt the other type of java code.

Can you please have a look at the code which i implemented for this RFC Lookup

And can you say how to check the codition on two fields

If we know where to change the code modification for that type of condition means our work is done.

Regards

Bopanna

GabrielSagaya
Active Contributor
0 Kudos

public void Payment_Method_Lkp(String[] tabname,String[] sourcefld,String[] fldvalue,String[] lkpfld,ResultList result,Container container){

String WHERE_CLAUSE = sourcefld[0]" = ""'"fldvalue[0]"'" "+ "AND" + sourcefld[1]" = ""'"fldvalue[1]"'" ;

Hi you can passing two parameters by this way...........

Former Member
0 Kudos

Hi gabriel,

here in the arguments u have passed only for fieldname and fieldvalue but i want two more field like fieldname2 and fieldvalue2 inorder to check those fields in WHERE_CLAUSE

and here u are doing like this

String WHERE_CLAUSE = sourcefld[0]+" = ""'"fldvalue[0]"'" " "AND" + sourcefld[1]" = ""'"fldvalue[1]"'" ;

What is the meaning of this. but in the arguments u havent passed any thing for field2

Regards

Bopanna

Edited by: BOPANNA B on Mar 26, 2008 8:19 AM