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

Similar Messages

  • HT201269 ibook stopped transferring images via image capture. last month it worked. i hav an old ibook and i cannot update to newest itunes. which is fine. however, i need the image capture to take photos off my iphone 5. no, i dont want to use i cloud.

    ibook stopped transferring images via image capture. last month it worked. i hav an old ibook and i cannot update to newest itunes. which is fine. however, i need the image capture to take photos off my iphone 5. no, i dont want to use i cloud. i would actually like to just plug it in to the usb drive the old fashioned way

    I don't believe the iOS7 update was the cause for your issue. I have three devices all updated and they all show the Import To drop menu in Image Capture as shown below.

  • Get the yesterday or last month data

    Hi ,
    I've need a small help .
    This is the scenario.
    If today is 1st feb. so I need to get last month data.
    if today is 30 th i need to get the current month data before 30 I mean 29 days data.
    I have to do it automatically i mean i need to write case statement in my existing query by using sysdate and i have to get it .
    pls help me out . Your help is greatly appreciated.
    Thanks & Regards,
    madhav.

    Haven't tested it, but you could try something like
    This gives you last months data if executed on the first day of the month otherwise this months data until the day before today
    select *
    from my_table
    where my_date >= add_months(trunc(sysdate, 'MM'), sign(trunc(sysdate)-trunc(sysdate, 'MM'))-1)
    and   my_date <trunc(sysdate)After I read your posting again, I guess you wanted something else
    This query now gives you last months data if executed on the first day of the month otherwise the data of the day before today
    select *
    from my_table
    where my_date >= (case when trunc(sysdate) = trunc(sysdate, 'MM') then add_months(trunc(sysdate, 'MM'), -1) else trunc(sysdate-1) end)
    and   my_date <trunc(sysdate)Message was edited by:
    Jens Petersen

  • Need formula in my subreport to get last month date - CR XIr2

    Post Author: olesco
    CA Forum: Formula
    I need to pass the value (#of units) from the subreport to the main report u2013 I know how to do that but my problem is I donu2019t know what formula should I put in my subreport  to get last month date.
    Both main report and subreport have a date parameter (Field link - {?DatePrompt}. What I need is when I fill in the current month date to the main report the subreport should process the last moth date.
    Main report u2013 Date Range (2007-10-1) (2007-10-31) - result  #of units = 22
    u201CRecord Selection Formula Editor
          DateRecd = {@DatePrompt} &#91;i.e. current month&#93;
    Subreport u2013 should have data from last month - result  #of units = 25
    u201CRecord Selection Formula Editor
          DateRecd < {@DatePrompt} &#91;last month&#93;   ??????
    There are   22 3 units this month and   25  units last month.
    Any help is greatly appreciated.

    Post Author: SKodidine
    CA Forum: Formula
    DateRecd in dateadd('m',-1,minimum({@DatePrompt})) to dateadd('m',-1,maximum({@DatePrompt}))

  • Transformation routine to get last month value

    Hi experts,
    I am trying to write a routine in a transformation to get last months value from another dso.
    Here is my code:
    Data:
    zamnt type F,
    zmonth type c length 6.
    zmonth = sy-datum+0(6).
    select sum( /BIC/ZAMNT ) into i_amnt
    from /BIC/AZDSP00700
    where CALMONTH = zmonth -1.
         RESULT = zamnt.
    I get an incorrect expression "where CALMONTH = zmonth -1." because it does not understand "-1"
    Can anyone help me?

    Hi Odd Hilt,
    Please confirm CALMONTH format is yyyymm or something different.
    If CALMONTH format is yyyymm.
    try following code
    zmonth = sy-datum+0(6).
    ZMONTH1 = ZMONTH - 1.
    select sum( /BIC/ZAMNT ) into i_amnt
    from /BIC/AZDSP00700
    where CALMONTH = zmonth1.
    RESULT = zamnt.
    Thanks,
    Chandra

  • ABAP routine for loading previous months data in infopackage

    Hi,
    I have an infopackage included in a process chain. The issue is that I need to load previous month's data through the infopackage and I have a data field which is of date type. I could not find an appropriate OLAP variable so I chose the ABAP code in the infopackage. My knowledge of ABAP is not very good so I thought I could get some insight from someone. Need this to be a periodic job/regular without any developer interference.
    Edited by: BG on Apr 9, 2008 1:03 PM

    Hi
    Try this code and see if you are able to achive the results
    data: month(2).
    data: date  like sy-datum,
          last  like sy-datum,
          first like sy-datum.
    read table l_t_range with key
    fieldname = 'BLDAT'.
    l_idx = sy-tabix.
    date = sy-datum.
    month = date+4(2).
    if month = 12.
      month = 01.
    else.
      month = month - 1.
    endif.
    move month to date+4(2).
    call function 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
      exporting
        day_in                  = date
    IMPORTING
       LAST_DAY_OF_MONTH       = last
    EXCEPTIONS
      DAY_IN_NOT_VALID        = 1
      OTHERS                  = 2
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    first = last.
    move 01 to first+6(2).
    l_t_range-low  = first
    l_t_range-high = last
    l_t_range-sign = 'I'.
    l_t_range-option = 'BT'.
    modify l_t_range index l_idx.
    p_subrc = 0.
    paste the code as it is in your editor activate this and see if you are able to achive the results.
    assign points if useful.
    regards
    Vishal
    Edited by: Vishal Vashishta on Apr 9, 2008 2:33 PM

  • How to take last months date to current month date

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

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

  • Need to DELETE and LOAD data of the Last month to

    Hi Experts,
    I need to delete the last month data from cube because One material is not updated with a Required value. We have made some changes in Update routine for a Value. The Same change must be reflected from last month of data ,
    So I need to delate the data based on selection. And reload  the data again. And the data flows from
                                               2LIS_13_VDITM (Info Source ) to ZSD_C03 (Info Cube). 
    I read many SDN threads, but I am getting confused.
    How can I proceed for these  ?
    Thanks,
    Utpal.

    Hi Srikanth,
    Thank you for responding.
    I had a problem on one material. So deleted the request and Reload it from PSA. That issue got solved.
    And Now the problem is , Now my senior is saying Delete the data from April-09 till date and Reload it. The issue is My CUBE ( ZSD_C03 ) is updated with 4 data sources. 2LIS_11_V_ITM   ,  2LIS_13_VDITM   ,  2LIS_12_VCHDR  , 2LIS_11_VAITM .
    And I need to delete data from 2LIS_13_VDITM  data source . How Can I proceed for the current issue   ?
    Please suggest   ...
    Thank you ,
    Utpal

  • Powershell Change date to the first day of last month whenever i run the script.

    If I run the script on 2/4/2013 or any other day in February I want the date to be change to 1/1/2013. I am replacing date on line 59 with this value.
    Get the content of the CMS Script.
    $CMSReport = Get-content C:\reports\CMSReport.acsauto
    Go to line 59 and replace the date for Last Month date.
    $CMSReport[58] = $CMSReport[58] -replace "([1-9]|0[1-9]|1[012])- /.- /.\d\d", [datetime]::Today.ToShortDateString() $CMSReport | Set-Content C:\reports\testCMS.acsauto
    Run the CMS script
    Invoke-Expression -command "c:\reports\testCMS.acsauto"

    PS C:\> $lastMonth = (get-date).AddMonths(-1)
    PS C:\> $firstDayOfLastMonth = get-date -year $lastMonth.Year -month $lastMonth.Month -day 1
    PS C:\> "{0:yyyy-MM-dd}" -f $firstDayOfLastMonth
    2013-01-01
    Bill
    Hello AbqBill,
    Thanks for getting me there. I am a lot closer to the final goal. I input what you suggested and I am getting different results as you. here what I did.
    $LastMonth = (Get-Date).AddMonths(-1)
    $FirstDayofLastMonth = Get-Date -year $LastMonth.year -month $LastMonth.month -day 1
    $CMSReport = Get-content C:\reports\CMSReport.acsauto
    $CMSReport[58] = $CMSReport[58] -replace "([1-9]|0[1-9]|1[012])[- /.]([1-9]|0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d", "{0:dd/MM/yyyy}" -f $FirstofLastMonth
    $CMSReport | Set-Content C:\reports\testCMS.acsauto
    I get 12/1/2013. Which bring me to 2 questions. How will this solve when it is January and it has to put last month last year? and why is it going back two month instead of 1?

  • Last Month's data

    How do you report on last months data. I know there is a session variable for current month, i.e. VALUEOF(NQ_SESSION.CURRENT_MONTH), that I've used in a column formula to filter the data, but there doesnt seem to be one for last month, so how do I get around this? I'm creating a report for Sales Pipleline and trying to show the TCV for this month and last month in order to compare the two. Some assistance please?

    Hi Alex,
    Thanks for the reply. So Can you just confirm, are you saying that within analytics there is no way for me to get the TCV value of an opportunity as of last month or last week? I put together a report to try and show the TCV value from last week and I used a filter with the column formula for my TCV value, my formula was; FILTER("Historical Sales Stage".Revenue USING (Opportunity."Close Date" >=  VALUEOF("LAST_WEEK_BEGIN_DT"))), but from what you are saying I dont think this can work and I havent really had time to test it out properly. I then had another TCV column with a filter of; FILTER("Historical Sales Stage".Revenue USING (Opportunity."Close Date" >=  VALUEOF("CURRENT_WEEK_BEGIN_DT"))). At the moment I'm getting the same value which could be because I havent changed any data or like you say you can only report on current values. What do you think?
    Regards

  • Is it possible to post the Excise invoice previous month date.

    Dear All,
    We want to post a excise invoice with previous month date. Is that possible?
    We have created a billing document (VF01) last month (October) and not created Excise Invoice (J1IIN).
    Now our finance people requirement is to create the excise invoice with last month date.
    Kindly let me know whether it is possible.
    Regards,
    Mullairaja

    Yes quite possible provided your FI period is still open.  Once you execute J1IIN and clicked the tab "Billing", you can see a field Posting Date where you maintain the billing document date itself if FI period is open.
    But from excise point of view, this is wrong due to the fact that excise returns should be submitted on or before 3rd of every month in which case, the excise team would have submitted the returns for October.
    thanks
    G. Lakshmipathi

  • Modelling "Last Month" figures in a Calculation View

    I am trying to create a Calc View to provide data for a report which for every slice of data should show some "this month" and "last month" data. My approach so far is to have a (graphical) Calc View which does Union of "this month" data (referred further as M) with basically the same data set (let's call it M1) where I only replace calendar month with another "calmonth1" column (I'm on SPS02 which doesn't have addmonth function yet, so had to make a Join with a month lookup table here).
    That approach works mostly fine -- I get the data for this and last month, and performance is reasonable. Except when I specifically filter the testing SQL query by Calendar Month: then the runtime jumps from 0.5 sec to 9 seconds!
    I have been able to narrow the issue down to the Union statement, where my two data sets have different fields (M.calmonth and M1.calmonth1) united in the resulting field U.calmonth. So, I guess, when I apply the filter to the field U.calmonth (effectively), the system cannot derive the corresponding values of M1.calmonth1 to cascade the filter down to dataset M, and tries to extract everything into M1, then does the Union with M, then selects what's right.
    The same thing actually happens with a Projection, which indicates the issue is not in Uniting results from two data sets but exactly with deriving "reversed selections".
    I went through HANA manuals, and the only related hint there was to have a JOIN ALL on key fields instead of a Union. I'm keeping it as a last resort, as I want to avoid scripting due to high maintenance effort.
    I would be grateful to hear about alternative designs. Thanks!

    Roman,
    You can push down your current month and last month logic into Analytical view.
    In Time Attribute view, create two claculated measure for calender month. You can build this using "NOW" function, left functions. Once you have current month create last month leveraging current month and casting (current month -1)
    Once you have these two calculated attribute ready in your Time attribute view. Bring it to Analytical view and using "if then" function you can calculate measures for Current Month and Last Month.
    This will improve performance as it avoids jumps between various engine.
    Thanks

  • Rolling 13 months data dynamically

    Hi All ,
    I got the 'Cal year/Month' filed  and it is showing as 04.2010.
    How to make the block to get rolling 13 months data and how to make the block dynamic.
    Could any one please help me on this and how to convert the data 04.2010 to April 2010.
    Many Thanks in advance

    In the first column of the block get the current month data and then add second column for last month data by creating an report level object with the following formula.
    =If(MonthNumberOfYear(CurrentDate()) =1;ToDate("12/01/"+ FormatNumber(Year(CurrentDate())-1;"####"); "MM/dd/yyyy" ); ToDate(FormatNumber(MonthNumberOfYear(CurrentDate())-1;"##")"/01/"FormatNumber(Year(CurrentDate());"####");"MM/dd/yyyy") )
    Similarly, add another column for 'last month - 1' data by creating an report level object with following formula.
    = If(MonthNumberOfYear(CurrentDate()) =2;ToDate("12/01/"+ FormatNumber(Year(CurrentDate())-1;"####"); "MM/dd/yyyy"); If(MonthNumberOfYear(CurrentDate()) =1;ToDate("11/01/"+ FormatNumber(Year(CurrentDate())-1;"####"); "MM/dd/yyyy" ); ToDate(FormatNumber(MonthNumberOfYear(CurrentDate())-2;"##")"/01/"FormatNumber(Year(CurrentDate());"####");"MM/dd/yyyy") ) )
    Similarly, add another column for 'last month - 2' data by creating an report level object with following formula.
    = If(MonthNumberOfYear(CurrentDate()) =3;ToDate("12/01/"+ FormatNumber(Year(CurrentDate())-1;"####"); "MM/dd/yyyy"); If(MonthNumberOfYear(CurrentDate()) =2;ToDate("11/01/"+ FormatNumber(Year(CurrentDate())-1;"####"); "MM/dd/yyyy"); If(MonthNumberOfYear(CurrentDate()) =1;ToDate("10/01/"+ FormatNumber(Year(CurrentDate())-1;"####"); "MM/dd/yyyy" ); ToDate(FormatNumber(MonthNumberOfYear(CurrentDate())-3;"##")"/01/"FormatNumber(Year(CurrentDate());"####");"MM/dd/yyyy") ) ) )
    In a similar fashion continue this logic for last month -10. This will give you the block of rolling 13 months data.
    In the case of date function. If your date is a DATE data type then use FormatDate() or if its a STRING data type then use SubStr.
    Thanks,
    Praneeth

  • Hi loading last 2 months data using abap routine

    we are planning to write a routine in infopackage level,
    using the option 6-ABAP routine, to select the last 2 month data ,
    we have the time characteristics 0CALMONTH, At present we managing the load by manually changing the selection for last 2 month every time ,
    It would be a great help if anybody can show a sample code to select last 2 month data,
    Thanks,

    Hi,
    data: l_idx like sy-tabix.
    DATA: lv_calmonth LIKE /BI0/SCALMONTH-CALMONTH.
    DATA: lv_day TYPE DATS.
    "previous month
    lv_day = SY-DATUM.
    lv_day+6(2) = '01'.
    lv_day = lv_day - 1.
    lv_calmonth = lv_day(6).
    READ TABLE l_t_range with key fieldname = 'CALMONTH'.
    l_idx = sy-tabix.
    MOVE lv_calmonth TO l_t_range-low.
    MODIFY l_t_range INDEX l_idx.
    "previous month - 1
    lv_day+6(2) = '01'.
    lv_day = lv_day - 1.
    lv_calmonth = lv_day(6).
    MOVE lv_calmonth TO l_t_range-low.
    APPEND l_t_range.
    p_subrc = 0.
    let me know if this works.... not sure about the last append.
    Olivier.

  • SSRS expression for today,yesterday,Lastweek ,Last fortnight,Last Month, Year to date

    Hi All;
    I have a field called createdon 
    Using this field i need to create the SSRS expression for the table as below 
    Any help much appreciated
    Thanks
    Pradnya07

    use expressions as below
    assuming this is to be done in SSRS
    Today
    =COUNT(IIF(
    DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now()),Fields!YourRequiredField.Value,Nothing))
    Yesterday
    =COUNT(IIF(
    DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
    LastWeek
    =COUNT(IIF(
    DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
    Last fortnight
    =COUNT(IIF(
    (DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-1)
    Or (DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-2),Fields!YourRequiredField.Value,Nothing))
    Last Month
    =COUNT(IIF(DateDiff(DateInterval.Month,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Month,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
    Year To Date
    =COUNT(IIF(DateDiff(DateInterval.Year,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Year,Cdate("01/01/1900"),Now())
    And
    DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) <= DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now()),Fields!YourRequiredField.Value,Nothing))
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Maybe you are looking for

  • Problem with backspace on JFrame

    Hello, I have a problem on a JFrame. Indeed, I add a keyListener to the frame, but the "Bakcspace" don't work. There is anything when a I press on Backspace (with KeyTyped, KeyReleased and KeyPressed). All other keys are working. Thanks.

  • My iPhone 3GS is disabled

    I put my password in wrong too many times and my iPhone 3GS got disabled and I don't know how to fix it.

  • Mobile me doesn't accept my Apple ID

    At System Preferences I don't see  the ICloud icon, when I try to sign in to mobile me it doesnt accept my Apple ID. What should I do?

  • Duplicate global type definition/declaration

    I'm getting an error while compiling that says that one of my xml types is declared in more than 1 location and that the type is different in both locations. It is declared in the schema file on my hard drive, and then somewhere on my server. The pot

  • Emtec DVD-R on dr4-a

    Bought a bunch of emtec dvd-r's but they don't seem to work on my dr4-a. Firmware is already 2.30, anyone else who tried this, TDK (also listed in the faq) works great, so does sony.