How to use a balance dimension in a FastFormula

Hello all,
How can I call a certain balance dimension and store it in a local variable like SALARY_ASG_RUN.
Regards,
Usher

Hi,
You cannot get a previous month's balance value from a DBI in the formula.
You need to write a formula function which gets you the data -
We have used the below for the same
-- GET_PREV_SALARY
FUNCTION get_prev_salary(p_assignment_action_id   IN NUMBER
                        ,p_balance_name           IN VARCHAR2
                        ,p_database_item_suffix   IN VARCHAR2
                        ,p_period_start_date      IN DATE
                        ,p_no_month               IN NUMBER
                        ,p_flag                   IN VARCHAR2
                        ,p_context                IN VARCHAR2
                        ,p_context_val            IN VARCHAR2
                        ,p_days                   IN OUT NOCOPY NUMBER) RETURN NUMBER
IS
    CURSOR get_prev_periods_dates (c_assignment_action_id NUMBER
                                  ,c_period_start_date    DATE) IS
    SELECT  ptp.start_date  start_date
           ,ptp.end_date    end_date
           ,ppa.action_type
           ,MAX(paa2.assignment_action_id) assignment_action_id
     FROM   pay_assignment_actions paa1
           ,pay_assignment_actions paa2
           ,per_all_assignments_f  paaf1
           ,per_all_assignments_f  paaf2
           ,pay_payroll_actions    ppa
           ,pay_payroll_actions    ppa1
           ,per_time_periods       ptp
           ,per_time_period_types  ptpt
     WHERE  paa1.assignment_action_id     = c_assignment_action_id
     AND    ppa1.payroll_action_id        = paa1.payroll_action_id
     AND    ppa1.business_group_id        = paaf1.business_group_id
     AND    paa1.assignment_id            = paaf1.assignment_id
     AND    paaf1.person_id               = paaf2.person_id
     AND    paaf2.business_group_id       = paaf1.business_group_id
     AND    paaf2.assignment_id           = paa2.assignment_id
--    AND    paa1.tax_unit_id              = paa2.tax_unit_id
     AND    paa2.payroll_action_id        = ppa.payroll_action_id
     AND    paa2.source_action_id         IS NULL
     AND    ptp.start_date                < c_period_start_date
     AND    ppa.payroll_id                = ptp.payroll_id
     AND    ppa.business_group_id          = paaf2.business_group_id
     AND    ptp.period_type                = ptpt.period_type
     AND    ppa.action_type               IN ('R','Q','I','B')
     AND    ppa.action_status             IN('C','U')
     AND    ppa.date_earned  BETWEEN ptp.start_date              AND ptp.end_date
     AND    ptp.end_date     BETWEEN paaf1.effective_start_date  AND paaf1.effective_end_date
     AND    ptp.end_date     BETWEEN paaf2.effective_start_date  AND paaf2.effective_end_date
     GROUP BY ptp.start_date, ptp.end_date, ppa.action_type
     ORDER BY 1 desc;
/*  SELECT ptp.start_date start_date
          ,ptp.end_date end_date
          ,ppa.action_type
          ,MAX(paa2.assignment_action_id) assignment_action_id
    FROM   pay_assignment_actions paa1
          ,pay_assignment_actions paa2
          ,per_all_assignments_f paaf1
          ,per_all_assignments_f paaf2
          ,pay_payroll_actions ppa
          ,per_time_periods ptp
    WHERE paa1.assignment_action_id     = c_assignment_action_id
    AND   paa1.assignment_id            = paaf1.assignment_id
    AND   paaf1.person_id               = paaf2.person_id
    AND   paaf2.assignment_id           = paa2.assignment_id
    AND   paa1.tax_unit_id              = paa2.tax_unit_id
    AND   paa2.payroll_action_id        = ppa.payroll_action_id
    AND   paa2.source_action_id         IS NULL
    AND   ptp.start_date < c_period_start_date
    AND   ppa.payroll_id                = ptp.payroll_id
    AND   ppa.time_period_id            = ptp.time_period_id
    AND   ppa.action_type IN ('R','Q','I','B')
    AND   ppa.action_status             IN('C','U')
    AND   ptp.end_date BETWEEN paaf1.effective_start_date
                                        AND paaf1.effective_end_date
    AND   ptp.end_date BETWEEN paaf2.effective_start_date
                                        AND paaf2.effective_end_date
    GROUP BY ptp.start_date, ptp.end_date, ppa.action_type
    ORDER BY 1 desc;
    CURSOR get_legal_employer_id(c_work_center_id NUMBER) IS
    SELECT  hoi.organization_id
    FROM    hr_organization_information hoi
    WHERE   hoi.org_information1         = c_work_center_id
    AND     hoi.org_information_context  = 'ES_WORK_CENTER_REF';
    l_def_bal_id          NUMBER;
    l_amount              NUMBER;
    l_amt                 NUMBER;
    l_ctr                 NUMBER;
    l_cnt                 NUMBER;
    l_start_date          DATE;
    l_date                DATE;
    l_legal_employer_id   hr_All_organization_units.organization_id%TYPE;
BEGIN
    hr_utility.trace('~~Entering pay_es_ss_calculation.get_prev_salary');
    l_def_bal_id := get_defined_bal_id(p_balance_name, p_database_item_suffix);
    hr_utility.trace('~~~~ p_balance_name'||p_balance_name);
    hr_utility.trace('~~~~ p_database_item_suffix'||p_database_item_suffix);
    hr_utility.trace('~~~~ l_def_bal_id'||l_def_bal_id);
    l_amount := 0;
    l_amt := 0;
    l_ctr := 0;
    l_cnt := 0;
    p_days := 0;
    l_date := to_date('01-01-0001','dd-mm-yyyy');
    IF p_context = 'TAX_UNIT_ID' THEN
        OPEN  get_legal_employer_id(to_number(p_context_val));
        FETCH get_legal_employer_id INTO l_legal_employer_id;
        CLOSE get_legal_employer_id;
        pay_balance_pkg.set_context('TAX_UNIT_ID', l_legal_employer_id);
        hr_utility.trace('~~~~ Setting TAX_UNIT_ID Context '||l_legal_employer_id);
    END IF;
    hr_utility.trace('~~~~ Start loop  p_period_start_date '||p_period_start_date);
    hr_utility.trace('~~~~ p_assignment_action_id '||p_assignment_action_id);
    FOR i IN get_prev_periods_dates( p_assignment_action_id, p_period_start_date) LOOP
        IF l_date = i.start_date AND l_amt <> 0 THEN
            NULL;
        ELSE
            l_amt := 0;
            IF l_date <> i.start_date THEN
                l_ctr := l_ctr + 1;
            END IF;
            l_amt := pay_balance_pkg.get_value (l_def_bal_id, i.assignment_action_id);
            IF l_amt <> 0 THEN
                l_cnt := l_cnt + 1;
            END IF;
            l_amount := l_amount + l_amt;
            hr_utility.trace('~~~~ Inside loop  start_date '||i.start_date);
            hr_utility.trace('~~~~ assignment_action_id '||i.assignment_action_id);
            hr_utility.trace('~~~~ l_ctr '||l_ctr);
            hr_utility.trace('~~~~ l_cnt '||l_cnt);
            hr_utility.trace('~~~~ l_amt '||l_amt);
            hr_utility.trace('~~~~ l_amount '||l_amount);
            hr_utility.trace('~~~~ p_no_month '||p_no_month);
            IF l_amt <> 0 OR p_flag = 'N' THEN
                p_days := p_days + last_day(i.start_date) - last_day(add_months(i.start_date,-1));
            END IF;
            IF l_ctr >= p_no_month THEN
                IF l_cnt = p_no_month OR p_flag = 'N' THEN
                    RETURN l_amount;
                /*ELSE
                    l_ctr := p_no_month - 1;*/
                END IF;
            END IF;
            l_date := i.start_date;
        END IF;
    END LOOP;
    hr_utility.trace('~~Exiting pay_es_ss_calculation.get_prev_salary');
    RETURN l_amount;
END get_prev_salary;
To get the previous month value -
Previous_Month_val = ES_GET_PREVIOUS_BALANCE('Gross','_ASG_PTD',Start_Date, 1, 'Y',' ',Work_Center_ch,num_days)
To get the previous 3 months value -
Previous_3_Month_val = ES_GET_PREVIOUS_BALANCE('Gross','_ASG_PTD',Start_Date, 3, 'Y',' ',Work_Center_ch,num_days)
Assignment_action_id is passed as a context to the formula function.
You need to tweak the code to suit your requirements.
Cheers,
Vigneswar
PS :
-- GET_DEFINED_BAL_ID
FUNCTION get_defined_bal_id(p_bal_name         IN  VARCHAR2
                           ,p_db_item_suffix   IN  VARCHAR2) RETURN NUMBER
IS
    CURSOR get_def_bal_id is
    SELECT pdb.defined_balance_id
    FROM   pay_balance_types pbt
          ,pay_balance_dimensions pbd
          ,pay_defined_balances pdb
    WHERE  pdb.balance_type_id = pbt.balance_type_id
    AND    pdb.balance_dimension_id = pbd.balance_dimension_id
    AND    pbt.balance_name = p_bal_name
    AND    pbd.database_item_suffix = p_db_item_suffix;
    l_def_bal_id NUMBER;
BEGIN
    OPEN get_def_bal_id;
    FETCH get_def_bal_id into l_def_bal_id;
    CLOSE get_def_bal_id;
    RETURN l_def_bal_id;
END get_defined_bal_id;

Similar Messages

  • How to use the balance on my account to make a purchase

    How do i use the balance on my itunes account to make a purchase? i'm trying to buy a book

    you have a 13" MBP. Right?
    If so then I don't think there is any way. The 13" MBP uses the same port for input and output but I don't think you can do both at the same time. It is either one or the other.
    You could try an 1 to 2 adapter but most of those only split what is coming into them. I haven't taken the jack part on a 13" MBP to see if there is a extra connector to separate the input from the output and I doubt there is.

  • How to use the RateEntity dimension in SAP BPC?

    Hello everbody,
    I am implementing a consolidation process using SAP BPC. I want to use the RateEntity dimension, to translate a same currency into different exchange rates depending on the company.
    I want the company which ID is GFU (which is from Brazil) in LegalEntity dimension is converted using a special exchange rate. I have added a GFU member in RateEntity dimension, and I have entered the exchange rates for the member GFU and for the member Global in RateEntity dimension.
    But the problem is that after I run the FX Restatement package, converted data for this company is not the proper one, because Global exchange rates have been used instead of GFU exchange rates. Does anybody know why? Do I have to do anything else? 
    Thank you very much for your time

    Do you see the search functionality in the upper left of the screen?
    Okay, now type in ecatt, press enter and in the next screen filter on blogs.

  • How to use property of dimension to filter the 2nd dimension in Allocation?

    Hi experts,
    How do we use a property of one dimension to filter out the members of another dimension in allocation script engine?
    eg of two dimensions
    1.)Entity dimension - (entity dimension)
      memberset:                                        Channeltype (property)
                       Stores
                        Store1                           Boutique
                        Store2                           Kiosk
                        Store3                           Branch
                        Store4                           Concession
                        Store5                           Franchise
                      Nonstore
    2.)business Channel dimension - (user define)
       memberset:
                   Channeltype   
                       Boutique
                       Kiosk
                       Branch
                       Concession
                       Franchise
                       Nochannel
    in allocation code
    *runallocation
    *factor
    *dim entity                          what=Nonstore;                where=bas(Stores)
    *dim businesschannel        what=nochannel;             where= ? ;
    *endallocation
    The thing is that when the engine selected store 2 for entity it should select kiosk as its businesschannel.
    Please advise.
    Thanks as always,
    yajepe

    Hi,
    In this case, I believe, you should have the allocation within a for loop. But you should note that the performance might reduce.
    *FOR %VAR% = BAS(STORES)
       *RUNALLOCATION
       *FACTOR
       *DIM ENTITY WHAT = NONSTORE; WHERE = %VAR%
       *DIM BUSINESSCHANNEL WHAT = NOCHANNEL; WHERE = %VAR%.CHANNELTYPE
       *ENDALLOCATION
    *NEXT
    Hope this helps.

  • How to use the olap dimension

    hello everybody,
    I had build a project use OWB,but I dont know how to deploy this object to BIEE. I only select which table or view in build the BIEE and must setup the dimension which had been setup in OWB. Could I get the dimension information to the BIEE and dont not build it again in the BIEE.
    Could you give me some good advice.
    thinks

    Hi,
    I guess you should deploy your OWB objects like you normally would do. These OWB objects can be imported to OBIEE. So you do not have to build these objects again.
    Good Luck,
    Daan Bakboord

  • How to use one Account dimension for multiple account structures

    We are implementing a HFM application to replace two general ledger applications, one being Corporate and the other a new subsidiary. We need to maintain both of the chart of accounts and their unique rollup structures. We are facing the difficulty in attempting to combine the two chart of accounts into one HFM Account Dimension because a few of the subsidiary accounts have the same account numbers but they are meant different things. 
    Question:
    How can we set up two distinct account structures in HFM and also have the subsidiary accounts rolled into the Corporate accounts for consolidation reporting? 
    Appreciate your help.

    Hope this help.
    _http://technet.microsoft.com/en-us/library/cc164331(v=exchg.65) .aspx

  • HT5035 how to use my balance on apple id

    i have already redeemed my itunes gift card. how do i use the balance

    buy anything you like in the store. the payment will be taken from your account automatically.
    http://support.apple.com/kb/HT5582
    as long as you have enough store credits, you will not have issues in purchasing.

  • How to get opening balance of a g/l account using query ?

    Dear all,
    I'm developing consolidated g/l accounts debit,credit totals month wise with opening & closing balances thru query based report,
    i'have got expected results except opening balance g/l account,
    How to get opening balance of a g/l account based on date as conditonal parameter ?
    Any one throw light on this ?
    Jeyakanthan

    Hi ,
    Please kindly help me on this.I don't know how to calculate opening bal and closing bal over a period of time by Quarter, and how to generate the reprot using crystal reports and please suggest me on this how to go ahead with this report.
    Here you can go through the reprot requirement , and also an attachment of my Report template.
    we have "Category of Investment" , "Income On Investment" ,"Gross yield" and "Net yield" are  report fields.
    1)"Category Of Investment " is Hardcoded.
    2)In this we have to get  "Investment" column from VTBFHAPO(BZBETR Field) table Database based on
    Flow type(SFHAZBA) in VTBFHAPO table ='0100' for bonds category.
    3)"Income on Investment" also we will get from DB using the following formula.
      Income On Investment= "Interest IncomeAmortizationCapitalgain"
    4)With the Date field(Making Date dimension based on date(DCRDAT) field in VTBFAHPO table.
    By Current Quarter,Year to Date,Last year)
    5)Opening bal---Investment
    Purchase--Flowtype=0100
    Meturity/Sales--Flowtype=0200
    Closing balance=Opening bal+(Investment or Purchase)-(Meturity or Sales)
                                      '0100'                 '0200'
    Here '0100' and '0200' are Flow types based on this i need to get value from the same Field.
    we need to Calculate "Gross yield" .
    The bellow are formulas  to evaluate "Gross yield "
    Ist Qtr  .Gross yield=Investment income/(((April opening balanceApril closing balance)/2)((May opening balanceMay Closing Balance)/2)((June opening balance+June closing balance)/2))/3)
    Ist qtr. Year to date   Gross yield=Investment income/(((April opening balanceApril closing balance)/2)((May opening balanceMay Closing Balance)/2)((June opening balance+June closing balance)/2))/3)
    Investment income=interest incomeamortisationcapital gain
    Iind Qtr.Gross yield=Investment income/(((July opening balanceJuly closing balance)/2)((Aug opening balanceAug Closing Balance)/2)((Sept. opening balance+Sept. closing balance)/2))/3)
    Iind Qtr. Year todateGross yield=Investment income/(((April opening balanceApril closing balance)/2)((May opening balanceMay Closing Balance)/2)((June opening balanceJune closing balance)/2))((July opening balanceJuly closing balance)/2)((Aug opening balanceAug Closing Balance)/2)((Sept. opening balance+Sept. closing balance)/2))/6
    This data should display over a period of time. based on "Current Quarter","YearToDate" and "Last year"
    The quarter starts from April,i,e FY,  I Like this i need to generate the report.
    Thanks in advance.

  • Use of various balance dimensions

    Can some tell me what is the use of various balance dimensions
    i.e when to use the following dimensions:
    Assignment Level within a run
    Assignment Level in the current earnings period
    Assignment Level all time
    Assignmnet Level in the current processing year
    ASGYTD= Assignment Level in the year
    ELEMENTITD= Element Entry level for all time
    ELEMENTPTD= Element Entry level for this period
    Please can some one throw some light on the above Balance Dimensions so as to know how one has to use these in the FF.
    Please help

    Hii
    Don't create unique key with a column of a fact table which refers with a foreign key to another table (dimension)! This data must be unique in the dimension table!
    But indexes in the columns of foreign keys will speed up your queries.
    Ott Karesz
    http://www.trendo-kft.hu

  • I have a balance on my itunes account that I want to use but it wants a code (because of a new phone), the card is gone.  how do I use my balance?

    I have a balance on my itunes account that I wan to use before it expires.  I have a new computer and new iphone, so itunes wants a code from the back of the card.  The card is long gone.  How do I use my balance without this code?

    As I said, some items cannot be purchased with an existing credit on an account no matter how much it is.  It can only be purchased with a charge to a credit card.

  • How to report on balance sheet accounts using 0EC_PCA_3

    Hi Experts,
    How to report on balance sheet accounts using 0EC_PCA_3
    Thanks
    nagini

    Hi,
    IF you want to see the accumulated balances you need to select the period from 0 to 12.
    EX: you want to open the report up to period 6th 2009 and want see the figures including the carryforward balances from 2008.
    then in selection screen select the from period = 0  and to period =6.
    hope its helpful
    thanks,

  • HT201209 I redeemed a gift card of $15 in mu Itunes Store.  I purchased one book in IBooks of $6.99 now the balance in my iTunes store is $ 7.10.  How Do I use this balance to buy another book or music from my Itunes Store It is not using my balance?

    I redeemed a gift card of $15 in my Itunes Store.  I purchased one book in IBooks of $6.99 now the balance in my iTunes store is $ 7.10.  How Do I use this balance to buy another book or music from my Itunes Store It is not using my balance?  Whenver I try to make a purchase it is trying to charge my Visa Credit card.  My Credit card is no more active. I want to remove my Visa credit card and use Itines gift card fro purchase in Itunes store.
    TIA
    Bikram Suri
    <Email Edited by Host>

    Sir,
    I thought So too but then I went to Itunes Library and try and buy a single song from an album for $1.29.  Now my Itunes Gift card balance is $ 7.10 as I mentioned earlier. it still did not let me buy and kept trying billing my Visa card.
    Should I restart my PC and Itunes and retry. What do you suggest?
    regards
    Bikram Suri
    [email protected]

  • How to rent movie on Apple TV (3 Gen) using credit balance in iTunes account

    HOW TO USE TEH CREDIT BALANCE AS PAYMENT FOR A RENTAL ON AN APPPOLETV GEN3.

    Hello Geneber,
    Thanks for using Apple Support Communities.
    If you have already redeemed your iTunes Store gift card, then the balance should be able to be viewed on your iTunes Store account.  As long as you are signed in with the same Apple ID on your Apple TV, the purchase on the Apple TV will be deducted from your credit balance.
    iTunes Gift balances - Apple Support
    Take care,
    Alex H.

  • Purchased Itunes card..Have balance on my itunes account but trying to use the balance for an APP game...how do i transfer the funds ?

    I had a itunes card purchased for me...I redeemed it on my iphone in the Itunes APP...shows it was redeemed succesfully.Want to use the balance for an APP game i have....SImpsons Tapped out...hoe do i transfer it to it . it keeps using my credit card for purchasing premium items...how do i fix this to the itunes balance...thanks

    So then put any sim card in and restore it.  this isn't rocket science

  • How do I tell iTunes to use the balance in a gift card to purchase music instead of charging my credit card?

    I'm trying to use the balance from a gift card to buy music for my iTouch, but the system keeps trying to charge my credit card.   How do I use my balance???

    http://support.apple.com/kb/HT1364
    http://support.apple.com/kb/HT1203
    http://docs.info.apple.com/article.html?path=iTunesWin/9.0/en/27554.html
    This is the best guide:
    http://www.ilounge.com/index.php/articles/comments/moving-your-itunes-library-to -a-new-hard-drive

Maybe you are looking for