DTP Routine to load only last year data

Hi Gurus,
I have a requirement to load only last year ( 0CALMONTH  i.e MM/YYYY)  data based on current year in transformation, Please could you correct below code...
DATA: l_idx like sy-tabix.
  DATA: DATE_H TYPE D.
  DATE_H = SY-DATUM(4) - 1.
  l_t_range-SIGN = 'I'.
  l_t_range-OPTION = 'EQ'.
  l_t_range-HIGH = DATE_H.
  if l_idx <> 0.
    modify l_t_range index l_idx.
  else.
    append l_t_range.
  endif.
  p_subrc = 0.
Right now it is bringing upto last year data. Please could you guide me what changes needs to be done...
Thanks
Ganesh Reddy.

DATA: DATE_H(6) TYPE c,
             DATE_L(6) TYPE c'
             L_YEAR(4) TYPE c.
L_YEAR = SY-DATUM(4) - 1.
CONCATENATE L_YEAR '01' INTO DATE_L.
CONCATENATE L_YEAR '12' INTO DATE_H.
l_t_range-SIGN     = 'I'.
l_t_range-OPTION = 'BT'.
l_t_range-LOW     = DATE_L.
l_t_range-HIGH     = DATE_H.

Similar Messages

  • Sample ABAP routine code to load only previous month data in INFOPACKAGE

    Hi all,
    I want to create one ABAP routine in InfoPackage (Variables change to selection values with background processing) for 0CALMONTH ( Calender year month) so that whenever this infopackage is executed it should fetch only previous month data.
    Can anyone please provide any sample code for that.
    Thanks in advance.
    Uday shankar.

    Hi
    Please check with below code, hope this will resolve your issue
    WHEN: 'ZLASTP'.
         CLEAR: h_period, h_gjahr.
         CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
           EXPORTING
             i_date               = sy-datum
       I_MONMIT             = 00
             i_periv              = 'AF'
          IMPORTING
            e_buper              = h_period
            e_gjahr              = h_gjahr
    EXCEPTIONS
       INPUT_FALSE          = 1
       T009_NOTFOUND        = 2
       T009B_NOTFOUND       = 3
       OTHERS               = 4
         IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
         IF h_period = '001'.
           h_gjahr = h_gjahr - 1.
           h_period = '012'.
         ELSE.
           h_period = h_period - 1.
         ENDIF.
         CLEAR l_s_range.
         CONCATENATE h_gjahr h_period INTO l_s_range-low.
         l_s_range-sign = 'I'.
         l_s_range-opt  = 'EQ'.
         APPEND l_s_range TO e_t_range.

  • Not getting Last year data in query

    Hi All
    i have created one query on cost element cube.i have two col in the query i.e amount(present year) and amount (past year).
    For getting the past year data I have set the offset -12 for the fiscalyear/ period variable in the query i also restricted the fiscal year variant v3 in the amount. but i am not getting the corect value  for the past year . if i run for 2011 and 2010 for the same period i am getting right value in Amount(present year) but if i run the query for 2011 for same period i am not geting right value in amount previous year data. Kindly help me how to  get right data.

    Hi Atul,
    There are certain restrictions when you are reporting over multiple time frames,
    1) You should not put the global restriction of the time period on which you want to display data e.g. 0CALMONTH or 0FISCPER etc.
    you can put the global restriction but it should be at high granularity. for e.g. when you are reporting on Present month and last month then you can put restriction on Year, here you should take care when you are giving input as first month then last month of previous year data will not be displayed untill year is restricted for current as well as previous year.
    Another thing is
    2) You should not put time characteristic in drill down otherwise data aggregation doesn't happen.
    If you want to take any time characteristic input then it should be included in the specific RKF only, though Input ready variables.
    Regards,
    Durgesh.

  • How to load only BW text data into BPC 10.0

    Hello,
    I am trying to load BW text data into BPC 10.0 objects.
    For BW InfoObject 0VERSION there is no attribute data (no P, Q, M tables) only text data (T table).
    For BW InfoObject 0VERSION I created VERSION as Dimension in BPC 10.0 and it is not having any properties.
    I created a Transformation file to load the data from 0VERSION of BW to VERSION of BPC and in the validation it is giving an error.
    In the Validation it is giving error as '0VERSION is empty' but data is available in 0VERSION of BW.
    Based on the error I am thinking that we cannot load only Text data from BW into BPC if they don't have any attribute data. Please correct me if I am wrong.
    Is it possible to load only Text data without attributes from BW to BPC?
    Can some one help me in loading the data?
    Thanks in advance
    Venkat

    Hi Gersh,
    Thank you for the reply.
    I mapped Dimension ID to 0VERSION but still it is giving error.
    In the validation it is saying as 0VERSION is empty but data is there in the BW system.
    Please find the screen shot of the Transformation file and the error.
    Thanks in advance
    Venkat

  • Dates -- Pulling the last year data!, which should'nt be the case.

    Need some basic SQL Help ..
    Iam supposed to pull the data based on a date column(end_time) -- Yesterday 3PM untill Today's 3PM.
    Iam getting last year's data too in additon to Current Data.
    Where am i comparing wrong??
    SELECT a.*
    FROM table a
    WHERE TO_CHAR (a.action_end_time, 'MM/DD/YYYY HH24:MM:SS') >=
    TO_CHAR (SYSDATE - 1, 'MM/DD/YYYY')
    || ' 15:00:00'
    AND TO_CHAR (a.action_end_time, 'MM/DD/YYYY HH24:MM:SS') <=
    TO_CHAR (SYSDATE, 'MM/DD/YYYY')
    || ' 15:00:00'
    ORDER BY a.end_time;

    Date math, 1 = 1 day 1 / 24 = 1 hour, trunc with no date format gives midnight
    Try this.
    select a.* from table a where
      a.action_end_time between trunc(sysdate) + (15 * 1 / 24)
                            and trunc(sysdate - 1) + (15 * 1 / 24) In your example you are comparing strings, not dates.

  • Loading only last image

    This code is loading the xml correctly, populating the mainClipArray correctly, but only adding the last image to the stage.
    I think it is not waiting for completeClipLoad() to complete.  I tried removing :void from the function to see if waiting for a return would do it, but no luck.
    Any ideas?
    CODE:
    var myXML:XML;
    var xmlLoader:URLLoader = new URLLoader();
    var mainClipArray:Array = [];
    var counter:int = 0;
    var myLoader:Loader = new Loader();
    xmlLoader.load(new URLRequest("portfolio.xml"));
    xmlLoader.addEventListener(Event.COMPLETE, completeXMLLoad);
    function completeXMLLoad(e:Event):void{
        myXML = XML(e.target.data);
        var len:int = myXML.portfolio.unit.length();
        for(var i:int = 0; i<len; i++){
            counter = i;
            mainClipArray[i] = new pane();
            //Load small image
            var smallfilename = myXML.portfolio.unit[i].small.filename;
            myLoader.load(new URLRequest(smallfilename));
            myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeClipLoad);
            mainClipArray[i].x = i * 15;
            addChild(mainClipArray[i]);
    function completeClipLoad(e:Event):void{
        trace("made it in");
        mainClipArray[counter].addChild(myLoader);
        trace("added child");

    Delaying the progress isn't going to help if you still have only one loader.  I would say that you could move the var myLoader:Loader = new Loader(); line inside the loop so that you have a new loader instance for each loading occurence, but then you would also need to adjust the completeClipLoad function to use the event target (e.target) instead of "myLoader".  But that still wouldn't resolve matters completely because you have that counter variable that will be working as fast as the for loop, with the loop likely finishing before the first item gets loaded... and since your completeClipLoad also makes use of that variable, you'll end up with only the last pane object being used.
    If you want to control the order of loading and retain the code in the one place (the other suggestion offered above having the code inside the pane could also be a viable approach), then a better strategy is to to use a programmed loop rather than a for loop, where only one loading occurs at a time and the completion of one loading triggers the next to begin.  Something like (this is just an outline form)...
    counter = 0;
    imgArray;
    function completeXMLLoad(e:Event):void{
         ... // process all the xml into the imgAray
        loadSmallImage(); // start by loading the first image only
    function loadSmallImage(){
         // create loader instance
         // assign load complete listener
         // load imgArray[counter]
    function loadComplete(e:Event) {
         // process the loaded image in a new pane
         // increment counter
         // if counter is < imgArray.length -> loadSmallImage();

  • CRM Interactive Reports show only current year data

    Hello,
    We have configured CRM Interactive Reports for IC scenario (CRM 2007) and are using reports like 'Service Ticket Volume', 'Service Ticket Closure', etc.
    The issue is when we run reports (through IC_Manager business role), they only display data from January 2009 onwards. There is lots of data available in the system for 2008 which we can see from the backend. And we are also selecting date range that includes 2008. But somehow the report only shows tickets from Jan 2009 onwards.
    Any clue why this is happening?
    Thanks,

    We've resolved this issue so I'm closing this message.
    Thanks,

  • How to load member for "sales same date last year"?

    I need to load a member in Measures named "PriorYrSales" with "Sales" for the same date last year as today's date. Thus, retrieving "PriorYrSales" for 2/10/2002 would return the sales amount for 2/10/2001. Since days roll-up to months, quarters, years, it would be easy to determine how we're doing compared to the same time last year.Data is loaded each day for a date range from the current date and the preceding x days. Substitution variables are available for the beginning and ending date and the same dates for last year.For example: Data is loaded from beginning date of 2/01/2002 through ending date of 2/10/2002.The prior year date variables contain 2/01/2001 and 2/10/2001.The time period dimension is as follows:FY01->Jan2001-->01012001 (Alias: 1/01/2001)-->01022001 (Alias: 1/02/2001)-->all the dates in Jan->Feb2001-->02012001 (Alias: 2/01/2001)-->02022001 (Alias: 2/02/2001)-->all the dates in Febetc.FY02->Jan2002-->01012002 (Alias: 1/01/2002)-->01022002 (Alias: 1/02/2002)-->all the dates in Jan->Feb2002-->02012002 (Alias: 2/01/2002) -->02022002 (Alias: 2/01/2002)-->all the dates in Febetc.Thanks your any and all suggestions.Phil

    Perhaps I wasn't clear in the first post. The intent is to easily compare sales for a current date/period to the same date/period last year. Neither Excel nor Analyzer provide a method that I'm aware of to retrieve data as follows:-------------------------------------Period Sales PriorYrSales Diff4/15/2002 1,000 900 100-------------------------------------(900 is sales for 4/15/2001)(100 is the calculated difference.)Nor can I do this:-------------------------------------Period Sales Period Sales Diff4/15/2002 1,000 4/15/2001 900 100-------------------------------------What Excel and Analyzer do allow is:-------------------------------------Period Sales 4/15/2002 1,0004/15/2001 900-------------------------------------I readily acknowledge that the data is redundant but I can't think of another option that will allow Excel and Analyzer to easily retrieve the values for comparison. If the PriorYrSales member can be loaded then the users can compare years, quarters, months and days quite easily.My challenge is knowing how use a calc script to derive prior year dates that correspond to current year dates. Something like:PriorYrSales->04152002 = Sales->04152001I've considered arrays but I've never used them and the documentation is not helpful enough for me.Thanks for your response.Phil

  • Routine to capture last month data

    Hello Frnds,
    For a Dataload from the datasource Actual Cost Component Split(0CO_PC_ACT_10), we want to capture last month data ,
    we are planning to write a routine in infopackage level,
    using the option 6-ABAP routine, to select the last month data ,
    we have the time characteristics 0FISCPER, At present we managing the load by manually changing the selection for last month every time ,
    It would be a great help if anybody can show a sample code to select last month data,
    Thanks,
    saty

    If 'last month data' for you is equivalent to 'actual month data', post this code (corrected) into your IPACK dynamic selection:
    DATA: zyear type /BI0/OIFISCYEAR,
    ______zperiod type /BI0/OIFISCPER3,
    ______zfiscper type /BI0/OIFISCPER.
    CLEAR: zyear,
    _______Zperiod,
    _______zfiscper.
    MOVE sy-datum+0(4) to zyear.
    MOVE sy-datum+4(2) to zperiod.
    concatenate  zyear zperiod into zfiscper.
    l_t_range-iobjnm = '0FISCPER'.
        l_t_range-fieldname = '/BI0/FISCPER'.
        l_t_range-sign = 'I'.
        l_t_range-option = 'EQ'.
        l_t_range-low  = zfiscper.
        l_t_range-high = zfiscper.
        APPEND l_t_range.
    Message was edited by: Claudio Caforio

  • In Flat File Load last 3 data

    Hi Friends I have a Source system as a Flat File..
    All data Packets are loaded but last 3 data packets are not updated and it is still running, and they did not use PSA. In transfer ruls/Update Rules all are showing updated in Monitor, but 3 Data Packets are in Yellow what is the reason, but in Status it is showing No Errors the request is still running and " <b>Processing arriwed in BW Processing selected number doesn't agree with Transfer number"</b> this is the message in Transfer Idocs in Monitor.
    What is the problem?. and how to solve it. <b>Here No PSA.</b>
    Thanks

    hi,
    we had similar problems.
    In our it was the database. The folder for the archive logs was simply on it limit.
    Hope I could help you,
    best regards,
    christian

  • ABAP Logic - This Month This Year to This Month Last Year problem

    Hi All,
    I have a following requirement ... the report currently compares This Month This Year to This Month Last Year. But this is not a valid comparison for the user until the end of the month is reached as only then is it comparing 2 full months. We would like to use a formula replacement path variable to work out which proportion of data we have for this month. ie. if its day 15, we have 50% of data (if there are 30 days in the month - this just an example), therefore we should only show 50% of This Month Last Years column so that the comparison between the 2 is sensical.
    So I'd like the formula variable to return a ratio or percentage which I can then use in a calculated key figure in the query to pro-rata the last year data.
    The query currently displays data by Fiscal Period, so when working out the ratio I would need to check which Fiscal Period we're in and also consider that the data is loaded every night, so on the 1st day of a Fiscal Period we are comparing everything up until yesterday.
    Can anyone see in problem with the logic of this, or better yet, has anyone done this before and maybe has some code for me? Is there another way I could be doing this?
    Edited by: Julius Bussche on Sep 19, 2008 4:31 PM

    Have you tried google for this Error Message...
    http://support.microsoft.com/kb/959077

  • Calculating this month of last year revenue

    Hi,
    i am preparing a new dashboard like below
    month total revenue total revenue of last year (january - 2011)
    january 125.00 120.00
    can you please share your experience how can i do this?

    Hi,
    If you always want to show the previous years data (ie not only last year, but last two/three/.. years) then you can use AGO function in
    RPD.
    Refer for AGO-
    http://gerardnico.com/wiki/dat/obiee/ago
    OR,
    But if you are using for a single last year then in the column formula use - 'January'||cast(year(current_date)-1 as char)
    (If its always January you want)
    Hope this helped/ answered.
    Regards
    MuRam
    Edited by: MuRam on Jun 12, 2012 5:08 AM

  • Last count date conversion

    Hi SAP experts,
    We have a field available in legacy with the last count date (per material and plant). We would like to load this date in the last count date field in MARD table so we can continue our physical inventory schedule for this year. How can we load this last count date in SAP?
    Thanks and regards, Jose Oyon.

    Hi,
    We are using split valued materials and the date of the last count field is in table MCHB (Batch stocks). In the BAPI we are using to load the material master data, this table is not available. MARD and the date of last count field is available in the BAPI so we are okay to load this date of last count field for non-split valued materials. How can we load this field for split valued materials?
    Another concern I have is that we are doing a direct table update by entering this date in MARD or MCHB. Are you guys aware of any negative consequences?
    Thanks and regards, Jose Oyon.

  • Dublicate the database with one year data

    Hi DBA's
    I need to create the duplicate database instance. But only one year data from the source instance to target instance, source instance is having 3 years data.
    is it possible to do so? and which method i have to follow to create a Duplicate instance?
    One year data is having in size nearly 1 TB .
    Regards,
    SG

    Please see this thread for similar discussion -- ebs cloning version 11.5.10.2
    Thanks,
    Hussein

  • How to design extractor can have only current Fiscal Year data.

    Dear Experts,
    I require a full upload DSO , which can have only current fiscal year data . I have created view putting there certain conditions for minimising the data size. How i can restrict it , to have only current fisacal year data for YTD reports. It would be daily uploaded.
    Should i created Data Source based on function ?
    Regards,
    Anand Mehrotra.

    while extracting the data from source you can set the filters at the info package level so that it will not extract the previous years data.
    In the data selection tab in Info package enter the current fiscal year and schedule the IP it will extract only the current year data.
    next execute the DTP to load data till DSO.
    the data is restricted in the infopackage level before entering to PSA so there is no need to write any routines in the DSO level.
    Edited by: prashanthk on Feb 1, 2011 12:45 PM

Maybe you are looking for