Function Module - Calculate 5 weeks lookup based on -7 increments from the Key Date

Hi Guys,
I am looking to create a variable on Fiscal Period/Year, that automatically populates the variable with the previous 5 weeks based on -7 increments from the key date , when the user runs the query .
For Example: If key date is 03/11/2014 need to get previous 5 weeks 03/04/2014, 02/25/2014, 02/18/2014, 02/11/2014, 02/04/2014. mm/dd/yyyy.
Is there any Function Module available/ please provide the logic code - can anyone help?
Thanks,
Suresh Narayan

Hi suresh,
Please once try with this approach,
Create a variable with variable represents :  multiple input value, Processing type : customer exit ; variable is ready for input.
and write the below code :
if i_step = 1.
data : fdate type d ,
        wa1 like line of e_t_range,
       n1 type i.
n1 = 1.
if n1 <= 5.
wa1-opt = 'EQ'.
wa1-sign = 'I'.
wa1-low = fdate.
append wa1 to e_t_range.
fdate = fdate - 7.
endif.
endif.
Hope you got it,

Similar Messages

  • Function Module for listing Equipments based on Material Number

    Hi,
       I need to display list of Equipments based on the given Material Number.
       This can be done by simple query statement as given below,
              SELECT equnr matnr sernr FROM equi
              INTO CORRESPONDING FIELDS OF TABLE <Int Table>
              WHERE matnr IN im_matnr.
        But, I need Function module to acheive this. Can anyone suggest me the Standard Function module which works as mentioned above?

    Hi Shirlatha,
    If you need to  only above code  value  then you can create own FM  and pass the MATNR only.
    In SAP BAPI_EQMT_DETAIL  one FM is there to get complete Equipment details but need to pass matnr and Equipment  number.
    Please try to use this FM or you can create Own FM.
    Regards,
    Prasenjit

  • Calculate week no based on financial year

    Hi
    Financial year starts with 01-Apr . I need to calculate week no based on 01-APR(financial year) not 01-Jan
    for each date. Is there a way to calculate based on this

    It works for all year long :-)
    SQL> ed
    Wrote file afiedt.buf
      1  with testdata as (
      2     select date '2011-04-01' + 7 * (level-1) dt from dual
      3     connect by level <= 60
      4  )
      5  --
      6  -- End of test data
      7  --
      8  select
      9  to_char(dt,'YYYY-MM-DD') the_date,
    10  to_char(add_months(dt,-3),'WW') fiscal_week,
    11  to_char(add_months(dt,-3),'IW') iso_fiscal_week
    12  from testdata
    13* order by dt
    SQL> /
    THE_DATE   FI IS
    2011-04-01 01 52
    2011-04-08 02 01
    2011-04-15 03 02
    2011-04-22 04 03
    2011-04-29 05 04
    2011-05-06 06 05
    2011-05-13 07 06
    2011-05-20 08 07
    2011-05-27 09 08
    2011-06-03 09 09
    2011-06-10 10 10
    2011-06-17 11 11
    2011-06-24 12 12
    2011-07-01 13 13
    2011-07-08 14 14
    2011-07-15 15 15
    2011-07-22 16 16
    2011-07-29 17 17
    2011-08-05 18 18
    2011-08-12 19 19
    2011-08-19 20 20
    2011-08-26 21 21
    2011-09-02 22 22
    2011-09-09 23 23
    2011-09-16 24 24
    2011-09-23 25 25
    2011-09-30 26 26
    2011-10-07 27 27
    2011-10-14 28 28
    2011-10-21 29 29
    2011-10-28 30 30
    2011-11-04 31 31
    2011-11-11 32 32
    2011-11-18 33 33
    2011-11-25 34 34
    2011-12-02 35 35
    2011-12-09 36 36
    2011-12-16 37 37
    2011-12-23 38 38
    2011-12-30 39 39
    2012-01-06 40 40
    2012-01-13 41 41
    2012-01-20 42 42
    2012-01-27 43 43
    2012-02-03 44 44
    2012-02-10 45 45
    2012-02-17 46 46
    2012-02-24 47 47
    2012-03-02 48 48
    2012-03-09 49 49
    2012-03-16 50 50
    2012-03-23 51 51
    2012-03-30 52 52
    2012-04-06 01 01
    2012-04-13 02 02
    2012-04-20 03 03
    2012-04-27 04 04
    2012-05-04 05 05
    2012-05-11 06 06
    2012-05-18 07 07
    60 rows selected.ISO Week (IW) works with a different way of defining week 01. Using IW April 1st will become week 52. You will have to decide if that is correct according to your finance department :-)

  • HT1657 If I download a movie today, but will not be watching it for a few weeks (i.e. when overseas) - when does the 'activation' period start?  Do I have 48 hours from the download date or when I first watch the movie?

    If I download a movie today, but will not be watching it for a few weeks (i.e. when overseas) - when does the 'activation' period start?  Do I have 48 hours from the download date or when I first watch the movie?

    You have 30 days from when you download it, but when you then start watching it you have 48 hours (24 if your account is US based) to finish watching it before it expires.

  • Hi! If I buy an ipod touch 5g from the US and I travel to another country, for example Philippines, will it function in that country without having to modify anything from the device?

    Hi! If I buy an ipod touch 5g from the US and I travel to another country, for example Philippines, will it function in that country without having to modify anything from the device?

    Thanks Varjak Paw

  • I have acrobat professional and photoshop elements. New Mac arrives next week how do I move these from the old machine  as I cannot find the product codes

    I have acrobat professional and photoshop elements. New Mac arrives next week how do I move these from the old machine  as I cannot find the product codes

    You cannot move or copy software between computers. You must reinstall. You will need the serial number. Check your account details on Adobe's site if you registered.

  • Download ios 7, and the location function is off, I can not access because I forgot the key constraints, I can not restore the iphone because I can not find iphone app access

    download ios 7, and the location function is off, I can not access because I forgot the key constraints, I can not restore the iphone because I can not find iphone app access

    If you have a passcode to the screen lock that you've forgotten, restore the device from the computer to which the device is synced. For information and instructions, see:
    http://support.apple.com/kb/ht1212
    If that will not work, you'll need to put the device into Recovery Mode and then try the Restore again:
    http://support.apple.com/kb/ht1808
    If that still doesn't work, as a last resort try DFU mode:
    http://www.iclarified.com/entry/index.php?enid=1034
    If your device is running iOS 7 and you set up Find My iPhone (iPad/iPod),  however, then it has the Activation Lock on it and you'll need to enter in your Apple ID and password to activate the device after restoring:
    http://support.apple.com/kb/HT5818
    Regards.
    Forum Tip: Since you're new here, you've probably not discovered the Search feature available on every Communities page, but next time, it might save you time (and everyone else from having to answer the same question multiple times) if you search a couple of ways for a topic, both in the relevant forums and in the Apple Knowledge Base, before you post a question.

  • Sums up the last 4 weeks from the start date

    Hi all,
    Pls tell me how to find the give issue with example
    How to write queri in SQL
    sums up the last 4 weeks from the start date selected (meaning range of date 1st to 7th) (the 4 weeks should stop on the 31st).
    Thanks & Regards

    <DIV><FONT size=2>
    <P><FONT size=2>select</FONT></FONT> tstdate, weeks, (sum*<FONT
    color=#0000f0>7</FONT>) as sum<BR>from <SPAN
    class=224524108-18042006>  </SPAN>(select to_date(<FONT
    color=#0000f0>'&date'</FONT>,<FONT color=#0000f0>'dd-mon-rrrr'</FONT>) as
    tstdate,<BR><SPAN
    class=224524108-18042006>                    
    </SPAN>last_day(to_date(<FONT color=#0000f0>'&date'</FONT>,<FONT
    color=#0000f0>'dd-mon-rrrr'</FONT>)) as weeks, <BR><SPAN
    class=224524108-18042006>                    
    </SPAN>floor((last_day(to_date(<FONT color=#0000f0>'&date'</FONT>,<FONT
    color=#0000f0>'dd-mon-rrrr'</FONT>)) - to_date(<FONT
    color=#0000f0>'&date'</FONT>,<FONT color=#0000f0>'dd-mon-rrrr'</FONT>))
    /<FONT color=#0000f0>7</FONT>) as sum <BR><SPAN
    class=224524108-18042006>          
    </SPAN>from dual)<FONT size=2></P></FONT></DIV>

  • Function Module - Calculate Previous Week

    Hi Guys,
    I am looking to create a variable on Fiscal Period/Year, that automatically populates the variable with the previous week (current week minus 1), when the user runs the query.
    I have heard there is a Function Module available - can anyone help?
    Thanks
    Scott
    Message was edited by:
            Scott Sweeney

    Hi,
    use the following code:
    DATA: l_curr_week LIKE SCAL-WEEK.
    DATA: l_prev_week LIKE SCAL-WEEK.
    DATA: l_day TYPE DATS.
    CALL FUNCTION 'DATE_GET_WEEK'
      EXPORTING
        date               = SY-DATUM
    IMPORTING
       WEEK               = l_curr_week.
    CALL FUNCTION 'WEEK_GET_FIRST_DAY'
      EXPORTING
        week               = l_curr_week
    IMPORTING
       DATE               = l_day.
    SUBTRACT 1 FROM l_day.
    CALL FUNCTION 'DATE_GET_WEEK'
      EXPORTING
        date               = l_day
    IMPORTING
       WEEK               = l_prev_week.
    hope this helps...
    Olivier.

  • Need a Function Module for Week Calculation

    Dear Experts,
      I want a function module which calculate the week number.
      Suppose for date 04.05.2010
      week is 19...........
       i want to fetch through function module.
    i have already tried function module like GET_WEEK_INFO_BASED_ON_DATE & DATE_GET_WEEK
      throgh both function module output is come out is 18.
      but i need 19.
      when i pass 02.01.2010
    then it giving 53 week of 2009.
    plz. help me as soon as possible.
    Thanks,

    Jan 2 2010 was indeed 53rd week of 2009, so SAP FMs are returning right value. I would strongly recommend to consult your functional consultant before assuming Jan1 2010 as week 1 of 2010.
    [quote from wikipedia|http://en.wikipedia.org/wiki/ISO_8601#Week_dates]
    'If 1 January is on a Monday, Tuesday, Wednesday or Thursday, it is in week 01. If 1 January is on a Friday, Saturday or Sunday, it is in week 52 or 53 of the previous year (there is no week 00). 28 December is always in the last week of its year.'
    Regards,
    Pawan.
    Edited by: Pawan Kesari on May 4, 2010 4:56 PM

  • Function module to get Conditions based on Customer & Material

    Hi,
    Is there any function module such that the list of conditions are displayed, based on Customer & Material given?
    Thnx in advance,
    Shivaa.....

    actualy Jan this report is based on GL account no..GL acount no.s dat we required are not there in bsid n bsad...we need bank related GL account no..IN BSID n BSAD all GL account no. are customer GL account no.s...

  • Function module to get customers based on document no

    Hi experts,
    I am fetching data based on GL acount no from bsis and bsas..Now based on all document numbers i need customer no. foreach document..Is there any function module that i can use to get these customer numbers..
    Regards,
    Raman

    actualy Jan this report is based on GL account no..GL acount no.s dat we required are not there in bsid n bsad...we need bank related GL account no..IN BSID n BSAD all GL account no. are customer GL account no.s...

  • Function module for Weekly off

    Hello All,
    Is there a Function module to get check whether the inputted date is a weekly off in a particular location ?
    Regards
    Vijay

    Are you talking about the HCM (HR) module?
    Please be clear about your question and I hope you are posting in the right forum!
    Rgds,
    Zub

  • Class or Function Module to display PERNR based on OBJECTID

    Hello All,
    I have a requirement where i need to find out the Personnel Number based on the ObjectID provided in the HRP5102 infotype table.
    I have tried with the CLASS   CL_HRRCF_CANDIDATE and method used is GET. But the PERNR Number gettng after the execution of method is not avaialble in the database.
    Could anybody help me out in finding the relationship.Any FM or Class provided is helpful.....
    Thanks

    Hi Sravan,
    You can get data from a cube,with mere database 'SELECT' statements. please find the following suggestions,
    All Cube related data, you can find in the tables with the naming convention ' /BIC/F*CUBENAME'. Typical nomenclature of the database table is '/BIC/F' followed by name of the cube. if your cube name is 'ZALMPOS' then the corresponding name of the fact table will be /BIC/FZALMPOS.
    The data is stored in this table with all keys of DIMENSION tables. If you have to map the keys to dimension tables to get the values of the characteristics. Typical, nomenclature of Dimension tables is '/BIC/D*Characteristicname'.
    Note: Check in RSA1 if all your characteristics are mapped as dimensions in your cube.
    Thanks,
    Santosh KB.

  • Function modules to read Time clusters B1 and B2 from PCL1 and PCL2

    Hi All
    Are there any function modules or macros to read time clusters B1 & B2?
    I want to read time data in the clusters for reporting purpose.
    Regards,
    Rupesh Mhatre

    You can also call the FM HR_TIME_RESULTS_GET and get the exact cluster you need from B2 like WPBP, ZE, SALDO etc.
    Otherwise if you want to use the older FM declare the GET_TBUFF and GET_BUFFER_DIR as of below structure.
    DATA: BEGIN OF TBUFF OCCURS 5000.                           "XPMK014785
            INCLUDE STRUCTURE PCL1.
            DATA: SGART(2),
          END OF TBUFF.
    DATA: BEGIN OF BUFFER_DIR OCCURS 2000,                      "XPMK014785
            SGART(2),
            CLIENT LIKE PCL1-CLIENT,
            RELID LIKE PCL1-RELID,
            SRTFD LIKE PCL1-SRTFD,
            NTABX LIKE SY-TABIX, "pointer auf aktuellen satz
            OTABX LIKE SY-TABIX, "pointer auf alten satz (falls vorhanden)
            NNUXT LIKE PCL1-SRTF2, "anzahl folgesaetze aktueller Satz
            ONUXT LIKE PCL1-SRTF2, "anzahl folgesaetze alter Satz
          ofset(3) type p,     "offset innerhalb eines entry
          END OF BUFFER_DIR.
    INT_TIME_RESULTS should be of type PTM_TIME_RESULTS.
    Regards
    Ranganath

Maybe you are looking for

  • When I send a message from my iPhone to other iPhone users why do they receive it from my email not number

    Why when I send an iMessage from my iphone to another iPhone does it come from my email not my number ?

  • Images not appearing in finished .CHM

    Hi: Recently upgraded from RH5 to RH7. A little background: Our project in RH5 had an inexplicable case of the .chm file size DOUBLING after a minor accident in mistakenly editing some HTML in the "Truecode" page. That's over; not the issue here. A n

  • Why does Aperture 3,not process RAW files from Leica D-Lux 5 ?

             Hello: The purchase of my Leica D-Lux 5 came with LR 3. All raw files can be processed in that Application.However.I also have Aperture 3 and it will not process RAW files from the D-Lux 5.I hope that Apple soon will address this inconvenien

  • Different Sizes with same file.

    Hi All, I have made 2 post script files from 1 indesign file, but the trap setting I have used to make for both Post Script file was: 1. Application In-Rip 2. Adobe In-Rip My questions are : 1. Is there any diffrence between these settings? 2. Why th

  • Counter problem PCI 6229

    i am using TWO PCI 6229 cards (2*2 counters, DMA Channels), OS-winXP, LabVIEW 2009 SP1. now using 3 counters (1. edge counter, 2 and 3 for semiperiod measurements). i can run the edge counter alone without problem. but i cant run all the 3 counters i