Return Current month Data:Help needed in modifying this code of a Procedure

Hello Folks i have this scenario where i need to modify this code so that it has to return data from the Current month First Day to the previous Day if its a daily report and previous month data if its a monthly report.
I have no clue how to modify this code below. Currently the code is returning data for Monthly reports for the previous month. Does anyone have any idea how to modify so that the code meets the requirements of both daily and monthly reprts.
BEGIN
if v_lowdate is null or v_highdate is null then
select to_number(to_char(sysdate, 'DD')) into v_cur_day from dual;
if v_cur_day < 25 then
-- this is for the previous month run
Select Add_Months(trunc(sysdate, 'MONTH'), -1)
INTO V_LOWDATE
FROM DUAL;
SELECT Last_Day(ADD_Months(Sysdate, -1)) INTO V_Highdate From Dual;
else
-- this is for the current month run
Select trunc(sysdate, 'MONTH') INTO V_LOWDATE FROM DUAL;
SELECT Last_Day(Sysdate) INTO V_Highdate From Dual;
end if;
end if;
Thanks
Edited by: user11961230 on Sep 30, 2009 8:34 PM

Hi Frank, This is code till the "modifying Code" which we were working. I will post the code after the "modifying Code" in the next reply. Thanks
CREATE OR REPLACE PROCEDURE "POPULATE_RECOVERY_ACTIVITYHN"(p_lowdate date,
p_highdate date) IS
v_lowdate date := p_lowdate;
v_highdate date := p_highdate;
v_error_code NUMBER(20);
v_error_text VARCHAR2(300);
v_recovery_id Recovery.Recovery_ID%type;
v_loop_control Number(20);
v_settlement_id recovery.settlement_id%type;
V_Event_ID Event.Event_ID%Type;
V_Event_Case_ID Event_Case.Event_Case_ID%Type;
V_Recovery_Month Varchar2(100);
V_Major_Company Major_Client.Major_Client_Name%Type;
V_Company Client.Client_Name%Type;
V_Client_Policy_Identifier Varchar2(100);
V_Lan_ID Varchar2(10) := 'TROVERIS';
V_Recovery_Account Client.Account_Number%Type;
V_AccountA Number(2) := 0;
V_AccountB Number(2) := 0;
V_Unit Event_Client_Field.Client_Field_Data%Type;
V_Market Event_Client_Field.Client_Field_Data%Type;
V_case_open_date Event_case.Open_Date%type;
V_Employer_Group_Code Employer_Group.Employer_Group_Code%Type;
V_Unknown1 Number(2) := 0;
V_Fee_Schedule_Code Event_Case.Fee_Schedule_Code%Type;
V_Total_Fee_Percent Number(20, 2) := 0.00;
V_Subrogation_Fee_Percent Number(20, 2) := 0.00;
V_Unknown2 Number(2) := NULL;
V_Unknown3 Number(2) := NULL;
V_TOTAL_MEDICAL Number(20, 2) := 0.00;
V_Recovery_Amount Number(20, 2) := 0.00;
V_Total_Tax Number(20, 2) := 0.00;
V_Administrative_Tax Number(20, 2) := 0.00;
V_Total_NonCash_Fee Number(20, 2) := 0.00;
V_Total_NonCash_Positive Number(20, 2) := 0.00;
V_Total_NonCash_Negative Number(20, 2) := 0.00;
V_Total_Recovery Number(20, 2) := 0.00;
V_Total_NonCash_Fee_Positive Number(20, 2) := 0.00;
V_Total_NonCash_Fee_Negative Number(20, 2) := 0.00;
V_Total_Admin_Fee Number(20, 2) := 0.00;
V_Total_Fee Number(20, 2) := 0.00;
V_Total_NonCash_Tax_Positive Number(20, 2) := 0.00;
V_Total_NonCash_Tax_Negative Number(20, 2) := 0.00;
report_type                  Varchar2(2);
v_gl_num client.gl_num%type; -- *002*
v_net_billable client.net_billable%type; -- *003*
vevent_id event.event_id%type; -- *006*
v_prev_event event.event_id%type; -- *006*
v_prev_case event_case.event_case_id%type; -- *006*
v_tot_recovery recovery.amount%type; -- *006*
v_rec_amount recovery.amount%type; -- *006*
v_prev_rec_amt recovery.amount%type; -- *006*
v_prev_rec_month recovery_activity.recovery_month%type; -- *006*
v_tot_fee recovery_activity.total_fee%type; --*006*
v_mth_rev unbundled_recoveries.monthly_revenue%type; -- *006*
v_diff number(18, 2); -- *006*
v_nc_count number := 0; -- *006*
v_c_count number := 0; -- *006*
v_nc_tot recovery.amount%type; -- *006*
v_used_rev recovery_activity.total_fee%type; -- *006*
v_use_mth_rev unbundled_recoveries.monthly_revenue%type := 0; -- *006*
v_use_nc_mth_rev unbundled_recoveries.monthly_revenue%type := 0; -- *006*
v_prev_netbill client.net_billable%type; -- *006*
v_event_type event.event_type_code%type;
v_date_typed event.date_typed%type;
v_acc_client_id client.acc_client_id%Type;
v_Recovery_Revenue_GL_Num client.recovery_revenue_gl_num%Type;
v_Funds_Due_GL_num client.funds_due_gl_num%Type;
v_lob Varchar2(20);
v_nc_recovery_id recovery.recovery_id%Type;
/*Changed the Client_Policy_Identifier to concatenate the Retlation to insured code instead of the description
which was exceeding the column size in the table. SWL 09/03/02. Checked with the Design Doc.*/
CURSOR RECOVERY_INFO IS
SELECT Event.Event_ID,
Event_Case.Event_Case_ID,
TO_CHAR(Recovery.Recovery_Date, 'FMMONTHYYYY') As Recovery_Month,
Major_Client.Major_Client_Name AS Major_Company,
-- Client.Client_Name AS Company,
-- nvl(client.legacy_client_id,'DC')||'-'||substr(Client.Client_Name,1,55) AS Company, -- SWL 04/01/04 52653
substr(nvl(client.legacy_client_id,
decode(client.client_id, 1, 'DC', client.client_code)) || '-' ||
Client.Client_Name,
1,
60) AS Company,
Event.Client_Policy_Identifier ||
Event_Case.Relation_To_Insured_code as Client_Policy_Identifier,
Client.Account_Number as Recovery_Account,
Employer_Group.Employer_Group_Code,
Event_Case.Fee_Schedule_Code,
Recovery_ID,
Event_case.Open_Date,
'(' || recovery.recovery_transaction_internal || ')' ||
l.recovery_transaction_descripti, --fml 110276
recovery.settlement_id,
trim(client.gl_num), -- *002*
nvl(trim(client.net_billable), 'N'), -- *003*
recovery.amount, -- *006*,
event.event_type_code,
event.date_typed,
recovery_id,
Client.ACC_CLIENT_ID,
Recovery_Revenue_GL_Num,
Funds_Due_GL_num
FROM Recovery,
Settlement,
Event_Case,
Event,
Employer_Group,
Client,
Major_Client,
recovery_transaction_lookup l
Where to_date(Recovery.Recovery_Date, 'DD-MON-RR') between
TO_DATE(v_lowdate, 'DD-MON-RR') and
TO_DATE(v_highdate, 'DD-MON-RR')
AND Settlement.Settlement_id = Recovery.Settlement_id
AND Settlement.Event_Case_ID = Event_Case.Event_Case_id
AND Event_Case.Event_ID = Event.Event_ID
AND Event.Employer_Group_ID = Employer_Group.Employer_Group_ID(+)
AND Event.Client_ID = Client.Client_ID
AND Client.Major_Client_id = Major_Client.Major_Client_ID(+)
and recovery.settlement_id not in
(select settlement_id
from recovery
where to_date(Recovery.Recovery_Date, 'DD-MON-RR') between
TO_DATE(v_lowdate, 'DD-MON-RR') and
TO_DATE(v_highdate, 'DD-MON-RR')
AND recovery_transaction_internal in
('05', '50', '52', '51'))
--001
and    client.invoice_flag = 'N'            *005* commenting
-- SWL 05/03/05 #71231
and event.event_id in
(select event_id
from event_end_user eeu
where eeu.active_flag = 'Y'
and eeu.owner_flag = 'Y'
and eeu.end_user_id in
(select end_user_id
from end_user
where end_user.research_internal_user = 'Y'))
and recovery.recovery_transaction_internal =
l.recovery_transaction_internal --fml 110276
order by event.event_id, recovery.amount; -- *006*
-- SWL 05/03/05 #71231
-- end of 001
-- SWL 11/10/03 # 52743
-- *006*
CURSOR get_recovery(vevent_id event.event_id%type) IS
SELECT sum(r.amount)
FROM Recovery r
Where to_date(r.Recovery_Date, 'DD-MON-RR') between
TO_DATE(v_lowdate, 'DD-MON-RR') and
TO_DATE(v_highdate, 'DD-MON-RR')
and r.event_id = vevent_id
and r.settlement_id not in
(select settlement_id
from recovery
where to_date(Recovery.Recovery_Date, 'DD-MON-RR') between
TO_DATE(v_lowdate, 'DD-MON-RR') and
TO_DATE(v_highdate, 'DD-MON-RR')
AND recovery_transaction_internal in
('05', '50', '52', '51'))
and r.event_id in
(select event_id
from event_end_user eeu
where eeu.active_flag = 'Y'
and eeu.owner_flag = 'Y'
and eeu.end_user_id in
(select end_user_id
from end_user
where end_user.research_internal_user = 'Y'));
CURSOR RECOVERY_INFO_NC IS
SELECT distinct Event.Event_ID,
Event_Case.Event_Case_ID,
TO_CHAR(Recovery.Recovery_Date, 'FMMONTHYYYY') As Recovery_Month,
Major_Client.Major_Client_Name AS Major_Company,
-- Client.Client_Name AS Company,
-- nvl(client.legacy_client_id,'DC')||'-'||substr(Client.Client_Name,1,55) AS Company, /* SWL 04/01/04 52653 */
substr(nvl(client.legacy_client_id,
decode(client.client_id,
1,
'DC',
client.client_code)) || '-' ||
Client.Client_Name,
1,
60) AS Company,
Event.Client_Policy_Identifier ||
Event_Case.Relation_To_Insured_code as Client_Policy_Identifier,
Client.Account_Number as Recovery_Account,
Employer_Group.Employer_Group_Code,
Event_Case.Fee_Schedule_Code,
'(' || recovery.recovery_transaction_internal || ')' ||
l.recovery_transaction_descripti, --fml 110276
recovery.settlement_id,
trim(client.gl_num), -- *002*
nvl(trim(client.net_billable), 'N'), -- *003*
recovery.amount,-- *006*
recovery.recovery_id,
event.event_type_code,
event.date_typed,
Client.ACC_CLIENT_ID,
Recovery_Revenue_GL_Num,
Funds_Due_GL_num
FROM Recovery,
Settlement,
Event_Case,
Event,
Employer_Group,
Client,
Major_Client,
recovery_transaction_lookup l
Where to_date(Recovery.Recovery_Date, 'DD-MON-RR') between
TO_DATE(v_lowdate, 'DD-MON-RR') and
TO_DATE(v_highdate, 'DD-MON-RR')
AND Settlement.Settlement_id = Recovery.Settlement_id
AND Settlement.Event_Case_ID = Event_Case.Event_Case_id
AND Event_Case.Event_ID = Event.Event_ID
AND Event.Employer_Group_ID = Employer_Group.Employer_Group_ID(+)
AND Event.Client_ID = Client.Client_ID
AND Client.Major_Client_id = Major_Client.Major_Client_ID(+)
and recovery.settlement_id in
(select settlement_id
from recovery
where to_date(Recovery.Recovery_Date, 'DD-MON-RR') between
TO_DATE(v_lowdate, 'DD-MON-RR') and
TO_DATE(v_highdate, 'DD-MON-RR')
--001
AND recovery.recovery_transaction_internal in
('05', '50', '52', '51')
and    client.invoice_flag = 'N'   *005* commenting
/* SWL 05/03/05 #71231 */
and event.event_id in
(select event_id
from event_end_user eeu
where eeu.active_flag = 'Y'
and eeu.owner_flag = 'Y'
and eeu.end_user_id in
(select end_user_id
from end_user
where end_user.research_internal_user = 'Y'))
and recovery.recovery_transaction_internal =
l.recovery_transaction_internal --fml 110276
order by event.event_id, recovery.amount; -- *006*
/* SWL 05/03/05 #71231 */
--end of 001
-- *006*
CURSOR get_recovery_nc(vevent_id event.event_id%type) IS
SELECT sum(r.amount)
FROM Recovery r
Where to_date(r.Recovery_Date, 'DD-MON-RR') between
TO_DATE(v_lowdate, 'DD-MON-RR') and
TO_DATE(v_highdate, 'DD-MON-RR')
AND r.event_id = vevent_id
and r.settlement_id in
(select settlement_id
from recovery
where to_date(Recovery.Recovery_Date, 'DD-MON-RR') between
TO_DATE(v_lowdate, 'DD-MON-RR') and
TO_DATE(v_highdate, 'DD-MON-RR'))
AND recovery_transaction_internal in ('05', '50', '52', '51')
and r.event_id in
(select event_id
from event_end_user eeu
where eeu.active_flag = 'Y'
and eeu.owner_flag = 'Y'
and eeu.end_user_id in
(select end_user_id
from end_user
where end_user.research_internal_user = 'Y'));
CURSOR Recovery_Totals_Nc IS
Select Recovery_Detail.Recovery_Id, /* SWL 07/01/04 59016 */
max(NVL(Recovery_Detail.Fees_Percent, 0) +
NVL(Recovery_Detail.Admin_Percent, 0)) as Total_Fee_Percent,
max(NVL(Recovery_Detail.Fees_Percent, 0)) as Subrogation_Fee_Percent,
max(NVL(Recovery.Amount, 0)) as Recovery_Amount, /* SWL 04/01/04 52653 */
Sum(NVL(Recovery_detail.Fees, 0) + NVL(Recovery_Detail.Admin, 0)) as Total_Fee,
Sum(NVL(Recovery_Detail.Fees_Taxes, 0) +
NVL(Recovery_Detail.Admin_Taxes, 0)) as Total_Tax,
Sum(NVL(Recovery_Detail.Admin_Taxes, 0)) as Administrative_tax,
Sum(NVL(Recovery_Detail.Admin, 0)) as Total_Admin_Fee,
sum(recovery.retained_by_client) as Non_cash_fee, --fml 110276
sum(recovery.allocation_check_amount) as cash --fml 110276
From Settlement, Recovery, Recovery_Detail
Where Recovery.settlement_id = v_settlement_id
And recovery.recovery_id = v_recovery_id
And Settlement.Settlement_id = Recovery.Settlement_id
And Recovery.Recovery_id = Recovery_detail.Recovery_id(+)
and to_date(Recovery.Recovery_Date, 'DD-MON-RR') between
TO_DATE(v_lowdate, 'DD-MON-RR') and
TO_DATE(v_highdate, 'DD-MON-RR') /*SWL 12/03/04 */
-- Group by Recovery_Detail.Fees_Percent; /* SWL 04/01/04 52653 */
Group by Recovery_Detail.recovery_id;
v_cash_recovery recovery_activity.cash_recovery%type;
CURSOR Recovery_Totals_Positive_Nc IS
-- Select Sum(Recovery.Amount) as Total_NonCash_Positive, /* SWL 04/01/04 52653 */
Select max(Recovery.Amount) as Total_NonCash_Positive,
Sum(NVL(Recovery_Detail.Fees_Taxes, 0) +
NVL(Recovery_Detail.Admin_Taxes, 0)) as Total_NonCash_Tax_Positive
From Settlement, Recovery, Recovery_detail
Where Recovery.settlement_id = v_settlement_id
And Settlement.Settlement_id = Recovery.Settlement_id
and recovery.recovery_id = v_recovery_id /* SWL 07/01/04 59016 */
And Recovery.Amount >= 0
And Recovery.Recovery_id = Recovery_detail.Recovery_id(+)
And Recovery.Recovery_Transaction_Internal in
('05', '50', '52', '51')
-- Group by Recovery_Detail.Fees_Percent; /* SWL 04/01/04 52653 */
Group by Recovery_Detail.recovery_id;
CURSOR Recovery_Totals_Negative_Nc IS
-- Select Sum(Recovery.Amount) as Total_NonCash_Negative, /* SWL 04/01/04 52653 */
Select max(Recovery.Amount) as Total_NonCash_Negative,
Sum(NVL(Recovery_Detail.Fees_Taxes, 0) +
NVL(Recovery_Detail.Admin_Taxes, 0)) as Total_NonCash_Tax_Negative
From Settlement, Recovery, Recovery_Detail
Where Recovery.settlement_id = v_settlement_id
And Settlement.Settlement_id = Recovery.Settlement_id
and recovery.recovery_id = v_recovery_id /* SWL 07/01/04 59016 */
And Recovery.Amount < 0
And Recovery.Recovery_id = Recovery_detail.Recovery_id(+)
And Recovery.Recovery_Transaction_Internal in
('05', '50', '52', '51')
Group by Recovery_Detail.recovery_id;
-- Group by Recovery_Detail.Fees_Percent; /* SWL 04/01/04 52653 */
/* SWL 11/10/03 # 52743 */
CURSOR Event_Client_Unit IS
Select e.Client_Field_Data as Unit
From Event_Client_Field e, recovery r
Where r.Event_ID = e.Event_ID
AND r.Recovery_ID = V_Recovery_ID
AND e.Client_Field_Name = 'UNIT';
CURSOR Bill_totals IS
Select mv_billdetail_case_sum.sum_paid as TOTAL_MEDICAL
From mv_billdetail_case_sum
where mv_billdetail_case_sum.event_id = V_Event_ID;
CURSOR NonCash_Fee IS
Select NVL(Sum(Recovery.Amount), 0) as Total_NonCash_Fee
From Settlement, Recovery
Where Recovery.Recovery_ID = V_Recovery_ID
And Settlement.Settlement_id = Recovery.Settlement_id
And Recovery.
Recovery_Transaction_Internal in ('05', '50', '52', '51');
/* SWL 04/01/04 52653 */
CURSOR Recovery_Totals IS
Select round(avg(NVL(Recovery_Detail.Fees_Percent, 0) +
NVL(Recovery_Detail.Admin_Percent, 0)),
2) as Total_Fee_Percent,
round(avg(NVL(Recovery_Detail.Fees_Percent, 0)), 2) as Subrogation_Fee_Percent,
max(NVL(Recovery.Amount, 0)) as Recovery_Amount,
Sum(NVL(Recovery_detail.Fees, 0) + NVL(Recovery_Detail.Admin, 0)) as Total_Fee,
Sum(NVL(Recovery_Detail.Fees_Taxes, 0) +
NVL(Recovery_Detail.Admin_Taxes, 0)) as Total_Tax,
Sum(NVL(Recovery_Detail.Admin_Taxes, 0)) as Administrative_tax,
Sum(NVL(Recovery_Detail.Admin, 0)) as Total_Admin_Fee
From Settlement, Recovery, Recovery_Detail
Where Recovery.Recovery_ID = V_Recovery_ID
And Settlement.Settlement_id = Recovery.Settlement_id
And Recovery.Recovery_id = Recovery_detail.Recovery_id(+)
Group by Recovery_Detail.recovery_id;
CURSOR Recovery_Totals_Positive IS
/* Select Sum(Recovery.Amount) as Total_NonCash_Positive,
Sum(NVL(Recovery_Detail.Fees_Taxes,0)+ NVL(Recovery_Detail.Admin_Taxes,0)) as Total_NonCash_Tax_Positive
*/ /* SWL 04/01/04 52653 */
Select max(Recovery.Amount) as Total_NonCash_Positive,
Sum(NVL(Recovery_Detail.Fees_Taxes, 0) +
NVL(Recovery_Detail.Admin_Taxes, 0)) as Total_NonCash_Tax_Positive
From Settlement, Recovery, Recovery_detail
Where Recovery.Recovery_ID = V_Recovery_ID
And Settlement.Settlement_id = Recovery.Settlement_id
And Recovery.Amount >= 0
And Recovery.Recovery_id = Recovery_detail.Recovery_id(+)
And Recovery.Recovery_Transaction_Internal in ('04', '17', '15') /*SWL 10/05/04 #63919*/--*009* added 15
Group by Recovery_Detail.recovery_id;
-- Group by Recovery_Detail.Fees_Percent; /* SWL 04/01/04 52653 */
CURSOR Recovery_NonFEE_Positive IS
Select Sum(NVL(Recovery_Detail.Fees, 0) + NVL(Recovery_Detail.Admin, 0)) as Total_NonCash_Fee_Positive
From Settlement, Recovery, Recovery_detail
Where Recovery.Recovery_ID = V_Recovery_ID
And Settlement.Settlement_id = Recovery.Settlement_id
And Recovery.Amount >= 0
And Recovery.Recovery_id = Recovery_detail.Recovery_id(+)
And Recovery.Recovery_Transaction_Internal in
('05', '50', '52', '51')
Group by Recovery_Detail.recovery_id;
-- Group by Recovery_Detail.Fees_Percent; /* SWL 04/01/04 52653 */
CURSOR Recovery_Totals_Negative IS
/* Select Sum(Recovery.Amount) as Total_NonCash_Negative,*/ /* SWL 04/01/04 52653 */
Select max(Recovery.Amount) as Total_NonCash_Negative,
Sum(NVL(Recovery_Detail.Fees_Taxes, 0) +
NVL(Recovery_Detail.Admin_Taxes, 0)) as Total_NonCash_Tax_Negative
From Settlement, Recovery, Recovery_Detail
Where Recovery.Recovery_ID = V_Recovery_ID
And Settlement.Settlement_id = Recovery.Settlement_id
And Recovery.Amount < 0
And Recovery.Recovery_id = Recovery_detail.Recovery_id(+)
And Recovery.Recovery_Transaction_Internal in ('04', '17', '15') /*SWL 10/05/04 #63919*/--*009* added 15
Group by Recovery_Detail.recovery_id;
-- Group by Recovery_Detail.Fees_Percent; /* SWL 04/01/04 52653 */
CURSOR Recovery_NonFEE_Negative IS
Select Sum(NVL(Recovery_Detail.Fees, 0) + NVL(Recovery_Detail.Admin, 0)) as Total_NonCash_Fee_Negative
From Settlement, Recovery, Recovery_Detail
Where Recovery.Recovery_ID = V_Recovery_ID
And Settlement.Settlement_id = Recovery.Settlement_id
And Recovery.Amount < 0
And Recovery.Recovery_id = Recovery_detail.Recovery_id(+)
And Recovery.Recovery_Transaction_Internal in
('05', '50', '52', '51')
Group by Recovery_Detail.recovery_id;
-- Group by Recovery_Detail.Fees_Percent; /* SWL 04/01/04 52653 */
--This is a generic cursor which will be used to control the number of rows inserted into the recovery_activity table
--There has to be 1 row inserted into the recovery_activity table for each detail record in the recovery_detail table.
--However, if no recovery_detail record exists there will be only 1 insert into the recovery_activity table.
CURSOR Control_Detail_Loop
IS
Select 1
FROM Recovery,
Recovery_Detail
Where Recovery.Recovery_ID = Recovery_Detail.Recovery_ID(+)
And Recovery.Recovery_ID = V_Recovery_ID;
/* SWL 04/01/04 Commented since the only time there were more entries in rd for a recovery is when there is a split fees */
/* accounting does not want this to be displayed in detail. They need this aggregated as a single fee entry so the recovery */
/* activity table will now have a single entry corresponding to each recovery in the recovery table. (#52653) */
CURSOR Control_Detail_Loop IS
Select 1 FROM Recovery where Recovery.Recovery_ID = V_Recovery_ID;
/* DJ 10/25/04 # 64633 start*/
CURSOR Event_Client_Market IS
Select e.Client_Field_Data as Market
From Event_Client_Field e, recovery r
Where r.Event_ID = e.Event_ID
AND r.Recovery_ID = V_Recovery_ID
AND e.Client_Field_Name = 'MARKET';
/* DJ 10/25/04 # 64633 end*/
v_cur_day integer := 0;
-----dj
v_vendor_fee_wh number;
v_total_vendor_fee_wh number;
v_rec_itc recovery_activity.recovery_transaction_internal%type;
--v_settlement_id settlement.settlement_id%type;
--*004* start
function unbundled_fee(pevent_id event.event_id%type,
plowdate date,
phighdate date) return number is
-- function variables
v_fee number(18, 2) := 0;
v_month_revenue unbundled_recoveries.monthly_revenue%type := 0;
v_cum_revenue unbundled_recoveries.cum_revenue%type := 0;
v_contract_fee_per unbundled_recoveries.contractual_fee_per%type := 0;
v_prev_cum_revenue unbundled_recoveries.cum_revenue%type := 0;
v_cum_ub_rec unbundled_recoveries.cum_ub_recoveries%type := 0;
v_cum_inv_paid unbundled_recoveries.cum_inv_paid%type := 0;
v_month_rec unbundled_recoveries.monthly_recoveries%type := 0;
v_cum_rec unbundled_recoveries.cum_recoveries%type := 0;
v_event_id event.event_id%type;
begin
--v_month_rec and v_cum_inv_paid
begin
select event_id,
(select sum(r.amount)
from recovery r
where r.event_id = e.event_id
and trunc(r.recovery_date) between plowdate and phighdate) as monthly_recoveries,
-- *006* added cum_rec
(select nvl(sum(r.amount), 0)
from recovery r
where r.event_id = e.event_id
and trunc(r.recovery_date) <= trunc(phighdate)) as cum_recoveries,
(select sum(decode(nvl(ex.client_invoice_closed, 'N'),
'N',
ex.paid_amount,
ex.client_invoice_received))
from expense ex
where ex.event_id = e.event_id
and upper(ex.status) = 'PAID'
and trunc(ex.check_date) <= phighdate
and trim(ex.orig_client_invoice_date) is not null
and nvl(ex.client_invoice_dispute, 'Y') = 'N') as cum_invoiced_paid
into v_event_id, v_month_rec, v_cum_rec, v_cum_inv_paid
from event e
where e.event_id = pevent_id;
exception
when no_data_found then
v_event_id := 0;
v_month_rec := 0;
v_cum_rec := 0;
v_cum_inv_paid := 0;
when others then
v_event_id := 0;
v_month_rec := 0;
v_cum_rec := 0;
v_cum_inv_paid := 0;
end;
-- *007* start
-- if event previously written to table, get values from table
begin
select nvl(ub.cum_revenue, 0)
into v_prev_cum_revenue
from unbundled_recoveries ub
where ub.event_id = pevent_id
and ub.month_id =
(select max(a.month_id)
from unbundled_recoveries a
where a.event_id = pevent_id
and a.month_id < to_char(v_lowdate, 'YYYYMM'));
exception
when no_data_found then
v_prev_cum_revenue := 0;
when others then
v_prev_cum_revenue := 0;
end;
-- *007* end
--v_contract_fee_per
begin
select nvl(max(rd.fees_percent), 0)
into v_contract_fee_per
from recovery_detail rd
where rd.recovery_id in
(select r.recovery_id
from recovery r,
(select a.event_id, max(amount) as amount
from recovery a
where a.event_id = pevent_id
and trunc(a.recovery_date) between plowdate and
phighdate
group by a.event_id) max_r
where r.event_id = max_r.event_id
and trunc(r.recovery_date) between plowdate and phighdate
and r.amount = max_r.amount);
exception
when no_data_found then
v_contract_fee_per := 0;
when others then
v_contract_fee_per := 0;
end;
v_cum_ub_rec := nvl(v_cum_rec, 0) - nvl(v_cum_inv_paid, 0);
if ((nvl(v_cum_ub_rec, 0) > 0) and (nvl(v_month_rec, 0) <> 0)) then
-- latest cumulative unbundled recoveries > 0
v_cum_revenue := round(((v_contract_fee_per / 100) * v_cum_ub_rec),
2);
v_month_revenue := v_cum_revenue - v_prev_cum_revenue;
end if;
v_fee := v_month_revenue;
return v_fee;
exception
when others then
raise_application_error(-20106,
substr('populate_recovery_activity.undebundled_fee: ' ||
Sqlcode || Sqlerrm,
1,
500));
return v_fee;
end;

Similar Messages

  • Please help me with modifying this code

    I am using the attached code to acauire and save data to a text file, using 'write measurement file' express VI.
    WHat I want to do is to replace 'write to measurement VI' with low-level file I/O VIs. I tried to convert the express VI, but the obtained code is too complicated.
    Anyone can give me hints for using file I/O Vis to implement same function without using the express VI? Thanks a lot.
    Message Edited by Dejun on 08-27-2007 11:26 AM
    Attachments:
    4.png ‏14 KB
    code.vi ‏121 KB

    Above code is in a case of an event structure, i.e., each time I click a buttom, such as 'RUN', data acquisition begins and write data into a file.
    What I want is, each time this event case is executed, a file is open, write data to it, and finally close this file. The next time when I run this case, maybe another file is open for writting data.
    The problem of using 'write measure file' express VI is: if a file is open in one execution of the case, it will continuously be in 'open' after this case execution is finished, i.e., there is no explicit close file function with the express VI, which in some cases may be a problem. What I need is closing the file at the end of each execution of a event case. With low-level file I/O VIs, maybe I can directly put a close file VI there.
    The data file should be in text format so that data analysis software, such as MS-powerpoint, can directly reads it.
    Message Edited by Dejun on 08-27-2007 01:55 PM
    Message Edited by Dejun on 08-27-2007 01:56 PM

  • Help:Unable to get the Current Month Data

    Hello Folks,
    Hello Folks i have this scenario where i need to modify this code so that it has to return data from the Current month First Day to the previous Day if its a daily report and previous month data if its a monthly report.
    BEGIN
    if v_lowdate is null or v_highdate is null then
    select to_number(to_char(sysdate, 'DD')) into v_cur_day from dual;
    if v_cur_day < 25 then
    -- this is for the previous month run
    Select Add_Months(trunc(sysdate, 'MONTH'), -1)
    INTO V_LOWDATE
    FROM DUAL;
    SELECT Last_Day(ADD_Months(Sysdate, -1)) INTO V_Highdate From Dual;
    else
    -- this is for the current month run
    Select trunc(sysdate, 'MONTH') INTO V_LOWDATE FROM DUAL;
    SELECT Last_Day(Sysdate) INTO V_Highdate From Dual;
    end if;
    end if;
    I have replaced the above code with the code below but its still returning the previous month Data. Any help would be appreciated.
    v_lob := get_admin_value(p_admin_procedure_name => 'CLIENT_DATAFEED_CODE',p_err_msg => v_error_text);
    if v_lowdate is null or v_highdate is null then
    v_cur_day := TO_CHAR (SYSDATE, 'DD');
    IF report_type = 'D' -- Daily report
    AND v_cur_day > '01' -- (except when run on 1st of the month)
    THEN -- will cover from
    v_lowdate := TRUNC (SYSDATE, 'MONTH'); -- 1st of this month to
    v_highdate := TRUNC (SYSDATE - 1); -- yesterday
    ELSIF report_type = 'M' -- Monthly report
    OR ( report_type = 'D' -- (or Daily report
    AND v_cur_day = '01' -- if run on the 1st of the month)
    ) -- will cover from
    THEN
    v_lowdate := ADD_MONTHS ( TRUNC (SYSDATE, 'MONTH')
    , -1
    ); -- 1st of last month
    v_highdate := TRUNC (SYSDATE, 'MONTH') - 1; -- last day of last month
    END IF;
    END IF:

    How are you testing this? It works for me, or at least generates the dates I think you want.
    SQL> var fake VARCHAR2(25);
    SQL> var report_type VARCHAR2(1);
    SQL> exec :fake := '16-oct-2009'; :report_type := 'M';
    PL/SQL procedure successfully completed.
    SQL> DECLARE
      2     v_cur_day  VARCHAR2(2);
      3     v_lowdate  DATE;
      4     v_highdate DATE;
      5     fake_date  DATE := TO_DATE(:fake, 'dd-mon-yyyy');
      6  BEGIN
      7     v_cur_day := TO_CHAR (fake_date, 'DD');
      8     IF :report_type = 'D' AND v_cur_day > '01' THEN
      9        v_lowdate := TRUNC (fake_date, 'MONTH'); -- 1st of this month to
    10        v_highdate := TRUNC (fake_date - 1); -- yesterday
    11     ELSIF :report_type = 'M' OR (:report_type = 'D' AND v_cur_day = '01') THEN
    12        v_lowdate := ADD_MONTHS ( TRUNC (fake_date, 'MONTH'), -1); -- 1st of last month
    13        v_highdate := TRUNC (fake_date, 'MONTH') - 1; -- last day of last month
    14     END IF;
    15     DBMS_OUTPUT.Put_Line('Low: '||TO_CHAR(v_lowdate, 'dd-mon-yyyy'));
    16     DBMS_OUTPUT.Put_Line('High: '||TO_CHAR(v_highdate, 'dd-mon-yyyy'));
    17  END;
    18  /
    Low: 01-sep-2009
    High: 30-sep-2009
    PL/SQL procedure successfully completed.
    SQL> exec :report_type := 'D';
    PL/SQL procedure successfully completed.
    SQL> /
    Low: 01-oct-2009
    High: 15-oct-2009
    PL/SQL procedure successfully completed.
    SQL> exec :fake := '01-oct-2009';
    PL/SQL procedure successfully completed.
    SQL> /
    Low: 01-sep-2009
    High: 30-sep-2009
    PL/SQL procedure successfully completed.John

  • Current Months Data - Automatic

    How to run a YTD report which will automatically show the current months data with no variable prompt for the same...?
    Is there any such variable which will run a report only for current months data.

    I dont think there is a std variable for current period. rather you can use fiscalyear/period time char and use 0FPER to derive current fiscalyear/period

  • Calc script for calculating current month data after loading

    Hi,
    I'm trying to write a script to do a calculation to all dimension after load current month data; it ran successfully but current month data is all zero; can someone tell me what i'm doing wrong?
    SET CACHE HIGH;
    SET UPDATECALC OFF;
    SET CALCPARALLEL 4;
    FIX (&CurMon, &CurYr)
    AGG (Sparse2, Sparse3, Sparse 4, Sparse 5, Sparse 6);
    ENDFIX
    Dense1 – Dynamic Calc
    Period: Dense – Dynamic Calc
    Year: Sparse – Dynamic Calc
    Sparse2 – Label Only
    Sparse3 – Label Only
    Sparse 4– Label Only
    Sparse5 – Label Only
    Sparse6 – Label Only
    Thanks!

    Natilie,
    If I understand you correctly, you are loading data, then clearing out the current month->current year, and then aggregating current month->current year? There isn't going to be any data there -- you've cleared it out in your second step.
    I think the order you want is:
    1) Clear out the current month->current year to be sure it's a good load
    2) Load the current month->current year
    3) Aggregate the current month->current year
    This could be done with a single Maxl that controls two calc scripts and one import database (clear, import, agg) or you could do it manually.
    The default calc is (generally) equivalent to CALC ALL using db properties (UPDATECALC, AGGMISSG, etc.). There shouldn't be practical difference between that and the AGG portion of your calc.
    I would again confirm that all of your data is at the lowest level, i.e., you can navigate to leaf level on all dimensions and pull a data value before you aggregate. Perhaps you are loading to upper level members and don't realize it. I often use the Excel add-in's Styles to tell me if I'm at the lowest level of a db or not.
    Regards,
    Cameron Lackpour

  • Please help me to complete this code

    import java.security.MessageDigest;
    import java.util.Map;
    import java.util.Scanner;
    public class PasswordService
       //The hash is to be formed using the SHA algorithm
       //to create a MessageDigest
       private final String algorithmName = "SHA";
       //Use a message digest to create hashed passwords
       private MessageDigest md = null;
       //We simulate a database of users using who have a login and password
       //as a key and value pair in a Map
       private Map<String, byte[]> userData;
       //complete the constructor
       public PasswordService()
         //TODO - intialize the class instance data
          //some dummy data - do not alter these lines
          addUser("daddy", "cool");
          addUser("nightflight", "topChat");
          addUser("boney", "2E5sxuSRg6A");
       public void showProvider()
          //TODO
       //Get the hash value for the provided string password.
         public byte[] getHash(String password)
          //TODO
          return null;
       public void addUser(String login, String password)
          //TODO
       public byte[] getPassword(String login)
          //TODO
          return null;
       public boolean checkLogin(String login, String password)
         // TODO
          return false;
       //This method is provided to perform a login from the command line
       public boolean doLogin()
          Scanner sc = new Scanner(System.in);
          System.out.println("Enter login please");
          String login = sc.next();
          System.out.println("Your password please");
          String password = sc.next();
          return checkLogin(login, password);
       public static void main(String[] args)
          int attempts = 0;
          showProvider();
          while(attempts < 4)
             boolean match = doLogin(); //request login and password
             System.out.println("match? " + match);
             attempts++;
    }

    please help me to complete this code
    void completeCode(Code code,Properties options) throws CodeCompletingException
    CodeCompleterFactory cf = CodeCompleterFactory.newInstance();
    CodeCompleter cc = cf.newCodeCompleter();
    cc.complete(code,options);
    }

  • I forgot restrictions cod in ipad air1 and don't off it , please help me for recovery this cod

    i forgot restrictions cod in ipad air1 and don't off it , please help me for recovery this cod...

    Locked Out, Forgot Lock or Restrictions Passcode, or Need to Restore Your Device: Several Alternative Solutions
    A
    1. iOS- Forgotten passcode or device disabled after entering wrong passcode
    2. iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
    3. Restoring iPod touch after forgotten passcode
    4. What to Do If You've Forgotten Your iPhone's Passcode
    5. iOS- Understanding passcodes
    6. iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad
    7. iOS - Unable to update or restore
    Forgotten Restrictions Passcode Help
                iPad,iPod,iPod Touch Recovery Mode
    You will need to restore your device as New to remove a Restrictions passcode. Go through the normal process to restore your device, but when you see the options to restore as New or from a backup, be sure to choose New.
    You can restore from a backup if you have one from BEFORE you set the restrictions passcode.
    Also, see iTunes- Restoring iOS software.
    And also see How to Recover Forgotten iPhone, iPad Restrictions Passcode.

  • Can someone please tell me on how to modify this code so that I dont have to enter the file name at all?

    Hello
    can someone please tell me how to modify this code so that I dont have to enter the file path at all? When i give the same file path constants to both the read and write VIs I'm getting an error message.
    Attachments:
    read and write.vi ‏11 KB

    Yup use the low level File I/O opening the reference once, and closing it once.  
    As for the path selection you have an unwired input which is the path to use.  Programatically set that and you won't be prompted to select a path.  Usually this is done with a path constant to a folder, then using the Build Path, to set the file name in that folder.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • How to take last months date to current month date

    Hi,
    I am designing a report wherein the data should range from 12:01am on the 28th day of the previous month to 11:59 pm on the 27th of the current month..  Also this report would be scheduled accordingly and I should  not be able to modify the report every month.  What is the formula that should go into it.
    Any help will be greatly appreciated!
    Thanks & Regards
    Cauvery

    Hi Cauvery,
    try to use the following formula :
    Local DateTimeVar A;
    Local DateTimeVar From_;
    Local DateTimeVar To__;
    A:=today;
    if Month(A)=1
    then From_:=Datetime(year(A),12,28,0,1,0)
    else From_:=Datetime(year(A),Month(A)-1,28,0,1,0);
    To__:=Datetime(year(A),Month(A),27,23,59,0);
    Regards
    Edited by: jeecech on Apr 17, 2009 9:37 AM

  • How to return current month

    Hi,
    I need to return the current month.
    I tried this
    Time."Month" = MonthName(current_date)
    and
    Time."Month" = Month(current_date)
    both give me an error.
    I should return, Oct-09. Any idea?
    Regards
    G.

    Hi ,
    This is what I wrote I tried in my thread.
    The dimension is time and the measures is Month (Time."Month")
    I put month(CURRENT_DATE) in the fx of Time."Month" and returned the error:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 42021] The query does not reference any tables. (HY000)
    SQL Issued: SELECT MONTH(current_date) saw_0 FROM RESV_PACE ORDER BY saw_0
    Than I tried to put it as a SQL filter instead (on Time."Month" measure, Add Filter->Advanced->Convert this to sql filter
    and returned the following error:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 59001] Binary Logical operation is not permitted on VARBINARY, INTEGER operand(s). (HY000)
    SQL Issued: SELECT Time."Month" saw_0 FROM RESV_PACE WHERE Time."Month" = month(CURRENT_DATE) ORDER BY saw_0
    Regards
    G.

  • TCURR date HElp needed

    I have the following statement in an end routine transformation:
    READ TABLE GT_CURR
    WITH KEY  GDATU = <RESULT_FIELDS>-BILL_DATE
                                      FCURR = 'MXN'
                                     TCURR = 'USD'
    INTO GWA_CURR
    BINARY SEARCH.
    I found this fm CONVERSION_EXIT_INVDT_OUTPUT but have no ideea how to integrate it.
    I need to compare the date in the TCURR table with the bill date. They have different format.
    please help
    Help will be appreciated.
    Thank you
    Ramona

    Hi,
    If you are looking for the validation between Bill  date and TCURR date, Then...
    1. Goto se11 --> TCURR table.
    2. Display all the contents
    3. Goto Setting --> User setting --> Select "Converison Exixt"
    If you are looking for look up, then we need to  call this FM to convert into YYYYMMDD format and compare.
    Thanks,
    Saravana Kumar p.

  • SQL Query-return current month and the same month of last year

    hello-
    I would like to display the current month name, count of errors, year, and month number for both current year and previous year. Having trouble getting my query to display as following..... 
    Month   CountofErrors      Year      MoNo
    January                  57    2015          1
    January                 155   2014          1
    thank you!

    Its hard to answer without DDL and DML and sample data.
    Give a try
    select DATENAME(month,getdate()),Month(getdate()),YEAR(getdate()) ,COUNT(*) from dbo.errortable
    where DATENAME(month,getdate())='January' and YEAR(getdate()) in(YEAR(getdate()),YEAR(getdate())-1)
    group by DATENAME(month,getdate()),Month(getdate()),YEAR(getdate())
    --Prashanth

  • Help needed in understanding the code.

    Hi All,
    I am just trying to understand the Java code in one Self Serice page. However, I am having tough in understanding the CO code. In the prosessRequest class, I have the below code.
    oapagecontext.putTransactionValue("AddAssignmentInsertRowFlag", "N");
    oaapplicationmodule.getTransaction().commit();
    As soon as, oaapplicationmodule.getTransaction().commit();
    gets executed, its calling some other class. Not sure what is being called, but i can see the log messages that its executing some other class which actually does the calls to DB APIs and inserting data into main tables.
    Can you please explain me what is being called to make DB API calls. I would greatly appreciate your help.
    Thanks in Advance!
    - Rani
    ****************************Here is the full code of class for your reference****************************
    public void processFormRequest(OAPageContext oapagecontext, OAWebBean oawebbean)
    if("SelectedResourceLink".equals(oapagecontext.getParameter("event")))
    Debug.log(oapagecontext, this, "SelectedResourceLink has been pressed", 3);
    oapagecontext.redirectImmediately("OA.jsp?akRegionCode=PA_SELECTED_RESOURCES_LAYOUT&akRegionApplicationId=275", true, "RP");
    String s = (String)oapagecontext.getTransactionValue("AssignmentType");
    super.processFormRequest(oapagecontext, oawebbean);
    Debug.log(oapagecontext, this, "in processFormRequest()", 3);
    OAApplicationModule oaapplicationmodule = oapagecontext.getRootApplicationModule();
    if(!"Y".equals(oapagecontext.getParameter("paMass")))
    String s1 = oapagecontext.getParameter("event");
    if("lovUpdate".equals(s1))
    Debug.log(oapagecontext, this, "*** User Selected a value from LOV ***", 3);
    String s3 = oapagecontext.getParameter("source");
    Debug.log(oapagecontext, this, "*** lovInputSourceId = " + s3 + " ***", 3);
    if("ProjectNumber".equals(s3) && "Project".equals(s))
    Hashtable hashtable = oapagecontext.getLovResultsFromSession(s3);
    String s10 = (String)hashtable.get("ProjectId");
    Debug.log(oapagecontext, this, "*** ProjectId ***" + s10, 3);
    oapagecontext.putTransactionValue("paProjectId", s10);
    if("Project".equals(s))
    Debug.log(oapagecontext, this, "*** Setting default value for Delivery assignment ***", 3);
    oaapplicationmodule.invokeMethod("defaultProjectAttrs");
    if("RoleName".equals(s3))
    Hashtable hashtable1 = oapagecontext.getLovResultsFromSession(s3);
    Debug.log(oapagecontext, this, "*** RoleName Hashtable Contents ***" + hashtable1.toString(), 3);
    String s11 = (String)hashtable1.get("RoleId");
    Debug.log(oapagecontext, this, "*** RoleId ***" + s11, 3);
    Debug.log(oapagecontext, this, "*** AssignmentType = " + s + "***", 3);
    if("Open".equals(s))
    Debug.log(oapagecontext, this, "*** Calling defaultJobAttrs for Open Assignment***", 3);
    Serializable aserializable[] = {
    s11
    oaapplicationmodule.invokeMethod("defaultJobAttrs", aserializable);
    if("Template".equals(s) || "Open".equals(s))
    Debug.log(oapagecontext, this, "*** Defaulting Competencies ***" + s11, 3);
    OAViewObject oaviewobject = (OAViewObject)oapagecontext.getApplicationModule(oawebbean).findViewObject("RoleCompetenciesVO");
    oaviewobject.setMaxFetchSize(-1);
    oaviewobject.setWhereClauseParam(0, s11);
    oaviewobject.executeQuery();
    Debug.log(oapagecontext, this, "*** End LOV event ***", 3);
    String s4 = "";
    String s8 = "";
    OASubTabLayoutBean oasubtablayoutbean1 = (OASubTabLayoutBean)oawebbean.findIndexedChildRecursive("AddAssignmentSubTabLayout");
    if("Project".equals(s) && !oasubtablayoutbean1.isSubTabClicked(oapagecontext))
    OAViewObject oaviewobject1 = (OAViewObject)oapagecontext.getApplicationModule(oawebbean).findViewObject("AddNewAssignmentVO");
    s4 = (String)oaviewobject1.first().getAttribute("ProjectId");
    s8 = (String)oaviewobject1.first().getAttribute("ProjectNumber");
    Debug.log(oapagecontext, this, "*** lProjectId = " + s4, 3);
    Debug.log(oapagecontext, this, "*** lProjectNumber = " + s8, 3);
    if("Project".equals(s) && !oasubtablayoutbean1.isSubTabClicked(oapagecontext) && !StringUtils.isNullOrEmpty(s8))
    Debug.log(oapagecontext, this, "Delivery Assignment, Project Number is there but no Project Id", 3);
    if(s4 == null || s4.equals(""))
    ViewObject viewobject = oapagecontext.getApplicationModule(oawebbean).findViewObject("ObtainProjectId");
    if(viewobject == null)
    String s14 = "SELECT project_id FROM PA_PROJECTS_ALL WHERE segment1 =:1";
    viewobject = oaapplicationmodule.createViewObjectFromQueryStmt("ObtainProjectId", s14);
    viewobject.setWhereClauseParam(0, s8);
    viewobject.executeQuery();
    int j = viewobject.getRowCount();
    if(j != 1)
    Debug.log(oapagecontext, this, "Error : Project Number is Invalid or not unique", 3);
    OAException oaexception4 = null;
    oaexception4 = new OAException("PA", "PA_PROJECT_NUMBER_INVALID");
    oaexception4.setApplicationModule(oaapplicationmodule);
    throw oaexception4;
    oracle.jbo.Row row = viewobject.last();
    if(row != null)
    Object obj2 = row.getAttribute(0);
    if(obj2 != null)
    s4 = obj2.toString();
    if(s4 != null)
    oapagecontext.putTransactionValue("paProjectId", s4);
    if(oaapplicationmodule.findViewObject("AddNewAssignmentsVO") != null)
    oaapplicationmodule.findViewObject("AddNewAssignmentVO").first().setAttribute("ProjectId", s4);
    } else
    Debug.log(oapagecontext, this, "Error : No rows returned in Project Number query", 3);
    OAException oaexception5 = null;
    oaexception5 = new OAException("PA", "PA_PROJECT_NUMBER_INVALID");
    oaexception5.setApplicationModule(oaapplicationmodule);
    throw oaexception5;
    String s12 = "F";
    if(s4 != null && !s4.equals(""))
    String s13 = Security.checkUserPrivilege("PA_ASN_CR_AND_DL", "PA_PROJECTS", s4, oapagecontext, false);
    if("F".equals(s13))
    OAException oaexception3 = null;
    oaexception3 = new OAException("PA", "PA_ADD_DELIVERY_ASMT_SECURITY");
    oaexception3.setApplicationModule(oaapplicationmodule);
    Debug.log(oapagecontext, this, "ERROR:" + oaexception3.getMessage(), 3);
    throw oaexception3;
    OAViewObject oaviewobject2 = (OAViewObject)oapagecontext.getApplicationModule(oawebbean).findViewObject("AddNewAssignmentVO");
    Object obj = oaviewobject2.first().getAttribute("BillRateOverride");
    Object obj1 = oaviewobject2.first().getAttribute("BillRateCurrOverride");
    Object obj3 = oaviewobject2.first().getAttribute("MarkupPercentOverride");
    Object obj4 = oaviewobject2.first().getAttribute("DiscountPercentOverride");
    Object obj5 = oaviewobject2.first().getAttribute("TpRateOverride");
    Object obj6 = oaviewobject2.first().getAttribute("TpCurrencyOverride");
    Object obj7 = oaviewobject2.first().getAttribute("TpCalcBaseCodeOverride");
    Object obj8 = oaviewobject2.first().getAttribute("TpPercentAppliedOverride");
    Object obj9 = null;
    Object obj10 = null;
    Debug.log(oapagecontext, this, "in AddAssignmentsTopCO processFcstInfoRg(): getting the implementation options", 3);
    Object obj11 = oaviewobject2.first().getAttribute("BrRateDiscReasonCode");
    Object obj12 = oapagecontext.getTransactionValue("rateDiscReasonFlag");
    Object obj13 = oapagecontext.getTransactionValue("brOverrideFlag");
    Object obj14 = oapagecontext.getTransactionValue("brDiscountOverrideFlag");
    String s22 = oapagecontext.getParameter("BillRateRadioGroup");
    if("BRCurrencyRadioButton".equals(s22))
    Debug.log(oapagecontext, this, "BRCurrencyRadioButton chosen", 3);
    if(obj == null || obj1 == null)
    Debug.log(oapagecontext, this, "error", 3);
    OAException oaexception6 = new OAException("PA", "PA_CURR_BILL_RATE_REQUIRED");
    oaexception6.setApplicationModule(oaapplicationmodule);
    throw oaexception6;
    } else
    if("BRMarkupRadioButton".equals(s22))
    Debug.log(oapagecontext, this, "BRMarkup%RadioButton chosen", 3);
    if(obj3 == null)
    Debug.log(oapagecontext, this, "error", 3);
    OAException oaexception7 = new OAException("PA", "PA_MARKUP_PERCENT_REQUIRED");
    oaexception7.setApplicationModule(oaapplicationmodule);
    throw oaexception7;
    } else
    if("BRDiscountRadioButton".equals(s22))
    Debug.log(oapagecontext, this, "BRDiscount%RadioButton chosen", 3);
    if(obj4 == null)
    Debug.log(oapagecontext, this, "error", 3);
    OAException oaexception8 = new OAException(oapagecontext.getMessage("PA", "PA_DISCOUNT_PERCENT_REQUIRED", null));
    oaexception8.setApplicationModule(oaapplicationmodule);
    throw oaexception8;
    if("Y".equals(oapagecontext.getTransactionValue("paMass")) || "Admin".equals(s) || "Template".equals(s))
    Debug.log(oapagecontext, this, "Need not have this check for team templates ", 3);
    } else
    if(obj13 != null && obj13.equals("Y") && obj12 != null && obj12.equals("Y") && "BRCurrencyRadioButton".equals(s22) && StringUtils.isNullOrEmpty((String)obj11))
    Debug.log(oapagecontext, this, "error 1", 3);
    OAException oaexception9 = new OAException("PA", "PA_RATE_DISC_REASON_REQUIRED");
    oaexception9.setApplicationModule(oaapplicationmodule);
    throw oaexception9;
    if(obj14 != null && obj14.equals("Y") && obj12 != null && obj12.equals("Y") && "BRDiscountRadioButton".equals(s22) && StringUtils.isNullOrEmpty((String)obj11))
    Debug.log(oapagecontext, this, "error 2", 3);
    OAException oaexception10 = new OAException("PA", "PA_RATE_DISC_REASON_REQUIRED");
    oaexception10.setApplicationModule(oaapplicationmodule);
    throw oaexception10;
    Debug.log(oapagecontext, this, "*** Selected transfer price radio shr = " + s22, 3);
    oapagecontext.putTransactionValue("BROGroupSelected", s22);
    Debug.log(oapagecontext, this, "*** 1 :Selected bill rate radio = " + s22, 3);
    if(s22 != null)
    oapagecontext.putSessionValue("BROGroupSelected", s22);
    s22 = oapagecontext.getParameter("TransferPriceRadioGroup");
    Debug.log(oapagecontext, this, "*** Selected transfer price radio = " + s22, 3);
    if("TPCurrencyRadioButton".equals(s22))
    Debug.log(oapagecontext, this, "***TPCurrencyRadioButton chosen", 3);
    if(obj5 == null || obj6 == null)
    Debug.log(oapagecontext, this, "error", 3);
    OAException oaexception11 = new OAException("PA", "PA_CURR_RATE_REQUIRED");
    oaexception11.setApplicationModule(oaapplicationmodule);
    throw oaexception11;
    } else
    if("TPBasisRadioButton".equals(s22))
    Debug.log(oapagecontext, this, "***TPBasisRadioButton chosen", 3);
    if(obj7 == null || obj8 == null)
    Debug.log(oapagecontext, this, "error", 3);
    OAException oaexception12 = new OAException("PA", "PA_BASIS_APPLY_PERCENT_REQD");
    oaexception12.setApplicationModule(oaapplicationmodule);
    throw oaexception12;
    oapagecontext.putTransactionValue("TPORadioGroupSelected", s22);
    if(oaapplicationmodule.findViewObject("AddNewAssignmentVO").first().getAttribute("RoleId") != null)
    Debug.log(oapagecontext, this, "*** Role Id is + " + oaapplicationmodule.findViewObject("AddNewAssignmentVO").first().getAttribute("RoleId"), 3);
    if(oapagecontext.getParameter("SearchCompetencies") != null)
    String s2 = "OA.jsp?akRegionCode=PA_COMP_SEARCH_LAYOUT&akRegionApplicationId=275&paCallingPage=AddAssignment";
    oapagecontext.redirectImmediately(s2, true, "RP");
    OASubTabLayoutBean oasubtablayoutbean = (OASubTabLayoutBean)oawebbean.findIndexedChildRecursive("AddAssignmentSubTabLayout");
    if(s.equals("Project") && oasubtablayoutbean.isSubTabClicked(oapagecontext) && !StringUtils.isNullOrEmpty((String)oapagecontext.getTransactionValue("paProjectId")))
    String s5 = "PA_ASN_FCST_INFO_ED";
    String s9 = "F";
    s9 = Security.checkUserPrivilege(s5, "PA_PROJECTS", (String)oapagecontext.getTransactionValue("paProjectId"), oapagecontext, false);
    if(s9.equals("F"))
    Debug.log(oapagecontext, this, "Error : PA_ASN_FCST_INFO_ED previelge not found", 3);
    OAException oaexception2 = null;
    oaexception2 = new OAException("PA", "PA_NO_SEC_FIN_INFO");
    oaexception2.setApplicationModule(oaapplicationmodule);
    throw oaexception2;
    if(oapagecontext.getParameter("GoBtn") != null)
    if("Y".equals(oapagecontext.getTransactionValue("paMass")) && "0".equals(oapagecontext.getTransactionValue("paNumSelectedResources")))
    OAException oaexception = new OAException("PA", "PA_NO_RESOURCE_SELECTED");
    oaexception.setApplicationModule(oapagecontext.getRootApplicationModule());
    Debug.log(oapagecontext, this, "ERROR:" + oaexception.getMessage(), 3);
    throw oaexception;
    String s6 = "T";
    if(s.equals("Admin") && "Y".equals(oapagecontext.getTransactionValue("paMass")) && "1".equals(oapagecontext.getTransactionValue("paNumSelectedResources")))
    Debug.log(oapagecontext, this, "resource id[19] is " + (String)oapagecontext.getTransactionValue("paResourceId"), 3);
    if(oapagecontext.getTransactionValue("AdminSecurityChecked") == null)
    String s7 = Security.checkPrivilegeOnResource("-999", (String)oapagecontext.getTransactionValue("paResourceId"), SessionUtils.getResourceName((String)oapagecontext.getTransactionValue("paResourceId"), oapagecontext), "PA_ADM_ASN_CR_AND_DL", null, oapagecontext, false);
    if("F".equals(s7))
    OAException oaexception1 = new OAException("PA", "PA_ADD_ADMIN_ASMT_SECURITY");
    oaexception1.setApplicationModule(oapagecontext.getRootApplicationModule());
    Debug.log(oapagecontext, this, "ERROR:" + oaexception1.getMessage(), 3);
    throw oaexception1;
    if("SUBMIT_APPRVL".equals(oapagecontext.getParameter("AddAsgmtApplyAction")))
    oapagecontext.putTransactionValue("Save", "N");
    else
    oapagecontext.putTransactionValue("Save", "Y");
    String as[] = oaapplicationmodule.getApplicationModuleNames();
    String as1[] = oaapplicationmodule.getViewObjectNames();
    Debug.log(oapagecontext, this, "no of app module: " + as.length, 3);
    Debug.log(oapagecontext, this, "no of view: " + as1.length, 3);
    for(int i = 0; i < as.length; i++)
    Debug.log(oapagecontext, this, "app module: " + as, 3);
    for(int k = 0; k < as1.length; k++)
    Debug.log(oapagecontext, this, "app module: " + as1[k], 3);
    Debug.log(oapagecontext, this, "*** assignmentType = " + s, 3);
    Debug.log(oapagecontext, this, "*** projectId = " + oapagecontext.getTransactionValue("paProjectId"), 3);
    if("Project".equals(s) && !StringUtils.isNullOrEmpty((String)oapagecontext.getTransactionValue("paProjectId")) && !"Y".equals(oapagecontext.getParameter("paMass")))
    Debug.log(oapagecontext, this, "*** Setting default staffing owner for add delivery assignment -- projectId = " + oapagecontext.getTransactionValue("paProjectId"), 3);
    oaapplicationmodule.invokeMethod("setDefaultStaffingOwner");
    OAViewObject oaviewobject3 = (OAViewObject)oaapplicationmodule.findViewObject("RoleCompetenciesVO");
    oaviewobject3.setMaxFetchSize(0);
    oaviewobject3.setRangeSize(-1);
    oracle.jbo.Row arow[] = oaviewobject3.getAllRowsInRange();
    for(int l = 0; l < arow.length; l++)
    RoleCompetenciesVORowImpl rolecompetenciesvorowimpl = (RoleCompetenciesVORowImpl)oaviewobject3.getRowAtRangeIndex(l);
    Debug.log(oapagecontext, this, "roleCompetenciesVORowImpl" + rolecompetenciesvorowimpl, 3);
    rolecompetenciesvorowimpl.setPlsqlState((byte)0);
    oapagecontext.putTransactionValue("AddAssignmentInsertRowFlag", "N");
    oaapplicationmodule.getTransaction().commit();
    if("Y".equals(oapagecontext.getTransactionValue("paMass")) && !"1".equals(oapagecontext.getTransactionValue("paNumSelectedResources")))
    if(!"SUBMIT_APPRVL".equals(oapagecontext.getParameter("AddAsgmtApplyAction")))
    Debug.log(oapagecontext, this, "Save, Mass, NumSelectedResources>1", 3);
    Debug.log(oapagecontext, this, "work flow has been launched", 3);
    OADialogPage oadialogpage = new OADialogPage((byte)3, new OAException("PA", "PA_MASS_ASSIGNMENT_CONFIRM"), null, "OA.jsp?akRegionCode=PA_RESOURCE_LIST_LAYOUT&akRegionApplicationId=275&addBreadCrumb=N", null);
    oadialogpage.setRetainAMValue(false);
    oapagecontext.redirectToDialogPage(oadialogpage);
    return;
    Debug.log(oapagecontext, this, "SaveAndSubmit, Mass, NumSelectedResources>1", 3);
    putParametersOnSession(oapagecontext);
    int i1 = 0;
    int j1 = 0;
    String s21 = "SelectedResourceId";
    int l1 = Integer.parseInt(oapagecontext.getTransactionValue("paNumSelectedResources").toString());
    Debug.log(oapagecontext, this, "size of resourceArray = " + l1, 3);
    String as2[] = new String[l1];
    for(; !"END".equals(oapagecontext.getTransactionValue(s21.concat(Integer.toString(i1)))); i1++)
    if(oapagecontext.getTransactionValue(s21.concat(Integer.toString(i1))) != null)
    Debug.log(oapagecontext, this, "resource id = " + oapagecontext.getTransactionValue(s21.concat(Integer.toString(i1))).toString(), 3);
    as2[j1] = oapagecontext.getTransactionValue(s21.concat(Integer.toString(i1))).toString();
    j1++;
    SessionUtils.putMultipleParameters("paResourceId", as2, oapagecontext);
    Debug.log(oapagecontext, this, "redirect to Mass Submit for Approval page", 3);
    oapagecontext.redirectImmediately("OA.jsp?akRegionCode=PA_MASS_SUBMIT_LAYOUT&akRegionApplicationId=275&paCallingPage=MassAdd&paProjectId=" + oapagecontext.getTransactionValue("p_project_id"), false, "RP");
    return;
    if("RETURN_TO".equals(oapagecontext.getParameter("AddAsgmtApplyAction")))
    Debug.log(oapagecontext, this, "Return to Option Selected ", 3);
    String s15 = (String)oapagecontext.getTransactionValue("PrevPageUrl");
    int k1 = s15.indexOf("OA.jsp?");
    s15 = s15.substring(k1);
    Debug.write(oapagecontext, this, "*** RETURN_TO URL: " + s15, 3);
    oapagecontext.redirectImmediately(s15);
    } else
    if("ADD_ANOTHER".equals(oapagecontext.getParameter("AddAsgmtApplyAction")))
    Debug.log(oapagecontext, this, "Add Another Option Selected", 3);
    oaapplicationmodule.invokeMethod("resetAddNewAssignment");
    if(oaapplicationmodule.findViewObject("RoleCompetenciesVO") != null)
    oaapplicationmodule.findViewObject("RoleCompetenciesVO").clearCache();
    String s16;
    if(!s.equals("Project") && !s.equals("Admin"))
    s16 = "OA.jsp?akRegionCode=PA_ADD_ASSIGNMENTS_PAGE_LAYOUT&akRegionApplicationId=275&paProjectId=" + oapagecontext.getTransactionValue("paProjectId") + "&paAssignmentType=" + s + "&OA_SubTabIdx=0";
    else
    s16 = "OA.jsp?akRegionCode=PA_ADD_ASSIGNMENTS_PAGE_LAYOUT&akRegionApplicationId=275&paResourceId=" + oapagecontext.getTransactionValue("paResourceId") + "&paAssignmentType=" + s + "&OA_SubTabIdx=0";
    Debug.log(oapagecontext, this, "nextUrl " + s16, 3);
    if("Template".equals(s))
    oapagecontext.redirectImmediately(s16, true, "S");
    else
    oapagecontext.redirectImmediately(s16, false, "S");
    } else
    if("UPDATE_DETAILS".equals(oapagecontext.getParameter("AddAsgmtApplyAction")))
    Debug.log(oapagecontext, this, "Update Details Selected ", 3);
    String s17 = "";
    if("Staffed".equals(s))
    s17 = "ProjStaffedAsmt";
    else
    if("Admin".equals(s))
    s17 = "AdminAsmt";
    else
    if("Project".equals(s))
    s17 = "PersonStaffedAsmt";
    else
    if("Open".equals(s))
    s17 = "OpenAsmt";
    else
    if("Template".equals(s))
    s17 = "TemplateAsmt";
    String s19 = "OA.jsp?akRegionCode=PA_ASMT_LAYOUT&akRegionApplicationId=275&paProjectId=" + oapagecontext.getTransactionValue("paProjectId") + "&paAssignmentId=" + oapagecontext.getTransactionValue("wfOutAssignmentId") + "&paCalledPage=" + s17 + "&addBreadCrumb=RP";
    Debug.log(oapagecontext, this, "UPDATE_DETAILS: URL: " + s19, 3);
    oapagecontext.redirectImmediately(s19, false, "RP");
    if(s.equals("Staffed") || s.equals("Admin") || s.equals("Project"))
    String s18 = (String)oapagecontext.getTransactionValue("wfOutResourceId");
    String s20 = (String)oapagecontext.getTransactionValue("wfOutAssignmentId");
    Debug.log(oapagecontext, this, "outResourceId " + s18, 3);
    Debug.log(oapagecontext, this, "outAssignmentId " + s20, 3);
    if("SUBMIT_APPRVL".equals(oapagecontext.getParameter("AddAsgmtApplyAction")))
    if(s.equals("Staffed"))
    oapagecontext.redirectImmediately("OA.jsp?akRegionCode=PA_SUBMIT_ASMT_APR_LAYOUT&akRegionApplicationId=275&paAsgmtId=" + s20 + "&paResourceId=" + s18 + "&paProjectId=" + oapagecontext.getTransactionValue("paProjectId") + "&paAsgmtAprStatus=ASGMT_APPRVL_WORKING&paAssignmentType=" + s + "&paCallingPage=AddAssignment", false, "RP");
    return;
    oapagecontext.redirectImmediately("OA.jsp?akRegionCode=PA_SUBMIT_ASMT_APR_LAYOUT&akRegionApplicationId=275&paAsgmtId=" + s20 + "&paResourceId=" + s18 + "&paAsgmtAprStatus=ASGMT_APPRVL_WORKING&paAssignmentType=" + s + "&paCallingPage=AddAssignment", false, "RP");

    Hi Rani,
    As soon as the transaction is commited the methods in the VORowImpl Class are called.
    You can check in the VORowImpl class and search for the log messages.
    Thanks,
    Gaurav

  • Help needed in rewriting the code using inner joins

    Hi all,
    I need help in rewriting this code
    DATA :  FLD LIKE ZTABLE-ZFLD,
            FLD1 LIKE ZTABLE2-ZFLD2.
    select single ZFLD from zTABLE1 into FLD
                            where MATNR  = '123' and
                                  werks = 'ABC'.
    select single ZFLD1 from zTABLE2 into FLD1
                            where  zFLD = FLD.    
    iS there way that we can write this with inner joins
    Thanks

    Hi,
    help me out
    TABLE 1 HAS
    MATNR , WERKS , FLD1.
    TABLE 2 HAS
    FLD1, FLD2.
    I KNOW MATNR AND WERKS BASED ON THAT I HAVE TO GET FLD2
    I WANT IT BE WRITTEN WITH INNEWR JOINS
    WITH FOLLOWING COD E I GET AN ERROR MESSAGE SAYING
    comma without preccing colon (after select?)
    data : FLD1 like zTABLE1-ZFLD1.
    data : FLD2 like ZTABLE2-ZFLD2.
    SELECT FZFLD1 BZFLD2
        INTO ( FLD1, FLD2)
        FROM ZTABLE1 AS F INNER JOIN ZTABLE2 AS B
               ON FZFLD1 = BFLD2
        WHERE F~MATNR = '123'
          AND F~WERKS   = 'ABC' .
    Thanks

  • Help needed, M getting this message sandbox environment error no test user account, when downloading any application from iTunes, friend told me to sign out and sign in iTunes it might solve the problem but instead I cannot login I to my itune account.

    Help needed,
    I am getting this message sandbox environment error no test user account, when downloading any application from iTunes, friend told me to sign out and sign in iTunes it might solve the problem , and i triyed it but still  I cannot login I to my itune account. Same message keeping. Popping up,  this problem started supricly today.

    Take a look at the instructions here.
    http://www.technogal.net/2012/03/this-is-not-test-user-account-please.html

Maybe you are looking for