Previous week value

Hi,
how to get pervious week values or data or
how to get pervious month values or data in abap source code.
Archana.

I dont know what values ur trying to get but try useing these FM's
HAZMAT_GET_PREVIOUS_DAY
HR_PT_GET_MONTHS
HR_BR_GET_RETRO_MONTH_DIFF
These are related to HR
Rewards if Helpful
Viky

Similar Messages

  • Report Issue: Previous Weeks, Current Week and Next Week Values

    Hello Folks,
    this is a typical requirement...at-least typical for me..
    we have 20 weeks of data at weekly level. we have four Metrics out of which two are coming from Database and rest two are calculated metrics.
    Metric0: On Hand Qty
    Metric1: Past Qty
    Metric2: sell Qty
    Metric3: unsell qty
    Metric4: Total Qty
    the report will always be shown for 20 weeks, but depending on whats my current week, all the past weeks should be flagged as Past Week. (so i wrote a case statement for this). for Instance: I am in Week11, so my weeks in should be Past Week, Wk11, Wk12.........Wk20.
    Metric 1 is always dependent on result of Metric4 (This is the Complexity) per week basis
    Metric1 for Past weeks value in Week Column will be wk1 to wk10 On Hand Qty (fox ex: 80)
    Metric4 for Pass Weeks Value in Week Column will be Metric1 for Pastweeks + Metric2 for Past Weeks (For Ex: 20) (Past weeks mean wk1 to wk10)
    value of Metric4 is now 100
    Metric1 for Week11 Now should 100 (From Past weeks Calculation)
    Metric4 for Week11 will be Metric1 for Week11(100) + Metric2 for Week11(10) + Metric3 for Week11 (10)
    Now...Metric1 for Week12 will be 120 which is wk11 total (100+10+10) and goes on Until Week 20
    Any Ideas how to achieve this in obiee 10g
    Thanks
    Rake

    Please try out in this way....
    Database level --Create opaque view & procedure or function  to get the week total,week ago total, current week , Past week ,future week & do rpd modelling and use PIVOT VIEW.
    At answers:
    1.Here Previous week M4 is the current week M1 which means it is a cumulative value carried forward week by week.
    2. M2 & M3 are direct database columns.
    3. You have time hierarchy with WEEK Level.
    M1 - ago(rsum(m2+m3),weeklevel)
    M4- RSUM(M2+M3)
    week -AGO(RSUM(M2+M3)- M2-M3-RSUM(M2+M3)
    w1-0-10-20-30
    w2-30-11-21-62
    w3-62-12-22-96
    Now you can PIVOT IT to get in
    W1-W2-W3
    M1 0 - 30-62
    M2 10-11-12
    M3 20 -21-22
    M4 30 - 62-96
    NOW PASTWEEK (W1-W10), CURRENT WEEK(W11)-W12
    1.as you see cumulative here you need to use BINS.means ( case when week <= currentweek(maybe variable) then prior) else week)
    2. UNION - combine similar request - First cirteria week <= w11 and second criteria week > week 11 --combine pivot it. Use sum agg in fx criteria1.
    Hope this should solve your pblm at answers.
    Edited by: MK on Oct 27, 2011 12:48 PM

  • Selection variable with default value as previous weeks mon through sun

    Hi Experts,
    1.)
    I need to create a Selection Variable ZTRANS_DT ( type Interval ), with the default value as  "Previous week, Monday Through Sunday" .
    Should we have to write a customer exit to populate these interval values dynamically every time the user runs the report ?
    If so can you please write a sample ABAP code.
    2.)
    The filter restriction for the date feild ZBUSINSDT has to be set to ">=#1/1/CURRENT YEAR#" ..
    How to set current year dynamically.
    Help done would be appreciated and would be assigned points.
    Thanks,
    Santosh..

    Hello,
    I dont remember of any standard variable but still you can wait to see if any1 comes up with one.
    Or else you can try the foll:
    Create the variable as per your requirement.
    Then in CMOD, write a simple code for i_step = 1.
    logic can be l_t_range-low = sy-datum - 1.
    Regards,
    Shashank

  • How to get data for current week and previous week using customer exit in Bex.

    Hi everyone,
    I have a scenario in which I need to display data for current week and previous week (based on "sy_datum" the program has to calculate current week and previous week) in Bex using  Customer exit. I have created one variable in Bex Query Designer and I have written code for the variable in CMOD. But it is not working fine, (I know that we can do the same by using offset value in Bex). Can some one guide me how to achieve my requirement using customer exit.
    Thanks in Advance,
    G S Ramanjaneyulu.

    Hi krishna,
    Thanks for your quick reply, can you have a look at my code,
    case i_vnam.
    WHEN 'ZPWK_CWK'.
    ranges : pre_week for sy-datum.
    data : start_date type DATS,
           end_date TYPE dats .
    ************FM TO GET FIRST DATE OF CURRENT WEEK ************************
    CALL FUNCTION 'BWSO_DATE_GET_FIRST_WEEKDAY'
      EXPORTING
        DATE_IN  = sy-datum
      IMPORTING
        DATE_OUT = start_date.   " WEEK FIRST DATE
    end_date = START_DATE + 6.   " WEEK LAST DATE
    END_DATE   = START_DATE - 1.   " PREVIOUS WEEK END DATE
    START_DATE = START_DATE - 7.   " PREVIOUS WEEK START  DATE
    **********PREVIOUS WEEK DATES IN PRE_WEEK******************
    pre_week-SIGN   = 'I'.
    pre_week-option = 'BT'.
    pre_week-LOW    = START_DATE.
    pre_week-HIGH   = END_DATE.
    APPEND  pre_week.
    CLEAR : START_DATE,END_DATE.
    endcase.
    Regards,
    G S Ramanjaneyulu.

  • Previous week Dates

    Hi all
    Please help in writing a query to get the previous week data.
    If the input date is sysdate then it should return values for previous week Monday to Sunday.
    Whatever the input it should get the value for previous week from Monday to Sunday.
    Thanks
    Jo

    IW is the formatter for the "Iso-Week"
    ISO = international standard organization
    See also: http://en.wikipedia.org/wiki/ISO_week
    Main thing is that it will always start with monday. The weeknumber might be different then for ww format. This doesn't matter in your case. But you migh want to do some experiments with to_char(sysdate,'IW'), to_char(sysdate,'WW').
    Trunc(<datevale>,'IW') will cut the date back to the first day of this iso-week.
    select to_char(sysdate-365,'IW') IW , to_char(sysdate-365,'WW') WW from dual;
    IW     WW
    37     36Edited by: Sven W. on Sep 9, 2010 2:29 PM

  • Run the query with previous weeks date automatically

    Hi Guyz,
    I need to  dynamically populate the previous weeks  date value every week,
    i.e Run the query every Monday automatically, with previous weeks date value .
    Is there any SAP Exit which I can use ??
    Regards,
    Ravi
    Edited by: Ravi Srinivas on Aug 4, 2009 1:40 PM
    Edited by: Ravi Srinivas on Aug 4, 2009 1:52 PM

    Ravi,
    If you are thinking of re-running the previous week's queries automatically in the front-end, then U. Tummers is correct.  You can create new columns alongside your existing query if you so wish and use your restrictions with an offset sepending on how far back you'd like to go.
    Best,
    Philips

  • InfoView - Query Filter for date variable of previous week

    I am trying to automate the process to generate a report for the previous week's data.  Right now I just prompt the user to enter in the start & end date/times, but I would like to somehow automate the date filtering using a Query Filter.
    In particular, the report will be generated every Thursday at 12:35 PM, and it needs to filter only the date field between the date's of the previous Thursday @ 1:31 PM, and the current Thursday @ 12:30 PM.
    I know there is a way to do this using an offset or something like that, but I'm a bit of a newbie to InfoView....so any help is greatly appreciated.  Sorry if the explanation is confusing.
    Thanks so much,
    Nick

    Hi,
    You can create two objects on universe level or first database level then add in the universe based the sysdate.
    Then go to  webi  query and  replace the prompt value by these objects and from next time when ever user refresh this report will run  without any prompt.Same thing in the scheduled report.
    Thanks,
    Amit

  • 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

  • Urgent : Bill Qty based on Fisrt day of Previous week to current week

    Hi,
    I have to create a Restricted Key figure.
    Bill Qty is to be restricted on a day, which is first day of previous week.
    (1) I have restricted KF, with Current Week SAP exit variable.
    (2) Restricted KF, with Calendar Day (Variable ZDATE, customer exit type).
    (3) I have written Customer Exit in CMOD...
    data: LT_RANGE  type  RSR_S_RANGESID,
          LS_VAR_RANGE like RRRANGEEXIT.
    case i_vnam.
    when 'ZDATE'.
    if i_step = 2.
    break-point.
    loop at i_t_var_range into ls_var_range where vnam = '0CWEEK'.
    data: var1(2) type c,
          var2(4) type c,
          var3 LIKE SCAL-WEEK,
          date1 like scal-date,
          DATE2(10) TYPE C,
          MNTH(2) TYPE C,
          DAY(2) TYPE C,
          YEAR(4) TYPE C.
    var1 = ls_var_range-low(2).
    var2 = ls_var_range-low(4).
    concatenate var2 var1 into var3.
    CALL FUNCTION 'WEEK_GET_FIRST_DAY'
      EXPORTING
        WEEK               = var3
    IMPORTING
       DATE               = date1
    EXCEPTIONS
      WEEK_INVALID       = 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.
    MNTH = DATE1+4(2).
    DAY = DATE1+6(2).
    YEAR = DATE1+0(4).
    CONCATENATE DAY '/' MNTH '/' YEAR INTO DATE2.
    lt_range-low = date2.
    lt_range-high = date2.
    lt_range-sign = 'I'.
    lt_range-opt = 'eq'.
    append lt_range to e_t_range.
    endloop.
    endif.
    <b>BUT I AM GETTING ERROR -</b>
    00010004              AError for variable in customer enhancement ZDATE
    Please suggest any idea..
    Thanks
    saurabh

    Hi Saurabh,
    Please try this dample code
    WHEN 'ZDATE'.
    DATA: Z_WEEK TYPE SCAL-WEEK.
    *Determine current week from SY-DATUM
            CALL FUNCTION 'DATE_GET_WEEK'
              EXPORTING
                DATE               = SY-DATUM
              IMPORTING
                WEEK               = Z_WEEK.
    *Determine first day of current week 
            CALL FUNCTION 'WEEK_GET_FIRST_DAY'
              EXPORTING
                WEEK = Z_WEEK
              IMPORTING
                DATE = LT_RANGE-LOW.
    LT_RANGE-SIGN = 'I'.
    LT_RANGE-OPT = 'eq'.
    APPEND LT_RANGE TO E_T_RANGE.
    Regards
    Joe

  • 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

  • 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!)

  • To get time-booking entered thru CATW,CAT2 for the previous week

    Hi Experts,
    I need to analyze the absences booked by an emolyee. I have obtained the time-booking for the present week from the user-exit where I am writing the code. But I have to check the booking of the previous friday (previous week) to check if the same absence is taken on Monday (current week). Thus I have to check the booking made by the employee on friday previous week. How can I get the time booking data for the previous week?
    Do we have any Fm to get that?
    Thanks
    Akash

    BAPI_ABSENCE_GETDETAIL         Read absence
    BAPI_ABSENCE_GETDETAILEDLIST   Read instances with data
    BAPI_ABSENCE_GETLIST           Read instances
    But you need for CATSDb ie for CATS
    use standard trans code cats_da ie rcats_report_activities
    also we have bapis
    BAPI_CATIMESHEETMGR_CHANGE     CATS: Change data records
    BAPI_CATIMESHEETMGR_DELETE     CATS: Delete Data Records
    BAPI_CATIMESHEETMGR_INSERT     CATS: Insert data records

  • Previously selected value of a prompt pertaining

    Hi All,
    Had a issue with the dashboard.
    There are two prompts p1 & p2. p2's value are updated based on p1's value.
    Issue being face is that when p2's go button is clicked and next time p1's value is changed and clicked go,the previously selected p2's value is still pertaining. How can i get rid of the previously selected value.
    Thanks.

    Hi svee,
    Thanks for the reply.
    I need the two go buttons,since the two prompts are in different sections and p2 is driven by the presentation variable of p1.
    Also in p2 user can change the value to check for the results.
    Thanks

  • Net price defaulting back to previous PO value

    Hi expert!
    I have a problem when creating PO. the net price will be defaulted to previous PO value but this on for specific company code 4000. if other than 4000, it will not be defaulted. I've checked in SPRO>MM>Purchasing>Environment data>Define default values for buyers. Then choose setting for default values>choose the default values>under price adoption i tick do not copy. But it only applied to other than purch org 4000 n company code 4000.why??
    thanks.

    i got the answer now. Configuration are all correct. But they're using parameter which assign to user id in order to rectify this user is able to do what and what. So i delete all the parameters save and log out. Log in and assign back all the parameters,save and log out. then assign back and when i try,it is working fine now.
    Anyway, thanks guys for your valuable opinions!

  • Previous weeks data

    Hi all,
    I have a requirement where I need to show the Unbilled amount of this week as well as last 20 weeks based on region. Let say I am on fiscal week 20. Now if create a report based on region and Unbilled amount I will get $ 20 for europe. Now if after one week i.e FW 21 , I run the same report I get & 25 for Europe. Again let say after one more week i.e FW 22 I get $ 27 for Europe.
    Now user if run a report on FW 22. he wants areport like
    Week   Region  Unbilled
    FW20   Europe  $20
    FW21   Europe  $25
    FW22 Europe    $27
    i.e history data is required . As data is changing every day , user wants to see previous 20 weeks data.
    Now I am using a Zcube built on standard extarctor 0FI_GL_4. i dont have loading date or system date.
    Please suggest what to do
    Regards,
    Sunny

    Hi.
    If your object fiscal week restricted by variable you should do the next:
    1. create 20 calculated KF each one restricted with this variable with appropriate offset (lets say previous week wth vriable and offset -1, 2 weeks ago with variable and offset -2 ...)
    2. create another calculated KF with variable without offset to represent user selection week.
    So at the end you will see one KF with current week and 20 another KF with 20 previous weeks.
    Regards.

Maybe you are looking for

  • How do I delete songs with iOS 4.2.1 on an iPad. No other Mac or PC availably?

    I own an iPad with version 4.2.1 on it and do not have an other PC or Mac to connect to. I can not delete songs or update my iOS version on my iPad. Any ideas . . . O_ o ?

  • Publishing a form in Aplication Server 10g

    Hello everyone... I'm new in Dev10g and all my experience has become from client-server technology. Saying that, anyone can explain to me how to publish a form in Aplication Server 10g and access it from any client? Thanx 4 all your help.

  • How to create user editable Crystal Report with dynamic dataset

    What I would like to achieve: A program loads a report in runtime updates list of database fields (possibly includes sample data), open report in "Crystal Reports 2011" (or 2008) where user customizes report and saves it. Later on the program loads t

  • Crystal Reports Logon Error ("Security Plugin Error")

    Hi there, I have an issue that I haven't been able to resolve for the past couple days.  I had to reinstall Crystal Reports XI on a user's computer, and now we can't log into the BusinessObjects Enterprise server from it using LDAP.  I have successfu

  • Business area updation

    we have made a zprogram for updating business area field in bsis & bseg table for particular g/l but it is not getting updated in balance sheet if we see the balance sheet business area wise & the g/l are p/l items