ArrayList<ValueNamePair> data = new ArrayList<ValueNamePair>();
int AD_Reference_ID = 195; // MLookupInfo.getAD_Reference_ID("All_Payment Rule");
Language language = Env.getLanguage(Env.getCtx());
MLookupInfo info = MLookupFactory.getLookup_List(language, AD_Reference_ID);
String sql = info.Query.substring(0, info.Query.indexOf(" ORDER BY"))
+ " AND " + info.KeyColumn
+ " IN (SELECT PaymentRule FROM C_BankAccountDoc WHERE C_BankAccount_ID=?) "
+ info.Query.substring(info.Query.indexOf(" ORDER BY"));
try