MONTH AND YEAR FORMAT

Hi All.
We are developing a 'Monthly Sales Tax(payable) Report.
they want the report based on the date(in the selection screen it will come only month and year only.).Depends on that month and year for that select-options ,it will pick up the record.
like if, jan 2005 to march 2006.
then it will pick up from 01.01 .20005 to 31.03.2006 records.
Can any body help me to resolve this.
Thanks in advance,
Regards,
Venkat

Hi,
the simplest way to achieve this is
1) start date
  --take month , take year  , 01 concatenate.
that is
lv_char8      type char6.
lv_start_date type dats.
concatenate '01' month year into lv_char8.
lv_start_date = lv_char8.
2) End date
lv_char8      type char6.
lv_end_date type dats.
if  month = '12'.
concatenate '31' month year into lv_char8.
lv_end_date = lv_char8.
else.
month = month + 1.
concatenate '01' month year into lv_char8.
lv_end_date = lv_char8.
lv_end_date = lv_end_date - 1.
endif.
note :- leat the month and year be of type I.
when u concatenate u should assign integer value to charecter and then concatenate
Dont need to worry dats are caculated intenally.
If u want i can give u the working code for it.
if yes mail me :- [email protected]
Mark Helfull answers.
Regards

Similar Messages

  • Calculate different month and year

    Dear experts,
    Hereby, i have 2 questions:
    1)Are any data type for month and year format (YYYYMM)? Generally, we have the data type for date which is 'D', but it is in YYYYMMDD format. Currently, i define the data type as length 6 type c.
    2) Does SAP function module have functions to calculate the different month? For example: 11.2009 - 01.2010 = 2
    Because currently, i define the type as length 6 type c, thus, the calculation for this difference are quite tedious. Or does anyone have any sample for this type of function?
    Thanks in advance.

    Hi, Starry
    Please Search in SCN or Google, Date Related Question are not allowed. Check the bellow Thread for more info.
    How to post code in SCN, and some things NOT to do...
    Regards,
    Fasial

  • Need to combine month and year to get date YYYY-MM-DD format

    Month and year are table fields and they will have values like
    Month in format = mm  example 01
    year in format = YYYY example 2010
    Now i need to concatenate month and year to derive date .
    Expected result Result :2010-01-01
    Example :Month =01
    Year =2010
    Mudassar

    The principle of any tiered architecture is that display formatting is done in a presentation layer. This is not just SQL and Client/Server programming; it is the foundation of all modern programming. Not knowing this is like a doctor who does not know
    about germs or a chemist who does not know about atoms. 
    This is reviewed in the first 1-2 weeks of any database class. Why are you violating it?? 
    Next, you do not even know that column are not fields! 
    T-SQL now has a DATE data type, which defaults to the ISO-8601 display format (yyyy-mm-dd). Are you using it? If you had been polite we would see your DDL and know. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Is there a way to change the date format so that delegates have to choose a day, month and year from a drop down menu as my delegates keep forgetting to change the year of their information

    When my delegates are filling in a event form i have put together, a large number of them forget to change either the month or year on the date field. Is there a way to have a date field that has drop down boxes for day, month and year so they have to choose rather than a date been already on the screen??
    Thanks

    Hi Christopher,
    The WEEKDAY function allows specifying either Sunday or Monday as the first day of the week:
    WEEKDAY
    The WEEKDAY function returns a number that is the day of the week for a given date. WEEKDAY(date, first-day)
      date:  The date the function should use. date is a date/time value. The time portion is ignored by this function.
      first-day: An optional value that specifies how days are numbered.
    Sunday is 1 (1 or omitted):  Sunday is the first day (day 1) of the week and Saturday is day 7.
    Monday is 1 (2):  Monday is the first day (day 1) of the week and Sunday is day 7. Monday is 0 (3):  Monday is the first day (day 0) of the week and Sunday is day 6.
    But I think you are referring to the first day of the 'workweek', for which I do not see a means of defining a custom value.
    Since you want to 'insert categories', though, you could easily define your own, using WEEKDAY(date) or WEEKDAY(date,1), plus an IF statement to return the category label appropriate to the day. Here's one for a Sunday to Thursday work week. Dates are in column A, the formula is in whichever column you want as the Category column. For the example, I've placed it in column B.
    B2, and filled down: =IF(WEEKDAY(A)<6,"Work","Off")
    The top table shows the weekday numbers returned for each day of the week for each of the three permitted values for the optional second argument. The bottom table shows the results from the formula above, used to define a category label for each date:
    A10 was left blank intentionally, to determine if the lack of data resulted in an error. The Warning message, flagged by the blue 'warning' triangle, is "The formula uses a number in place of a date." The 'date' assigned to this numerical value of zero was a Friday, but I'm not certain when. Probably best to avoid extra rows with no date shown.
    Regards,
    Barry

  • Needing a multi-month and year-in-view option for ical!

    Hello all!
    I could really use a multi-month and year-in-view format in ical... I've seen some dated posts - is anyone aware of any new developments/options for this?
    thanks and peace-
    DW

    I turn off all calendars but the birthdays. Select [Print]. Choose all the months you want to see. Deselect all calendars but birthdays. Click [Continue]. On the next menu, go to "Layout", select how many pages to print on the paper. I usually print a border around each calendar then you're good to go!
    By only printing the birthdays calenar, you won't get too many appointments to get in the way of brain storming and future planning, yet the computer still thinks its printing a useful calendar.

  • Sales report for current month and year a go month

    i could you please guide me builting report for current monthwise for current month and year a ago month
    report parameter month_year='06-2010'
    tables = sales and below are the table fields
    customer_id
    invoice_dt
    invoice_am
    thanks
    nhm

    Okay, Still you did not mention how you will pass value in report while generating.
    Anyway the query with UNION ALL will work. For Example.
    I am assuming that the parameter for date/month you will pass in range like 01-JUN-2010 to 30-JUN-2010
    SELECT customer_id, SUM(curr_value) curr_value, SUM(past_value) past_value
    FROM
    SELECT customer_id, NVL(SUM(invoice_amount),0) curr_value, 0 past_value
    FROM sales
    WHERE invoice_dt BETWEEN :P_FROM_DATE AND :P_TO_DATE  -- here P_FROM_DATE and P_TO_DATE will be the date range for current year as i showed above.
    AND  -- Any Condition goes here...
    GROUP BY customer_id
    UNION ALL
    SELECT customer_id, 0, NVL(SUM(invoice_amount),0)
    FROM sales
    WHERE invoice_dt BETWEEN ADD_MONTHS(:P_FROM_DATE,-12) AND ADD_MONTHS(:P_TO_DATE,-12) -- This add_months function for the previous year same month.
    AND -- Any condition goes here...
    GROUP BY customer_id
    GROUP BY customer_idNow using the above query you can design the tabular report as you showed the format.
    -Ammad
    Edited by: Ammad Ahmed on Jul 3, 2010 7:55 PM
    added GROUP BY

  • Elapse days - calculation from month and year

    Duplicate thread ...
    coding  required for converting month into days
    I have Month and year field in my DSO --Year( 2009), Month(4)
    I want below logic to calculate -
    MTD qty % = (qty * elapse days) / no of days in month
    so from the above, I want to know,
    1. How can we get the no of days from the above 2 objects (year and month).
    2. Elapse days are the days that are over from current date to Ist day of that month.
    eg: current date - 04.03.2009 , 1st day of the month - 04.01.2009,
    elapse days = 2. (you need to consider all days in the month, not only working days)
    so my questions is how can we get, # of days n a month from above 2 fields and elapse days based on the above condition.
    also want to know, where can I have the logic in transformations or query level.
    please provide your suggestions.
    Thanks,
    Pra
    Edited by: Arun Varadarajan on Apr 5, 2009 10:44 PM
    Edited by: Arun Varadarajan on Apr 5, 2009 10:45 PM

    Hello,
    I think the sample program below does what you ask: it finds the days in the month (bit of an overkill to use function modules for that) and then computes the QTD.
    Note that the internal string representation of a data variable is always YYYYMMDD, regardless of the "externalized" form (e.g. yyyy/mm/dd or dd.mm.yyyy), so this code will work regardless of your custom date format.
    Regards,
    Mark
    REPORT  zqty_to_date.
    PARAMETERS:
      p_date     TYPE dats,
      p_qty      TYPE i.
    DATA:
      days      TYPE i,
      n_year    TYPE numc4,
      n_month   TYPE numc2,
      n_day     TYPE numc2,
      qtd(6)    TYPE p DECIMALS 1.
    START-OF-SELECTION.
      n_year = p_date+0(4).
      n_month = p_date+4(2).
      n_day = p_date+6(2).
      PERFORM days_in_month USING n_year n_month CHANGING days.
      qtd = ( p_qty * ( n_day - 1 ) ) / days.
      WRITE: / 'Days in month:', days,
             / 'Qty  to date :', qtd.
    *&      Form  days_in_month
    *       text
    FORM days_in_month USING year month CHANGING days.
      DATA: ymod4   TYPE i,
            ymod100 TYPE i,
            ymod400 TYPE i.
      CASE month.
        WHEN 4 OR 6 OR 9 OR 11.
          days = 30.
        WHEN 2.
          ymod4 = year MOD 4.
          ymod100 = year MOD 100.
          ymod400 = year MOD 400.
          IF ( ymod4 = 0 AND ymod100 > 0 ) OR ( ymod100 = 0 AND ymod400 = 0 ).
            days = 29.
          ELSE.
            days = 28.
          ENDIF.
        WHEN OTHERS.
          days = 31.
      ENDCASE.
    ENDFORM.                    "days_in_month

  • To get first date and end date after entering any month and year

    Hi,
    I need to to get first date and end date of a month and year in yyyyMMdd format. I am reading month and year from a properties file. But I don't know how to get the first date and End date in given format. The properties file gives me just text. But I don't know how to get the date format using this. I need this urgently. Can anyone help me to get code for this?
    I am reading the fields as,
    Properties props = new Properties();
    props.load(new FileInputStream("AnyMonthVolume.properties"));
    String date_month = props.getProperty("date_month");
    String date_year = props.getProperty("date_year");
    Thanks.

    I know this has been posted a while ago but incase someone looking for it, here is the code to get the end of current month date.
    Calendar cal = Calendar.getInstance();
         cal.setTime(new java.util.Date());
         cal.set(Calendar.DATE, 1); //set the date to start of month
         cal.add(Calendar.MONTH,1);
         cal.add(Calendar.DATE,-1);
    System.out.println(cal.getTime());

  • Selection screen - month and year

    Hi friends,
    I have a selection screen where I need to have two fields one for Period(month) and the other for Fiscal year. So I used
    parameters    :  p_lfmon   like mbewh-lfmon.
    parameters    :  p_lfgja   like mbewh-lfgja.
    My requirement is when I execute the program I want to see the current period(08) and Year(2006) in these two fields. And also I was wondering if we can add the input help F4 for these two fields as they dont have one right now.
    Finally if I want to compare the these two fields month and year with a field in normal date format (08/25/2006), what is the easiest way to do that.
    Waiting for replies. Especially from Rich. Thanks

    If you need to default the current fiscal period, then you can do this.
    report zrich_0001.
    data: datum type sy-datum value '20060806'.
    parameters: p_spbup type spbup  .
    initialization.
      data: xgjahr type bkpf-gjahr.
      data: xpoper type t009b-poper.
      call function 'FI_PERIOD_DETERMINE'
           exporting
                i_budat = sy-datum
                i_bukrs = '0010'
           importing
                e_gjahr = xgjahr
                e_poper = xpoper.
      concatenate xgjahr xpoper+1(2) into p_spbup.
    start-of-selection.
      if datum+0(6) = p_spbup.
        write:/ datum, 'is in period', p_spbup.
      endif.
    Regards,
    Rich Heilman

  • Getting Day, month and year from Date object

    hello everybody,
    Date mydate = Resultset.getDate(indexField);
    Now i would like to get day, month and year from mydate.
    In another words, i'm looking for something equivalent to
    mydate.getDay() as this method is deprecated.
    Can somebody help me out please?
    Thank you in advance,

    swvc2000,
    Here is a sample class that demonstrates two ways in which to do this.import java.util.*;
    import java.text.*;
    public class DateSplitter {
       public static void main(String args[]) {
          /* even though your date is from a result set,
             pretend the following date is your date that
             you are using. The try catch block is used
             because I hand-crafted my date using
             SimpleDateFormat.  Substitute your date.*/
          Date yourDate = null;
          try {
             SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
             yourDate = formatter.parse("05/06/2000");
          } catch (ParseException e) { }
          //the following gets the current date
          Calendar c = Calendar.getInstance();
          //use the calendar object to set it to your date
          c.setTime(yourDate);
          //note months start at zero
          int month = c.get(Calendar.MONTH);
          int year = c.get(Calendar.YEAR);
          int dayOfMonth = c.get(Calendar.DAY_OF_MONTH);
          System.out.println("Calendar Month: "+month);
          System.out.println("Calendar Day: "+dayOfMonth);
          System.out.println("Calendar Year: "+year);
          System.out.println();
          /* Simple date format can also be used to strip them
             out of your date object.  When you use it, notice that
             months start at 1.  Also, it returns string values.  If
             you need integer values, you will have to use
             Integer.parseInt() as I did below.  If you are
             only concerned about the string values, just remove
             the Integer.parseInt part. */
          DateFormat formatter = new SimpleDateFormat("M");
          month = Integer.parseInt(formatter.format(yourDate));
          System.out.println("SDF Month: "+ month);
          formatter = new SimpleDateFormat("d");
          dayOfMonth = Integer.parseInt(formatter.format(yourDate));
          System.out.println("SDF Day: "+ dayOfMonth);
          formatter = new SimpleDateFormat("yyyy");
          year = Integer.parseInt(formatter.format(yourDate));
          System.out.println("SDF Year: "+ year);
       }//end main
    }//end DateSplitter classtajenkins

  • Dynamic filter by Country, month and year

    Hi,
    I have a file extracted from SAP BI and incrusted in xls format in Xcelsius.
    I have to filter data by Country, year, and month.  I´ve seen the blog of Ingo Hilgefort 'Creating an Xcelsius dashboard on top of SAP BI that has a similar expanation of what I need to do. 
    Unfortunatelly, the problem I ´m facing is how to organize the data including the months in the spreadsheet incrusted in the Xcelsius.
    What I have at the moment in the spreadsheet is a column with countries (9),  an one column by KPI (10).  Beside the last column I have the inserted data column for the countries so in the dashboard I can pick a country and shows me the KPI´s by country.  What I still don´t found is how to make the selection also by month and year.
    If anyone could help, I would be grateful.
    Thanks in advance,
    Diego

    Charles,
    It seems to be what i´m looking for.  It is perfect to see the KPI´s by country and month in a year.
    But with that spreadcheet i still cannot choose only the KPI´S year values by countries (independently of the month).
    Another question I would like to make to you (as i told you i´m making my first steps in Xcelsius) is if you write the formula =BUSCARV($C$7;$C$17:$G$23;5;FALSO) manually into the excel.
    Thanks in advance,
    Diego

  • How to get currect date by using month and year

    hai,
    By using month like 'Jul' and year like 2007 i want to get full date like 01/06/2007(format).Please give me query for this?My fields for month and year are respectively vr_mnth(varchar) and in_year(number)

    i used to_date function but it accepts only one string .if i give like this
    to_date(vr_mnth,in_year,'dd/mm/yy') it will gives me syntax error.
    If i give like this vr_mtnh='Jan'
    to_date(vr_mtnh,'Mon') it will give output
    01/01/2008 it shows me current year
    if i choose from table wich is strored with month-'Jul' and year=2006 it shows me
    01/07/2008 only .It doesn't shows me that 2006 year
    If i give in_year in to_date it gives me that currect year.
    Ex:to_date(in_year,'YY')..............>01/01/2006
    Individually to_date function works fine but i want to club both to get accurate date format of specified month and year.Is there any function for that in sql to get 01/07/2006?

  • Hide days from WebElements component WECalendar (show only month and year)

    Dear expert,
    I'm using WebElements to replace standard InfoView parameter screen for my Crystal Reports. My question is:
    1. Is it possible to customize WebElements component: WECalendar so that we only see Month and Year, but not the Days (in other words to hide the days from the calendar).
    If not possible then is there any other WebElements component that i can use for this purpose?
    Because i only need to pass value of month and year selected by user when jumping to other report (using OpenDocument).
    2. When i looked at the code, i'm afraid the only way is by editing the HTML part that is marked with:
    // *** do not modify the code below
    Since there's no available variables for hiding the days in the section that can be modified:
    // *** the code below can be modified to change the formatting to the desired look and feel
    Below is some of the code of the WECalendar component:
    Function (stringvar ElementName, datevar ElementDefault, stringvar MonthDisplays, stringvar DayDisplays)
    // *** the code below can be modified to change the formatting to the desired look and feel
    // calendars use the stringvars below if nothing is entered into the WECalendar function for these parameters
    if DayDisplays="" then DayDisplays:= 'Su|Mo|Tu|We|Th|Fr|Sa'; // note that there must be two characters for each day...or use " " as in 'S |M |T |W |T |F |S ' 
    if MonthDisplays="" then MonthDisplays:= 'January|February|March|April|May|June|July|August|September|October|November|December';
    // the font below is for the month & year display in the calendar and can be modified
    stringvar headerfont:= WEFont('Verdana', 11, 'Navy', '', true, false,"","");
    // the font colour and size below can be modified...this is for the arrows that change the month or year of the calendar
    stringvar arrowfont:= WEFont('Arial', 10, 'Gray', '', false, false,"","");
    // these fonts for the calendar days must be a fixed width font such as Lucida Console or the calendar spacing will break
    stringvar datefont:= WEFont('Lucida Console', 8, 'Black', '', false, false,"","");
    stringvar daystringfont:= WEFont('Lucida Console', 8, 'Black', '', false, false,"underline","");
    stringvar weekendfont:= WEFont('Lucida Console', 8, 'Gray', '', false, false,"","");
    stringvar inputfont:= WEFont('Lucida Console', 8, 'Navy', 'Center', false, false,"","");
    // *** do not modify the code below
    Thank you very much.
    Kind regards,
    aswin
    Edited by: Aswin Setyawan Margono on Feb 2, 2011 5:16 PM

    hi Aswin,
    you can always modify any of the webelements controls or create your own if you're feeling adventurous. the "do not modify" is just a warning that the code below is not as customizable as the code above which is made to be easily changed.
    my recommendation for an easy win in your case though is to use the weSelectDuo control having years in the first of the select menus and the months in the second select menu.
    cheers,
    jamie

  • News articles grouped by month and year

    PHP and MySQL...
    Don't know if I am going to get an answer here, but I am looking for a bit of advice on how to handle grouping of news articles into months and each then into the respective year to make it easier for the user to navigate content. I am trying to acheive this effect:
    2012
    - July
    - June
    - March
    - January
    2011
    - December
    - October
    - April
    2010
    - November
    - You get the idea I hope
    I have set up MySQL to use a 'date' field called fld_articledate (formatted as YYYY-MM-DD). I need to structure my recordset query to select by year and group it, but then I also need to group by month relative to that year, but I have no idea of where to begin. So I guess my question is two-part:
    How do I group by year?
    How do I then group by month of that year?
    Once I have my queries sorted, I assume I'd print to page with  repeat and nested repeat regions!
    Thanks.
    Mat

    PHP and MySQL both have a lot of built in functions for working with dates.
    Here is a little code example from one of my projects that is similar to what you want to do. this example uses PDO, but the query is the same if you are using the older mysql extension. the last line builds an array of the result. You may not need this.Also note that the month and year are returned from the query using aliases (month, year); They could just as well be called "mymonth' and myyear, etc. The second to the last like formats the result for display.
    $sql=$dbh->prepare("SELECT DISTINCT EXTRACT(YEAR FROM(startdate)) AS year, EXTRACT(MONTH FROM (startdate)) as month FROM courses WHERE startdate > $currentdate order by startdate");
    $sql->execute();
    while ($monthorder = $sql->fetch(PDO::FETCH_ASSOC)){
    $month = $monthorder['month'];
    $year = $monthorder['year'];
    $monthtext = date('F Y', mktime(0,0,0,$month,1,$year));
    $monthlist[]=array('month'=>$month, 'year'=>$year);
    Since you want to link to articles, you then need a second query that will retrieve those details based on whatever month is selected. something like this:
    ("SELECT courses.course_id, title, startdate, enddate, highlight_photo FROM courses WHERE startdate > '$currentdate' AND EXTRACT(YEAR FROM (startdate)) = '$year' AND EXTRACT(MONTH FROM (startdate)) = '$month' ORDER BY startdate")

  • Month and Year on slider Movement.

    Hi,
    I am a newbie to XCelsius. I want to show and take the value of Month and Year (in format 'mmm-yy') up to last 12 months. But I am not able to convert the number which I get from slider to the Month and Year.
    Regards,
    Neel.
    Edited by: Neel Kulkarni on Jan 28, 2009 7:58 AM

    Hi Neel,
    I think you can do this with a vlookup. You would provide a set of cells which would provide the basis of the lookup and your slider would be the first arguement.
    The spreadsheet should look like this
    Item, Date, Formatted Date
    0, 29/01/2009, 01 2009
    0, 01/12/2008, 12 2008
    0, 01/11/2008, 11 2008
    0, 01/10/2008, 10 2008
    0, 01/09/2008, 09 2008
    0, 01/08/2008, 08 2008
    0, 01/07/2008, 07 2008
    0, 01/06/2008, 06 2008
    0, 01/05/2008, 05 2008
    0, 01/04/2008, 04 2008
    0, 01/03/2008, 03 2008
    0, 01/02/2008, 02 2008
    Once you have this (assuming from A1:C12) and with your slider value at D1 you can do a lookup
    =vlookup(D1, A1:C12, 3,false)
    and this will return appropriate value.
    The difficulty will be filling the date as Excel does not have a DateAdd function. The simplest approach would be to load this data via QaaWS or Live Office if you have that facility. If not you could write something like the following
    =DATE(IF((MONTH(TODAY())-A2)>0,YEAR(TODAY()), YEAR(TODAY())-1),IF((MONTH(TODAY())-A2)>=0,12,MONTH(TODAY())-A2),1)
    This is a bit buggy, as I have not time to debug it properly.
    You would then use the TEXT function to get the data in the format you want (you will have to extend this so that it converts 01 to Jan etc
    =TEXT(MONTH(B1), "00")&" "&TEXT(YEAR(B1), "00")
    Let me know how you get on
    Regards
    Alan

Maybe you are looking for

  • New hard drive replacement on my MacBook Pro.

    I bought a new hard drive for my laptop but I do not have the disc to reboot the new hard drive, can someone help me?

  • Mac Mini to older HDTV as a media center...is it possible?

    As the title suggests, I would like to purchase a Mac Mini and use it as a media center, hooked to my older Sony HDTV (with component inputs only). Is there such a thing as a DV to component adapter that will work with the Mac Mini?

  • My touchscreen on my iPhone stuffs up

    My iPhone now (all of a sudden) will have the Screen temporarily not working, it will work and then for a short period of time I can't type Sometimes putting it on sleep And back again helps but it just stops working everything Is this something that

  • Oracle 8/8i application server

    Hello Where can i find the download for Oracle 8/8i Application Server on Windows? Victor.

  • Can't replace procedure

    Hi: I am using Squirrel as the client tool using JDBC RAC driver against Oracle 11.1. I am trying to replace an existing Oracle procedure with: CREATE OR REPLACE PROCEDURE MY_PROC AS BEGIN DELETE FROM table1 WHERE IEX_DATE >= (select max(idate) from