Using Oracle Fast Formula in Discoverer

Hello,
Does anyone have any experience of using Fast Formula in Discoverer - can it be called from a PL/SQL function that would then be registered in the usual way in Discoverer?
Thanks
Rachael

Hi,
Yes, you can wrap the FF_EXEC.run_formula call into your own pl/sql function and map this function into the EUL so that the formula can be called from a workbook.
Rod West

Similar Messages

  • How to use Oracle OAB Fast Formulas in Discoverer-desktop [ for reporting]

    Hi,
    Can anyone tell me how to use a fast formula in discoverer-desktop [for reporting]. Currently, we have a disco-report that calcuates the 'monthly salary', but we don't want to use that. Instead, we have a custom fast-formula [xx_oab_monthly_salary] which has the conditions and calculations that we need.
    I want to use that formula in discoverer-desktop directly and get the monthly-salary.. i.e., someone needs to create a folder under the business area and add it i believe.. the formula internally calls a function.
    when i checked about this with my dba - he said, he can add the 'function', but not the formula. and i need to write the calculation part...
    does anyone know how to add it...there shud a way right...
    i do not have access to the technical-stuff here..
    someone said ["you can wrap the FF_EXEC.run_formula call into your own pl/sql function and map this function into the EUL so that the formula can be called from a workbook.", but this talks about pl/sql-do we need pl/sql
    for this].
    also, someone else said [ some fast formulas need specific contexts to be set. Depending on whether the fast formula below the only fast formula that you want to recreate in Discoverer.
    For a single formula, in general my recommendation is to recreate the fast formula instead of using the ff_exec call].
    any quick answers greatly appreciate..
    thx,

    Hi,
    That's right you need to develop the pl/sql function outside of Discoverer using a pl/sql tool or just SQL*plus. I haven't an example to hand, but can dig one up if you need it. Once you have the function developed you can map it into the EUL using Discoverer Administrator. It will then be available to Discoverer Desktop/Plus as a database function when creating calculations. So you can then just add the calculation to an existing or new report.
    Alternatively, you can build the pl/sql function into a view and load the view into a new folder using Discoverer Admin.
    Rod West

  • India localization oracle fast formulas help

    hi ..
    anybody help on oracle india localization fast formulas, absence mgmt setup, online payslip setup and tax declaration set up in payroll and sshr basic setups for absence mangt and transfer setup. plz send me on [email protected]

    send me a contract, buy me a ticket, and i fly over.

  • Oracle Fast Formula - Australian localisation....

    Hi
    This is related to Fast formulas in Australian loclisation...
    what does the standard seeded fast formula AU_SALARIED_HOURLY_RATE_PERIOD_BASIS....does ??
    and more specifically what does period basis in the above mean ??
    Thanks

    Hi,
    Where is the INPUT statement in your FF.
    Default for tax_amount is 0
    INPUTS ARE salary
    tax_amount = 0.17 * salary
    retun tax_amount
    Note: In formula result window, set the returned value "tax_amount" as a direct result to "Pay Value" of the element bonus.
    Hope this helps.
    MAK
    Edited by: user1175432 on Aug 7, 2012 4:25 AM

  • Oracle Fast Formula not working as intended.

    Hi all,
    I am fairly new to Oracle HRMS and payroll and there is an issue that is completely baffling me. I will enumerate the steps I have taken:
    1/ I have set up and element Bonus as recurring, Classifications Earnings, with input values pay value (default) and salary (user enterable and database item)
    2/ Created the element link and linked the element to my payroll (Test Payroll)
    3/ Wrote a formula
    Default for BONUS_SALARY_ENTRY_VALUE is 0
    tax_amount= 0.17 * BONUS_SALARY_ENTRY_VALUE
    return tax_amount
    4/ I went to formula result, chose standard ( I also did a test run with active assignment). I also chose direct result with input value pay value.
    5/ Allocated a person to the test payroll
    6/ Allocated the element to that person
    7/ Entered an input value for salary of 100000 in the in put value of the element
    8/ Ran the payroll for a period.
    9/ The employee shows up but the pay value is not updated. I have tried many times and failed continuously to update the pay value.
    Please help.
    Regards,

    Hi,
    Where is the INPUT statement in your FF.
    Default for tax_amount is 0
    INPUTS ARE salary
    tax_amount = 0.17 * salary
    retun tax_amount
    Note: In formula result window, set the returned value "tax_amount" as a direct result to "Pay Value" of the element bonus.
    Hope this helps.
    MAK
    Edited by: user1175432 on Aug 7, 2012 4:25 AM

  • Fast Formula in Oracle Report Developer

    How I can use the fastformula calculation in oracle Report Developer

    you cannot use the fast formula in reports but there are some seeded package-procedure/functions which get the same. Check for the package
    pay_us_pto_accrualAlso check for the followng packages:
    select * from dba_objects
    where object_type = 'PACKAGE'
    and object_name like '%PTO%ACCRUAL%';Edited by: 936671 on Jul 20, 2012 8:55 PM

  • How to extract the Fast Formula Body through database?

    Hi All
    The Oracle fast formulas are stored in the ff_formulas_f table under the column formula_text having the datatype long. I want to extract the formula text through back end. When I use the statement, Select formula_text from ff_formulas_f, I am getting only the first line.
    How to extract the full formula text?
    Regards
    Rahman

    Here's a unix shell script to do it for you based on the info given by the other posters.
    #!/bin/sh
    if \[ "$1" == "" \]; then
    echo Syntax: $0 FAST_FORMULA_NAME
    exit 1
    fi
    ffname=`echo $1|tr \[:lower:\] \[:upper:\]`; export ffname
    sqlplus -silent $ORAUSER/$ORAPASSWD <<END
    set define off serveroutput on format wrapped linesize 512 pagesize 0 feedback off verify off heading off echo off pause off long 100000
    column formula_text format a512;
    select formula_text from ff_formulas_f where formula_name = '$ffname';
    exit;
    END
    Also this will list the formula names given a substring:
    #!/bin/sh
    if \[ "$1" == "" \]; then
    echo Syntax: $0 FAST_FORMULA_NAME
    exit 1
    fi
    ffname=`echo $1|tr \[:lower:\] \[:upper:\]`; export ffname
    sqlplus -silent $ORAUSER/$ORAPASSWD <<END
    set define off serveroutput on format wrapped linesize 512 pagesize 0 feedback off verify off heading off echo off pause off long 5000
    select formula_name from ff_formulas_f where formula_name like '%$ffname%';
    exit;
    END

  • R12 - Compile Invalid objects (Fast Formula, Package Body and View) Urgent

    Invalid objects about 43, in this Fast Formula 2 AP Package object, and 1 view
    OWNER     OBJECT_TYPE     COUNT(*)
    APPS     PACKAGE BODY     37.00
    APPS     PROCEDURE     1.00
    SCOTT     PACKAGE BODY     1.00
    APPS     VIEW     1.00
    APPS     FUNCTION     3.00
    any one can give idea to make it valid.
    Awaiting for your reply.
    FYI
    the object list is below.
    OWNER     OBJECT_NAME
    APPS     FFP52474_01010001
    APPS     FFP61059_01010001
    APPS     FFP56168_01010001
    APPS     FFP56167_01010001
    APPS     FFP58579_01052004
    APPS     FFP56169_01010001
    APPS     FFP56170_01010001
    APPS     FFP56171_01010001
    APPS     FFP56172_01010001
    APPS     FFP56173_01010001
    APPS     FFP60309_01010001
    APPS     FFP60306_01010001
    APPS     FFP60308_01010001
    APPS     FFP60310_01010001
    APPS     FFP60307_01010001
    APPS     AP_IMPORT_VALIDATION_PKG
    APPS     FFP58576_01011951
    APPS     FFP60357_01011951
    APPS     FFP57511_01010001
    APPS     FFP57510_01010001
    APPS     FFP52473_01010001
    APPS     FFP60305_01010001
    APPS     FFP60545_01042004
    APPS     FFP60342_01010001
    APPS     FFP58887_01042004
    APPS     FFP58888_01042004
    APPS     FFP58870_01042004
    APPS     FFP58885_01042004
    APPS     FFP58907_01010001
    APPS     FFP58906_01010001
    APPS     FFP58861_01042004
    APPS     FFP61122_01010001
    APPS     FFP58871_01042004
    APPS     FFP58857_01042005
    APPS     FFP60917_01032006
    SCOTT     MK_PLS_XML_REP_TEST
    APPS     MK_PLS_XML_REP_TEST
    APPS     AP_FSX_PAYMENT_ADVICE
    APPS     RA_SITE_USES
    APPS     ZDBAR_CONTACT
    APPS     ZDBAR_FAX
    APPS     ZDBCLOAD
    APPS     ZDBAP_DV_PAYMENT_TYPE
    Advanced thanks for reading and giving solution for this.
    Thamaraiselvan

    any one can give idea to make it valid.Run "Compile APPS Schema" from adadmin.
    For Fast Formulas, refer to:
    Note: 155737.1 - How To Compile Oracle Fast Formulas
    http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=155737.1

  • How to use DFF value in BG_ABSENCE_DURATION Fast formula

    Hi All,
    I would like to know how can we use DFF values in BG_ABSENCE_DURATION fast formula.
    Can we pass them as input values?
    Also, when we use them as DATABASE ITEMS how does Fast Formula identifies them.
    For example I have created a DFF value HALF_DAY that can take either "YES" nor "NO".
    I tried to use that as input value but that didnt work, not sure if it is possible at all or not.
    I also tried to use that as Data Base ITEM, as follows:-
    IF (ABSENCES_HALF_DAY WAS DEFAULTED ) then
    duration = 'FAILED'
    invalid_msg = 'DFF not working'
    Any help will be much appreciated.
    Thanks,
    Avinash
    but i am getting following error when i access SSHR
    Formula BG_ABSENCE_DURATION: ORA-01403: no data found ORA-01403: no data found Cause: During the PL/SQL execution part, an Oracle error was detected. Action: Please refer to your system administrator.

    Thanks Vigneswar  and Avaneesh for your helpful comments,
    Actually I want to retrive the DFF value that I pass while applying the Leave Request and not that already stored in the data base. I checked and found that the query you have mentioned is retriving the data from base tables.
    select target.ATTRIBUTE6 -- Attrinute6 is database item ABSENCES_HALF_DAY+
    from    per_absence_attendances                target,+
    per_all_assignments_f                  ASSIGN+
    WHERE   sysdate BETWEEN ASSIGN.effective_start_date+
    AND ASSIGN.effective_end_date+
    AND    ASSIGN.assignment_id                  = 647--&B2+
    AND    ASSIGN.assignment_type                = 'E'+
    AND    target.person_id                      = ASSIGN.person_id+
    AND    target.absence_attendance_id  =+
    *(select max (absence_attendance_id)*
    from   per_absence_attendances+
    where  person_id   =  ASSIGN.person_id+
    and    date_start <=  sysdate+
    I have only added folloing lines In my BG_ABSENCE_DURATION FF
    DEFAULT FOR ABSENCES_HALF_DAY is 'XX'+
    if (1 = 1) then+
    duration = 'FAILED'+
    invalid_msg = 'DFF not working: '+ABSENCES_HALF_DAY+
    But evry time output is *"DFF not working : Yes"* no matter what the value I am passing while applying leave. This value "Yes" is stored in DFF attribute 6 for the test employee and I guess FF is retriving this value from DATABSE not from current transaction.
    Could you please help how to retrive run time data.
    Thanks,
    Avinash

  • Error while uploading Fast Formula using ldt Files.

    Dear All,
    We need to migrate Fast Formula to different instances.
    Also we need to have version control also.
    For that we created custom lct file.
    We were able to download the ldt files correctly but found that while uplaoding fast formula context were getting truncated at the end.
    Any inputs to resolve the above issue will he very helpful.
    Also we need to migrate Payroll Configuration
    1.Element Description
    2.Fast Formula
    3.Formula Function
    4.Formula Results
    5.Element links
    Any input will be very helpful

    user5733015 wrote:
    Do we need any license for I-set up?No -- https://forums.oracle.com/forums/search.jspa?threadID=&q=iSetup+AND+License&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • How to use dynamic database item in Fast formula

    Dear All
    How to use Element Pay value in Fast Formula
    Element Name: Transport_Allowance
    Input Values : Name Units User Enterable Database Item
    Pay Value Money No Yes
    Amount Money Yes Yes
    Balance Feeds : Value Name Balance Name Units
    Pay Value Transportation Amount Money
    Formula
    DEFAULT FOR ASG_SALARY IS 0
    DEFAULT FOR TRANSPORTATION_AMOUNT_ASG_RUN IS 0
    ALIAS ASG_SALARY AS Emp_Salary
    ALIAS TRANSPORTATION_AMOUNT_ASG_RUN AS Emp_Trans_Amt
    V_CALCULATED_SALARY = Emp_Salary + Emp_Trans_Amt
    RETURN V_CALCULATED_SALARY
    Using the above formula, I got only Basic Salary only
    How to get the Basic Salary + Transportation allowance in the return value
    Please help me..
    Thanks in advance

    Please check whether the priority of the element with which the fast formula is attached has a priority higher than the Transport_Allowance. If not then cahange the priority of the element to a prriority higher than Transport_Allowance.
    HTH

  • Custom Employee Number Generation Using Fast Formulas

    Hi,
    I have a requirement to generate custom employee numbers like "EMP100001". we have already created a business group with the setting of Employee number generation as Automatic. but we need to generate custom employee number as Format given above instead of automatic number generation.
    I have created my own PL/SQL Package to generate custom employee number as per Person Type. Also created a Fast Formula Function with the following parameters -
    Name = Get_Custom_Number
    Data Type = Text
    Class = External Funtion
    Alias Name = NULL or what you want the alias to be
    Description = Returns the next custom number value
    Definition = CUSTOM_EMP_NUMBER_GENERATION.Get_Custom_Number (PL/SQL Function)
    Proving the following Context usages and Parameters details to the Fast Formula Function -
    Context usages:-
    Number = 1
    Context Name = BUSINESS_GROUP_ID
    Data Type = Number
    Parameters as defined in PL/SQL function
    1 p_legislation_code Text Input Only
    2 p_person_type Text Input Only
    3 p_person_number Text Input Only
    4 p_party_id Number Input Only
    5 p_person_id Number Input Only
    6 p_national_id Text Input Only
    7 p_date_of_birth Date Input Only
    Than i created a Fast Formula using the following navigation
    Total Compensation > Basic > Write Formula
    with following details -
    Name = EMP_NUMBER_GENERATION
    Type = Person Number Generation
    Description = Returns next Employee number
    and wrote my formula code.
    When i created a Employee from Enter and Maintain People screen it is showing automatic number instead of my custom employee number.
    I m not able to find where i m missing the logic or some parameters?
    If anyone has come across such situation, please provide some pointers here.
    Thanks
    Renu

    What is the application release?
    Please review these docs and see if it helps.
    Is it Possible to Update Generate Employee Number Method From Automatic to Manual? [ID 393827.1]
    Need To Change The Employee Numbering From Automatic To Manual [ID 291634.1]
    Unable to Switch From Auto to Manual for Employee Number Generation in Shared Hr [ID 452044.1]
    How to Prefix a Zero on Custom Employee Numbers [ID 822425.1]
    How To Implement Custom Person Numbering Using FastFormula Based on User Person Type Instead of System Person Type [ID 372696.1]
    Thanks,
    Hussein

  • How to Create three dimentional graph using Oracle Discoverer

    Hi,
    How can I plot four numeric values against the time period using three axes in oracle discoverer. e.g. If I want to plot unit cost, total cost, total sale, and total profit for a given period. I am using oracle discoverer 10.1.2.0.0
    Any help is appreciated!
    Thanks

    What is the one message you are trying to get your graph to convery? Personally, I think the key thing is to keep it simple, just because your data has many dimensions it does mean that you should overload users with information. I would stick to a simple dual aixs combo graph where total cost and total sales are shown as bars against Y1 and total profit is shown as a line against Y2.
    You have total cost so adding unit cost is unlikely to provide additional information and it just adds clutter and confusion to your graph.
    One graph type that might help provide a more powerful message is the bubble-chart which is used to perform quadrant analysis. We have provided a smalla rticl on the benefits of using bubble graphs on the BI Blog:
    Making more of BI Graphs....
    http://oraclebi.blogspot.com/2005/10/making-more-of-bi-graphs.html
    More on the bubble graph
    http://oraclebi.blogspot.com/2005/10/more-on-bubble-graph.html
    Hope this helps,
    Keith
    Oracle Business Intelligence Product Management
    BI on Oracle: http://www.oracle.com/bi/
    BI on OTN: http://www.oracle.com/technology/products/bi/
    BI Beans http://www.oracle.com/technology/products/bib/index.html
    Discoverer: http://www.oracle.com/technology/products/discoverer/
    BI Software: http://www.oracle.com/technology/software/products/ias/devuse.html
    Documentation: http://www.oracle.com/technology/documentation/appserver1012.html
    BI Samples: http://www.oracle.com/technology/products/bi/samples/
    Blog: http://oraclebi.blogspot.com/

  • Urgent:How to differentiate retro and payroll run in Fast Formula

    I have written one fast formula. This fast formula is attached to “Basic Salary” element.
    “Basic Salary” element has retro and proration setup.
    We are using Enhanced retro process.
    Enhanced retro process is calling this Fast formula to check the difference amount.
    Similarly oracle payroll will also call the same fast formula while running payroll.
    Now our requirement is:
    Few lines in Fast formula should not execute when FF is called by retro, but it should be executed when it is called from Payroll.
    So how could we know, whether FF is called by retro process or by payroll?
    If I have some way to find this, I can execute this code by using this condition.
    Any pointer in this regard will be highly appreciated.

    None of the above.. just write one custom PLSQL function which will take the payroll action ID as context parameter & will return the action_type column from PAY_PAYROLL_ACTIONS table.. to the Fast formula. L is for Retro run.
    In the fast formula, place your specific code in the if condition.
    Attention: Making the formula calculate differently in normal payroll & retro can cause you serious consistency issues in payments/deductions and debugging them might become impossible in the long run.
    Edited by: Rajkiran Bingi on Sep 22, 2011 7:00 AM

  • Is Add_Months allowed in a Fast Formula?

    Hi
    Im trying to add the following to the carry over fast formula.
    : Mid_Month_DDMM = to_char(to_date(to_char(ADD_MONTHS(Continuous_Service_Date, +1),'YYYYMM'),'YYYYMM')-1,'DDMM')
    But it seems the formula does not like the "Add_months". Im trying to get the formula to work that when an employees continuous_service_date is not the 1st of the Month the carry over will happen at the end of the month.
    Thanks
    Andrew

    The logic is as follows
    Every 12 months employees forfiet their leave and carry over any balance.
    From the PTO_CARRY_OVER with abit of customisation
    IF ISNULL(OverrideHireDate) = 'Y'
    THEN
    Continuous_Service_Date = Continuous_Service_Date
    ELSE
    Continuous_Service_Date = OverrideHireDate
    Ann_Date_DDMM = to_char(Continuous_Service_Date,'DDMM') /* ----Put this check to make sure 2902 is not concatenated to a non-leap YYYY ------ */
    IF Ann_Date_DDMM = '2902' THEN
    Anniversary_Date = to_date('0103' || to_char(Calculation_Date,'YYYY'),'DDMMYYYY')
    ELSE
    Anniversary_Date = to_date(Ann_Date_DDMM || to_char(Calculation_Date,'YYYY'),'DDMMYYYY')
    **Anniversary_Date = to_date('01' || to_char(Anniversary_Date, 'MMYYYY'), 'DDMMYYYY')**
    The last line makes sure that everyone no matter when you started has their forfieture date on the 1st of their anniversary month.
    I want to us the logic that if your Ann_Date_DDMM does not equal 0101,0102,0103,0104,0105,0106,0107,0108,0109,0110,0111,0112
    then your Anniversary date is the end of the anniversay month.
    So hence my code of : to_char(to_date(to_char(ADD_MONTHS(Continuous_Service_Date, +1),'YYYYMM'),'YYYYMM')-1,'DDMM') that if working will concatinate with to_char(Calculation_Date,'YYYY'),
    So for exampble. My anniversay date is the 13-May-2002.
    On the 13-May-2013 the process is run to work out my forfieture-carryover for the 14th. But now the company wants me to only forfeit on the 31-May-2013
    Calculation_Date = 13-May-2013 but with to_char(Calculation_Date,'YYYY') I get just the 2013 out.
    the code to_char(to_date(to_char(ADD_MONTHS(Continuous_Service_Date, +1),'YYYYMM'),'YYYYMM')-1,'DDMM') should return (and it does in SQL developer) 3105. Concatinated its 31052013 , that would be my new forfeiture - carry over date.
    So would be great to get the add_months working in the formula itself. Else if you can tell me where I can find the code for the seeded Continuous_Service_date then I can do the add_months in the package for the function.
    Below is the full Formula:
    /* Default Statements */
    DEFAULT FOR ACP_CONTINUOUS_SERVICE_DATE IS '4712/12/31 00:00:00' (date)
    DEFAULT FOR ACP_SERVICE_START_DATE IS '4712/12/31 00:00:00' (date)
    /* Inputs Are Statements */
    INPUTS ARE
    Calculation_Date (date)
    ,Accrual_Term (text)
    /* trace=za_set_trace_on('CARRYOVER')*/
    /*--------------------------------- Formula Body -------------------------------------*/
    /* ------- Check whether the Continuous Service Date was Set or the Hire Date. ------ */
    /* ------- Accordingly set the Continuous Service Date. ------ */
    IF ACP_CONTINUOUS_SERVICE_DATE WAS DEFAULTED THEN
    Continuous_Service_Date = ACP_SERVICE_START_DATE
    ELSE
    Continuous_Service_Date = ACP_CONTINUOUS_SERVICE_DATE
    OverrideHireDate = KPMG_GET_OVERRIDE_HIRE_DATE(Calculation_Date)
    IF ISNULL(OverrideHireDate) = 'Y'
    THEN
    Continuous_Service_Date = Continuous_Service_Date
    ELSE
    Continuous_Service_Date = OverrideHireDate
    Ann_Date_DDMM = to_char(Continuous_Service_Date,'DDMM') /*Andrew Campbell 30-November-2012*/
    /*Mid_Month_DDMM = to_char(to_date(to_char(ADD_MONTHS(Continuous_Service_Date, +1),'YYYYMM'),'YYYYMM')-1,'DDMM')*/
    /* ----Put this check to make sure 2902 is not concatenated to a non-leap YYYY ------ */
    IF Ann_Date_DDMM = '2902' THEN
    Anniversary_Date = to_date('0103' || to_char(Calculation_Date,'YYYY'),'DDMMYYYY')
    ELSE
    Anniversary_Date = to_date(Ann_Date_DDMM || to_char(Calculation_Date,'YYYY'),'DDMMYYYY')
    Anniversary_Date = to_date('01' || to_char(Anniversary_Date, 'MMYYYY'), 'DDMMYYYY')
    /* Set Accrual Term to Previous, the requirement is to run CO once per month at the end of the */
    /* month for all assgs with Anniversary Dates during that month */
    IF Accrual_Term = 'PREVIOUS' THEN
    Effective_Date = add_years(add_days(Anniversary_Date, -1), -1)
    ELSE
    Effective_Date = add_days(Anniversary_Date,-1)
    /* For months in later half of the Year and process running for Six Monthly run then reduce */
    /* the Effective Date by one year. */
    Anniversary_Month = to_char(Anniversary_Date,'MM')
    IF (Calculation_Date < Anniversary_Date)
    AND ((Anniversary_Month = '07')
    OR (Anniversary_Month = '08')
    OR (Anniversary_Month = '09')
    OR (Anniversary_Month = '10')
    OR (Anniversary_Month = '11')
    OR (Anniversary_Month = '12')) THEN
    Effective_Date = add_years(Effective_Date, -1)
    /* Effective_Date = Effective_Date */ /* koos */
    /* Calculate Previous Cycle's Start Date,End Date and Six Monthly Anniversary Date in Current Cycle */
    Effective_End_Date = Effective_Date
    Effective_Start_Date = add_months(Effective_End_Date, -12)
    /* Semi_Anniversary_Date = add_months(Effective_End_Date,6) */
    Semi_Anniversary_Date = add_months(Effective_End_Date,12) /* Change forfeiture to 12 months after carry over */
    /* ------- Calculate the Number of Years completed -------*/
    Years_service = floor(months_between(add_days(Effective_date,1), Continuous_Service_Date) / 12)
    /* This PROCESS flag is set up so that CO will not run for those employees with eff dates -*/
    /* ----------------------------- before calculation_date --------------------------------------*/
    IF /* (Calculation_Date >= Effective_Date) */ /* Koos */
    (((to_char(Effective_Date,'MMYYYY') = to_char(Calculation_Date,'MMYYYY'))
    AND (last_day(Effective_Date) <> Effective_Date ))
    OR ((to_char(Anniversary_Date,'MM') = to_char(Calculation_Date,'MM'))
    AND (last_day(Effective_Date) = Effective_Date ))) THEN
    /* Calculating for Yearly Run */
    Process = 'YES'
    /* Expiry_Date = add_months(Effective_Date, 6) */
    Expiry_Date = add_months(Effective_Date, 12) /* Change forfeiture to 12 months after carry over */
    /* After 1 year set the date for calculating for Six Months period */
    IF Years_service > 1 THEN
    /* Effective_start_Date = add_months(Effective_start_Date,6) */
    Effective_start_Date = add_months(Effective_start_Date,12) /* Change forfeiture to 12 months after carry over */
    Annual_Cal = 1
    ELSE IF /* (Calculation_Date < add_years(Effective_Date,1)) */ /* Koos */
    (((to_char(Semi_Anniversary_Date,'MMYYYY') = to_char(Calculation_Date,'MMYYYY'))
    AND (last_day(Semi_Anniversary_Date) <> Semi_Anniversary_Date ))
    /* OR ((to_char(add_months(Anniversary_Date,6),'MM') = to_char(Calculation_Date,'MM')) */
    OR ((to_char(add_months(Anniversary_Date,12),'MM') = to_char(Calculation_Date,'MM')) /* Change forfeiture to 12 months after carry over */
    AND (last_day(Semi_Anniversary_Date) = Semi_Anniversary_Date ))) THEN
    /* Calculating for Six Monthly Run */
    Process = 'YES'
    /* Expiry_Date = add_months(Semi_Anniversary_Date,6) */
    Expiry_Date = Semi_Anniversary_Date /* Koos */
    /* For Semi Annual run set the date for calculation for Six Months */
    IF Years_service > 0 THEN
    Effective_start_Date = Effective_end_Date
    Effective_end_Date = Semi_Anniversary_Date
    Annual_Cal = 0
    ELSE
    /* If neither Annual or Semi Annual Run then Donot process */
    Process = 'NO'
    Expiry_Date = add_years(Effective_Date, 1)
    Annual_Cal = 1
    /* --------- Set the Public Variables eg. Maximum Carry Over from the accrual bands ------- */
    IF (GET_ACCRUAL_BAND(years_service) = 0) THEN
    IF Years_service > 1 then
    Max_Carryover = KPMG_GET_ANNUAL_ACCRUAL(Effective_End_Date)
    else
    Max_Carryover = KPMG_GET_ANNUAL_ACCRUAL(Effective_End_Date)
    ELSE
    Max_Carryover = KPMG_GET_ANNUAL_ACCRUAL(Effective_End_Date)
    /*---------------------- Return Statements --------------------------------------
    Effective_date is the last date of an accrual term
    Expiry_date is the date by which employees must use carried over PTO or lose it.
    /*trace_off = za_set_trace_off*/
    RETURN Max_Carryover, Effective_date, Expiry_Date, Process
    Thanks

Maybe you are looking for