Reading previous period value is logic

Hi,
There's a need to read previous period value is logic for some processing, can you please help me out how this can be achieved. I have a selection for time in the package called %TIME_DIM% and I am running for the current period. I have tried following options
First
*WHEN XYZ
*IS "ABC"
*REC = (FACTOR=GET(TIME=PRIOR), SOMEDIM=VALUE)
*ENDWHEN
When above code executed with current period (no record exists for current period) nothing is read.
Second
*XDIMMEBERSET TIME = PRIOR, %TIME_DIM%
*WHEN XYZ
*IS "ABC"
*REC = (FACTOR=GET(TIME=PRIOR), SOMEDIM=VALUE)
*ENDWHEN
In the above case no record is selected and surprisingly the select statement fired (got it form the log) is for the last time period maintained in the system - 1. So if I have time dimension members till 2020.DEC this picks up 2020.NOV. I didn't understand why?
Would appreciate help on this.
Thanks

Anand,
It is not very clear what you are trying to achieve here.
Perhaps you already have this, but below some explanation about special time selections that you can use in SQL logic.
The time shift instructions
To simplify the calculation of leads and lags in financial reporting applications, the following new instructions have been implemented for SQL-based logics:
PRIOR
NEXT
BASE
FIRST
The instructions PRIOR and NEXT support an optional numeric parameter. This parameter represents the number of time periods by which the current period must be shifted. If omitted, the functions will assume a time shift of 1 period (forward or backwards). Negative values are accepted (A negative value for a NEXT function corresponds to a positive value for a PRIOR function and vice-versa).
Examples:
TIME=NEXT          // In a monthly application this means next month
TIME=PRIOR(3)     // Three periods backwards
TIME=NEXT(-3)     // Same as PRIOR(3)
The keyword BASE always represents the last period of prior fiscal year. When the fiscal year is a normal calendar year and the frequency is monthly, the base period of 2004.JUN is 2003.DEC.
The instruction BASE can be useful in YTD applications, where the opening balances need to be retrieved from the last period of prior year.
The keyword FIRST always represents the first period of the current fiscal year. When the fiscal year is a normal calendar year and the frequency is monthly, the base period of 2004.JUN is 2004.JAN.
In case the time shift goes past the boundaries of the TIME dimension, these time shift functions will return no period.
These functions can be used in four ways:
-     To re-direct the destination period in a *REC statement
Example 1: *REC(TIME=NEXT)
Example 2: *REC(TIME=BASE)
-     To retrieve a value from a different period in a *REC statement
Example 1: *REC(FACTOR=GET(TIME=PRIOR(3))
Example 2: *REC(FACTOR=GET(TIME=BASE)
-     To add periods to the selected data region in a XDIM_MEMBERSET statement
Example: *XDIM_MEMBERSET TIME=PRIOR, %TIME_SET%
In this example, if the first modified period is 2004.APR, the instruction PRIOR will add 2004.MAR to the region to process).
-     When the keywords PRIOR, FIRST or BASE are added to a XDIM_MEMBERSET instruction, the time period PRIOR, FIRST or BASE can be also evaluated in a WHEN / ENDWHEN structure, like in the following example:
*WHEN TIME
*IS PRIOR
     // ignore
*ELSE
     *REC(u2026)
*ENDWNHEN
In presence of an XDIM_MEMBERSET containing the PRIOR keyword, like in the above example, the WHEN structure here shown will recognize 2004.MAR as PRIOR period.
Following is an example of logic that performs a carry-forward of account ACCREC, while adding to it the periodic amount from EXTSALES.
*XDIM_MEMBERSET TIME=PRIOR,%SET%,%PREFIX%.DEC
*CALC_EACH_PERIOD
*WHEN TIME
*IS PRIOR
     *WHEN ACCOUNT
     *IS ACCREC
          *REC(ACCOUNT=u201DOPEACCRECu201D,TIME=NEXT)
     *ENDWHEN
*ELSE
     *WHEN ACCOUNT
     *IS EXTSALES
          *REC(FACTOR=-1,ACCOUNT="OPEACCREC",TIME=NEXT)
          *REC(FACTOR=-1,ACCOUNT="ACCREC")
     *IS OPEACCREC
          *REC(ACCOUNT=u201DACCRECu201D)
          *REC(ACCOUNT=u201DACCRECu201D,TIME=NEXT)
     *ENDWHEN
*ENDWHEN
Hope this helps,
Alwin

Similar Messages

  • FM to read previous period values in material master Accounting tab

    hi,
    is there an FM to read standard price and price unit values for the previous period in accounting1 tab in material master.
    Thanks,
    V.

    Deepthi Suvarna wrote:
    Hi ,
    >
    > Use function module DB_DELETE_TABLE and input table MARHD and delete the entry for the previous period stock.
    >
    > Thanks
    > Deepthi
    mardh table is a audit relevant table, it is absolute nonsense to delete enties from standard tables.
    The use of this function module is not even a solution for the issue discussed in this thread.

  • "Previous Period" Calculation

    I'm building a 12 monthl trend reports in Deski and need to call a previous period value (which i halve already retrieved in the query) into a current period calculation. The example would be "Installation Revenue divided by Previous Period Installations".  Is there an easy way to do this?

    You try to create a variable using the "Previous" function in Deski and use this variable in your calcualtion.

  • "lock" values of tax depreciation for previous periods

    Hi all,
    is it possible to lock calculated values of depreciation for previous periods? We need it for the case when e.g. depreciation key is changed. Then we want preserve the values for previous periods and change only the future values. But please note that we want this for depreciation area, which does not post values to GL.
    thanks
    Zbynek

    Hi,
    It did not work for me. I changed the useful life from 30 to 20 yrs and then used menu path Edit/Recalculate values. Then I used the Tx S_ALR_87012936 to display the depreciation values for individual months. But all the values were the same, i.e. the values for previous periods were not kept.
    So is there a way to keep these values?
    thanks,
    Zbynek

  • Read last period of infotype without logical database

    Hi,
    I'm looking for a FM that retrieves last period of one infotype without using logical database pnp, so rp-provide-from-last isn't a solution
    Now, I'm using a home made solucion:
    First I use HR_READ_INFOTYPE function to read all periods of infotype, then I sort the table by endda (descending) and get first register of table.
    But I really prefer using a SAP function module.
    Thanks in advance

    Hi,
    You can use the same FM "HR_READ_INFOTYPE" & pass begda = sy-datum and endda = '12/31/9999'.
    You will get only one record i.e. latest one.
    Hope this helps.
    Thanks,
    Sarika.

  • How to Bring the Quarter Period and Previous Month Value for given Input

    Hi to all,
          I want bring Quarter Period and Previous Month value for the given Input. Plz help me on this
    Example :
    Input : 06.2008
    Output:
    Input     Prev.Month  Quarter 1   Quarter 2   Quarter 3 
    06.2008  05.2008      03.2008     12.2007     09.2008
    12.2008  11.2008      09.2008      06.2008    03.2008
      Is there any Standad Exit for this or we have to write coding ?
    Regards,
    Saran

    Hi,
    You can solve this by using Replacement path.There you have a option offsets.Here give the current period.Based on that give the number which previouse month you suppose to want.
    I think this 'll help you
    assign points if this helps
    Regards
    JT Goud

  • Stock Values for previous period on batch number

    Need to show report which shows stock value and levels on a certain period (previous) by batch numbers.
    Report MMBE shows current stock levels per batch.
    Report MB5L shows stock value on a certain period (previous) but with no batch information
    Is there any standard reports which you can see all stock values and levels for the previous period on batch?
    Thanks

    Hi,
    Good morning and greetings,
    Please go through the following link
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/25/2839124f7811d18a150000e816ae6e/frameset.htm
    Please reward points if found useful
    Thanking you
    With kindest regards
    Ramesh Padmanabhan

  • Closing material for previous period (CKM3)

    Hi Guys,
    I have a problem, which im going to close a material for current period with status "quantities and values entered".
    But system wont allowed it, because the previous period hasnt close yet, and the status also "quantites and values entered"
    Logically i need to close the previous period first.  But if i do that, does it comes with an inventory journal impact?
    How if i just want to close for the current period only..
    Regards,
    Beto

    Hi,
    First of all go to t code MMRV and check what period it shows there. If its a previous period then go to MMPV and close all the periods one by one.
    Secondly check if your system has been  Configured for Price Change in Previous Period/Previous Year  in the IMG settings under MATERIAL MANAGEMENT - VALUATION AND ACCOUNT ASSIGNMENT.
    Thanks,
    Atal

  • COPA Report current period and previous period issue

    Hi Gurus,
    I have defined COPA report (Tcode KE94) based on line items. Now I want all values to be displayed based on an entry parameter in terms of period. That is to say that  If I give input values of "010.2013" as a period entry , my report should display the values for the the period specified i.e. 010.2013 in the first column and in second column  values for the period 009.2013 should be displayed and in the third column values for the period 001.2013 till 010.2013 should be displayed cumulatively.
    For this, I choosed the character "period/year" in General data selection tab, clicked "Variable on/off" tab and gave values "From"  as well as "To" for the Global Variable "OFP"  which is Curr.fisc.per./year.
    For the 1st column (1st column which is suppose to display the values according to selection parameter), along with the character "company code" , I choosed the character "period" and clicked "Variable on/off" tab and gave value "From"  as well as "To" for the Global Variable "OFP"  which is Curr.fisc.per./year.
    For the 2nd column (2nd column which is suppose to display the values for the immediately preceeding period of the selection parameter), along with the character "company code" , I choosed the character "period" and clicked "Variable on/off" tab and gave value "From"  as well as "To" for the Global Variable "OFP"  which is Curr.fisc.per./year. While doing so, I selected operator as "-" and choosed offset as 1.
    For the 3rd column (3rd column which is suppose to display the cumulative values from the beginning of the fiscal year till the period mentioned in the selection parameter), along with the character "company code" , I choosed the character "period" and selected 001 in "From" and 016 in "To" tab.
    Company Code selected in all the three columns is same and I have selected actual values i.e. 0 for "plan/actual indicator" tab.
    When I run the report through Tcode KE30 , I give values as "010.2013" for the From and To selection tabs. System shows the values as per the selection parameter in the 1st column which is correct  but display values same as per coulmn 1st in the 3rd column which is wrong because it should be cumulative. 2nd column is blank. 
    How to display the values for the immediately preceeding period and for cumulative period?
    Regards,
    makrand

    Dear Ajay,
    Thanks for the reply. Here are the screen shots.
    For the general data selection tab
    For the first column "current month" i.e. for the month
    For the second column "Last Months"
    For the third column "Cumulative" i.e. year to date
    Following is the result of KE30
    Values for the period 010.2013
    You can see that values in the report for the period 011.2013 contains value for the previous period which is 59090.21
    This value is matching when the report is run for the period 010.2013.
    But in both the reports,the figures for Current month and YTD (year to date) are same.
    Please let me know what setting is required in the current month column.
    Regards,
    makrand

  • Depreciation repeat run -previous period

    We have done planned depreciation run for 10th (currrent) period  without running repeat run for 9th (previous) period.
    Please help us how to carry repeat run for 9th period.
    thanx in advance
    Srihari

    Hi Srihari,
    "N" number of times you can able to Re-run depreciation posting, no doubt about it.
    here you are posted dep for 10th period and again you are capitalised asset for previous period (9th), now we have two options.
    1 - Based on dep key system calculate dep for previous periods and post next period (11th)
    Ex: Asset Value = $ 12000 % use ful life 10 years.
    Dep 10% every month  = $ 100
    here when you execute dep for the period 11th system post $ 300 depreciation value. ( this method called Catch up method)
    2 - Smoothing Method ( Go to T.Code: OAYR and select Smoothing Check Bok)
    now your asset report shows from 9th to 12th period $100 every month.
    this situation you can run again Re-Run Depreciation, system will post dep amount respective months.
    Regards
    Viswa

  • Show Previous Balance value in Report.

    Hi,
    I'm using Crystal Reports with Visual Studio 2010. I'm generating a report which shows columns Debit and Credit and SUM values on the buttom of each column. The report is filtered using a date range, which I specify in my connection via C# code (below).
                string sqlString = "";
                sqlString = "SELECT * FROM Ledger WHERE ([Payment Date] >= #" + FromDate + "#) AND ([Payment Date] <= #" + ToDate + "#)";
    Now I need a "Previous Balance" value, which would be the SUM of Credit and Debit columns, which are prior to "Payment Date".  How do I accomplish this?  I've attached a sample of the report I'm looking for. Please be specific with your reply, because I'm new to Crystal Reports.
    Thank you so much for your help.
    Aron

    Hi Aron,
    Crystal is database agnostic, meaning it will run a report against any database.  If you create a report using AS/400 it's possible to use that same report against an Oracle or SQL Server database as long as the recordset Crystal is expecting is the same.
    So having a report run from a Stored Procedure will work on different databases as long as the metadata for the Stored Procedures between the databases match.
    For the subreport, when  you drop the subreport into the Group Footer.  Right-click on the subreport and you have the option to Link Subreport.  You can select the OwnerID from the main report and link it to the OwnerID in the subreport.
    Your c# suggestion may be going the long way around the barn.  If you link the subreport in your Group Footer 1, you should be able to get the Previous Balance for that OwnerID.  When you link the subreport, it creates a Record Selection Formula in the subreport that should return only the records for that OwnerID.
    Once you have the subreport linked, edit the subreport and go to Report | Selection Formula | Edit Record Selection Formula.  You'll see what the linking created.  You can now edit that formula to include your date range that is outside the current period.
    Hope this helps,
    Brian

  • Allow Posting to Previous Period - MMRV

    Dear Friends,
    We can open / close MM periods thru MMPV & see the currently open periods thru MMRV.
    Now when we check current Period in MMRV, we see three periods:
    Current period                 07 2009 (October 2009)
    Previous period               06 2008 (Septermber 2009)
    Last period in prev.year  12 2008 (March 2009)
    Here we have also Allowed posting to Previous Periods.
    Thus current open period is 07 2009 (October 2009) & we can also post in Septermber 2009 (06 2009).
    But the real problem is can we post some MM Documents in March 2009 (i.e. 12 2008)? Currently when we try system gives error - Posting only possible in 07 2009 & 06 2009.
    I know it is SAP standard to allow only two MM months to be open at a given point of time.
    Then what is the use of "Last period in prev.year  12 2008" in MMRV screen?
    Waiting for early replies...
    Thanks,
    Jignesh Mehta

    In SAP system, you can only post stocks to one back period only by checking the Check Box in MMRV Transaction.
    The entries you mentioned (Current Period, Previous Period, etc. are just information purpose only.
    In certain cases, for ex: changing valuation Class etc., you have to check the stocks in Current, previous period and last period in previous year.
    So you can get information of periods in MMRV Transactions.
    For back posting to other periods (other than previous period), you should use Transaction MMPI.

  • How do I read a hex value and then convert to the binary equivalent?

    I am reading hex values from a register on my unit under test. I only want to monitor certain bits in the hex value to check a status. I have everything down to run the program except how to read my hex values in binary form. Any suggestions out there?

    If this is just a matter of display, then right click and choose "Format & Precision...". Beware, this works only with integer indicators (I8/16/32 and U8/16/32).
    If the problem is to extract a bit value in a specific position, then go to the "Advanced >> Data manipulation" sub-palette where are all bit manipulation functions (rotate, shift, split...).
    Don't forget either the logical functions (And, Or...) in the boolean sub-palette, where is also the "number to boolean array" function (to be used in conjunction with an index array node).
    Another option is to use string conversion functions, in the "String >> String/Number conversion" sub palette.
    Have a look to the attached image.
    Enough ?
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Hex_&Bin.tif ‏20 KB

  • Compare previous row values for the same id and decide

    Hello ,
    I have this sample data
    create table #student_academic
    pk_id int identity(1,1) primary key ,
    student_id int ,
    [year] int,
    [aggr_marks] float
    insert into #student_academic
    student_id ,
    [year] ,
    [aggr_marks]
    values
    (112,2012,55.4),(113,2012,65.4),(114,2012,82.32),
    (112,2013,75.4),(113,2013,91.22),(114,2013,45.45),
    (112,2014,61.2),(113,2014,95.2),(114,2014,75.6)
    select * from #student_academic
    from the above data i have to generate an extra status column. this status column should be decided by comparing the previous row value. the exact output should be like below.
    student_id year aggr_marks Staus----------------------------------------------------------
    112 2012 55.4 None
    112 2013 75.4 Promoted
    112 2014 61.2 Demoted
    113 2012 95.2 None
    113 2013 75.6 Demoted
    113 2014 91.22 Promoted
    113 2012 45.45 None
    113 2013 65.4 Promoted
    113 2014 82.32 Promoted
    is there any way to write the t-sql with out using cursors ? this table has around 25GB of data. Any idea would be appreciated.
    Thanks in advance.

    Hello,
    The difficulty of your example is
    that there are several rows for
    the same year and the same student.
    I present a solution
    if there is
    one line per year per
    student:
    TRUNCATE TABLE #student_academicinsert into #student_academic
    student_id ,
    [year] ,
    [aggr_marks]
    values
    (112,2012,55.4),(113,2012,65.4),(114,2012,82.32),
    (112,2013,75.4),(113,2013,91.22),(114,2013,45.45),
    (112,2014,61.2),(113,2014,95.2),(114,2014,75.6)
    Go
    WITH CTE AS
    (SELECT pk_id, student_id, year, aggr_marks,
    (SELECT TOP 1 aggr_marks FROM #student_academic AS b
    WHERE a.student_id = b.student_id AND a.year -1 = b.year
    ORDER BY student_id) AS prev_aggr_marks
    FROM #student_academic AS a
    SELECT
    pk_id, student_id, year, aggr_marks,
    CASE
    WHEN prev_aggr_marks IS NULL THEN 'None'
    WHEN aggr_marks < prev_aggr_marks THEN 'Demoted'
    WHEN aggr_marks >= prev_aggr_marks THEN 'Promoted'
    END AS Status
    FROM CTE
    ORDER BY student_id, year
    Regards,
    Charlie
    Charlie Dancoisne - Independent Consultant & Trainer (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable. This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

  • Reading the output values after each step executes in LabVIEW User Interface

    Hello all,
    Development environment: TestStand 2010 SP1 and LabVIEW 2010 SP1
    Problem: is there a way to execute the subsequent steps programatically and get the output values from each of them?
    I have already extended a little bit a Full OI interface for TestStand to load up any sequence, choose some of the steps and run them step by step (something like option to Run Selected steps). What I am trying to do is to add some actions between each step and do that in User Interface (I can't modify the sequence!), so I am starting the NewExecution with some previously configured InteractiveArgsParam and set an option breakAtFirstStep to True. Afterwards I am just doing something like Step Over when debugging the sequence and this works good, but I didn't fine a way yet to read the output values from the steps...
    Then, if I wait until the execution finishes I can read my Results by processing the ResultObject, but this works only after finalizing of the test sequence. Since I wanted to stop after each step, read the values, do some actions and continue to the next step I tried to register an event callback for Trace of Execution View Manager. I can see that after each executed step this event is triggered, but when I try to read a ResultObject returned in Event Data it is not filled with values (ResultList seems to be empty?). Is it a proper behaviour or maybe I am doing the readout in wrong way? (It is the same VI as for reading ResultObjects after sequence finishes and there it works fine for arrays, containers and other data types).
    Like I mentioned I can't modify the Test sequences, I can't add a UImessages.
    What are my options? Should the trace event returns all output values from each steps or is it just used for status checking? Or maybe there is completely different approach to that matter?
    Thanks in advance for any suggestions,
    Best Regards.
    CLA, CTD, CLED @ Test & Measurements Solutions Poland
    Solved!
    Go to Solution.

    Thanks for your replay, I have tried to build it in my LabView Block Diagramm, es seems like this image.
    But the variable GetNumSubProperties ist always 0. Why?
    PS: I need only the variable "Step.Result.PassFail" from the last step, do you know, how can I get it? I think, it is maybe easier than read all the "Result".
    Attachments:
    ReadStepResultInLabview.JPG ‏39 KB

Maybe you are looking for

  • Can using BouncyCastle be an alternative to installing the policy files?

    Hey, sorry if this is a dumb question but I have been looking into this all day. I want to write a program that incorporates unlimited strength encryption, but installing the JCE Unlimited Strength Jurisdiction Policy Files is not an option (I can do

  • Please help me with securing my network!!!

    I have the bewf11s4 wireless router and i have a problem, I went through the whole set up i can get online, but i REALLY want to lock my connection, i dont particularly need everyone in my neighborhood stealing my internet.  however when i go to the

  • Two cursors with interdependency: how to code ?

    Hi, I'm a newbe to pl/sql. I've two tables: customers and purchases. A customer can have more than on purchase. I want to create invoices, for each customer one invoice for all purchases in this year. (Simplified for this situation). I created a curs

  • Poor signal in strong signal area (N95)

    Hi guys, I have a N95 & when I'm at home & should get a strong signal I drop calls & can't even send txt's when I'm in an area with lower reception I get full signal bars ?? is there a gain setting ?? thanks in advance Paul1966

  • RP_EVALUATE_INDIRECTLY_P0008 --- LOW PERFORMANCE

    Hi Experts..          I was trying yesterday to solve a performance problem after an upgrade from 4.6 to 6.0 and I found that the main cause was the running of the routine above... I searched for notes finding nothing........ and I figured out that t