Monday, December 31, 2018

Oracle OAF : Code Combination Dynamic

Controller
===================

OAApplicationModule am = pageContext.getApplicationModule(webBean);
System.out.println("Before Setting the Flex Field ");
String str12 = (String)am.invokeMethod("getFSC", new Serializable[] { String.valueOf(pageContext.getOrgId()) });
OAKeyFlexBean kffId = (OAKeyFlexBean)webBean.findIndexedChildRecursive("WriteoffCodeCombination");
kffId.useCodeCombinationLOV(true);
kffId.setStructureCode(str12);
kffId.setCCIDAttributeName("WriteoffCodeCombinationId");
// kffId.setRequired("yes");
// kffId.setWidth("170%");
kffId.addVRule("", "SUMMARY_FLAG", new Message("SQLGL", "GL_NO_PARENT_SEGMENT_ALLOWED"), true, new String[] { "N" });


Ampplication Module
====================

public String getFSC(String paramString)
{
String str1 = null;
String str2 = "begin select kst.id_flex_structure_code  into :1  from apps.fnd_id_flex_structures kst, apps.gl_ledgers gll,  apps.hr_operating_units hro  where     kst.id_flex_code = 'GL#' and kst.application_id = 101 and kst.id_flex_num = gll.chart_of_accounts_id   and gll.ledger_id = hro.set_of_books_id   and hro.organization_id = :2 ; end;";
CallableStatement localOracleCallableStatement = getOADBTransaction().createCallableStatement(str2, 1);
try
{
int i = Integer.parseInt(paramString);
localOracleCallableStatement.setInt(2, i);
localOracleCallableStatement.registerOutParameter(1, 12);
localOracleCallableStatement.execute();
str1 = localOracleCallableStatement.getString(1);
}
catch (SQLException e)  {throw new OAException("Sequence not found");}
if ((str1 == null) || ("".equals(str1.trim()))) str1 = "OPERATIONS_ACCOUNTING_FLEX";
return str1;
 }

No comments:

Post a Comment