Tuesday, August 18, 2020
Run R12 FAST formula from backend (TOAD) to debug
declare
l_formula_id ff_formulas_f.formula_id%TYPE;
l_effective_start_date ff_formulas_f.effective_start_date%TYPE;
l_formula_name ff_formulas_f.formula_name %TYPE;
l_inputs ff_exec.inputs_t;
l_outputs ff_exec.outputs_t;
begin
insert into fnd_sessions
values(userenv('SESSIONID'),sysdate);
select ffm.formula_id,ffm.effective_start_date ,ffm.FORMULA_NAME
into l_formula_id,l_effective_start_date ,l_formula_name
from ff_formulas_f ffm
where ffm.FORMULA_NAME='NP_HOUSING_ALLOWANCE_FF';
-- select * from ff_formulas_f where FORMULA_NAME='NP_HOUSING_ALLOWANCE_FF'
dbms_output.put_line(' l_formula_name - l_formula_id - l_effective_start_date :=> '||l_formula_name||' - '||l_formula_id||' - '
||to_char(l_effective_start_date,'DD-MON-YYYY'));
ff_exec.init_formula (l_formula_id,
l_effective_start_date,
l_inputs,
l_outputs
);
--
-- Loop through the Input Values
--
FOR i IN l_inputs.FIRST .. l_inputs.LAST
LOOP
if l_inputs(i).name='BUSINESS_GROUP_ID' then
l_inputs(i).value := 81;
end if;
if l_inputs(i).name='ASSIGNMENT_ID' then
l_inputs(i).value := 64;
end if;
if l_inputs(i).name='DATE_EARNED' then
l_inputs(i).value :=fnd_date.date_to_canonical(trunc(to_date('31-DEC-2020')));
end if;
if l_inputs(i).name='PAYROLL_ACTION_ID' then
l_inputs(i).value := 166992;
end if;
/* if l_inputs(l_in_cnt).name='BUSINESS_GROUP_ID' then
l_inputs(l_in_cnt).value := P_BUSINESS_GROUP_ID;
end if;
if l_inputs(l_in_cnt).name='BUSINESS_GROUP_ID' then
l_inputs(l_in_cnt).value := P_BUSINESS_GROUP_ID;
end if; */
--
-- Pass The each Input value name and its Value : Eg: START_DATE and p_start_date
--
dbms_output.put_line('l_inputs-Name : ' ||l_inputs (i).NAME );
END LOOP;
--
-- Run the formula
--
ff_exec.run_formula (l_inputs ,
l_outputs
);
FOR j IN l_outputs.FIRST .. l_outputs.LAST
LOOP
dbms_output.put_line('j-Name : ' ||l_outputs(j).NAME );
dbms_output.put_line('j-Value : ' ||l_outputs(j).VALUE );
END LOOP;
exception when others then
dbms_output.put_line('MainException : ' ||SQLERRM);
end;
Sunday, August 16, 2020
LOV Events in OAF
LOV Events in OAF
There are some scenarios where we need to take some action on the basis of LOV, LOV fires three events:
1) lovUpdate : when user selects a value from lov.
2) lovValidate: when user enters a valid value in the lov input and tabs out then lov doesn't get pop-up.
In this case lovValidate event is fired.
3) lovPrepare: when user clicks on torch icon: "lovPrepare" event is fired.
//If we want to check which LOV has fired the event we can check it like this:
{codecitation class="brush: java; gutter: true;" width="600px"}
if (pageContext.isLovEvent())
{
String lovInputSourceId = pageContext.getLovInputSourceId();
if ("myLovInput".equals(lovInputSourceId))
{
am.invokeMethod("handleMyLovInputEvent");
}
}
//
//Here is another sample code based on multiple LOV's
{codecitation class="brush: java; gutter: true;" width="600px"}
if (pageContext.isLovEvent())
{
if ("Project".equals(lovInputSourceId))
{
am.invokeMethod("clearChargeCode");
}
if ("ChargeAccount".equals(lovInputSourceId))
{
am.invokeMethod("clearTask");
}
if ("Shipto".equals(lovInputSourceId))
{
am.invokeMethod("clearAddress");
}
}
Monday, August 10, 2020
Create Employee Salary Proposal record by hr_maintain_proposal_api.cre_or_upd_salary_proposal
DECLARE
lb_inv_next_sal_date_warning BOOLEAN;
lb_proposed_salary_warning BOOLEAN;
lb_approved_warning BOOLEAN;
lb_payroll_warning BOOLEAN;
ln_pay_proposal_id NUMBER;
ln_object_version_number NUMBER;
BEGIN
--2443(AN00004)
-- Create or Upadte Employee Salary Proposal
-- ----------------------------------------------------------------
hr_maintain_proposal_api.cre_or_upd_salary_proposal
( -- Input data elements
-- ------------------------------
p_business_group_id => 81,--fnd_profile.value('PER_BUSINESS_GROUP_ID'),
p_assignment_id => 2443,
p_change_date => trunc(TO_DATE('01-AUG-2020')),
p_proposed_salary_n => 1800,
p_approved => 'Y',
-- Output data elements
-- --------------------------------
p_pay_proposal_id => ln_pay_proposal_id,
p_object_version_number => ln_object_version_number,
p_inv_next_sal_date_warning => lb_inv_next_sal_date_warning,
p_proposed_salary_warning => lb_proposed_salary_warning,
p_approved_warning => lb_approved_warning,
p_payroll_warning => lb_payroll_warning
);
COMMIT;
dbms_output.put_line('ln_pay_proposal_id -> '||ln_pay_proposal_id);
dbms_output.put_line('ln_object_version_number -> '||ln_object_version_number);
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
dbms_output.put_line(SQLERRM);
END;
/
AME Related Useful SQL Queries
/*GET AME Trx Type's Rules, conditions*/
select apl.APPLICATION_NAME Transaction_type, r.description Rule,r.rule_id,r.start_date,r.end_date ,condition Conditions
from (select distinct rule_id, description,start_date,end_date from ame_rules
where sysdate between start_date and end_date) r,
(select distinct rule_id, LISTAGG (ame_utility_pkg.get_condition_description (acu.condition_id), chr(10))
WITHIN GROUP (order by acu.condition_id) OVER (partition by acu.rule_id) condition from ame_condition_usages acu) cu,
ame_rule_usages aru,
(select APPLICATION_NAME, application_id from ame_calling_apps_vl acav
where application_name = 'Payables Invoice Approval'
and rownum = 1) apl
where r.rule_id = cu.rule_id
--and r.rule_id = 20004
and aru.rule_id = r.rule_id
and aru.item_id = apl.application_id
order by r.description
Subscribe to:
Posts (Atom)