on 03-25-2008 11:22 AM
Hi,
I followed this blog & working fine while passing 4 arguments to check the condition for single field and retrieve the data from mapping table according to that condition .
/people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
Now my requirement is to check the condition on two fields and according to that condition i need to pick the corresponding value from the mapping table and pass it to target.
So i did passed 6 arguments in the input UDF and i made change in the code of the following line as follows
String WHERE_CLAUSE = sourcefld[0]" = ""'"fldvalue[0]"'" + "AND" + sourcefld2[0]" = ""'"fldvalue2[0]"'";
Iam getting the error as 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
Regrads
Bopanna
Solved the problem by self.by providing the space like " AND " in the following line of code. here it is a space problem
String WHERE_CLAUSE = sourcefld[0]" = ""'"fldvalue[0]"'" + " AND " + sourcefld2[0]" = ""'"fldvalue2[0]"'";
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please provide me the structure of RFC u have developed and the code you wrote. Because, you need to pass the parameters based on your structure of RFC only.
Thanks,
Vijay Kumar T.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Guys,
Any updates??
Regards
Bopanna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check out this,
WHERE_CLAUSE = sourcefld[0]" = ""'"fldvalue[0]"'" + "AND" + sourcefld2[0]" = ""'"fldvalue2[0]"'";
It must be
WHERE_CLAUSE = sourcefld[0]+" = '"+fldvalue[0]+"' AND" + sourcefld2[0]+" = '"+fldvalue2[0]+"'";
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If i change the code from
WHERE_CLAUSE = sourcefld[0]" = ""'"fldvalue[0]"'" + "AND" + sourcefld2[0]" = ""'"fldvalue2[0]"'";
TO
WHERE_CLAUSE = sourcefld[0]" = '"fldvalue[0]+"' AND" + sourcefld2[0]" = '"fldvalue2[0]+"'";
Now the error is
Source code has syntax error: /usr/sap/SXD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map246a1250fab811dca04d0003ba2ce5c5/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
Hi Raj,
The code which i used is
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 = "sxidev";
String systemNumber = "00";
String userName = "user";
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
Bopanna,
Are u doing JDBC or RFC lookup?
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 |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.