Month Names logic

Hi,
I just want to get month names in output.
If i gives '3' as input it has to display next 3 month names(September,October,November).
If i gives 6 as input next 6 month names from September to February.
Thanks,
fractal.
REPORT ZTEST2 .
DATA : lt_month_names LIKE t247 OCCURS 0 WITH HEADER LINE.
  DATA : lv_date LIKE sy-datum ,
         l_month type i,
         l_month2 type i.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-005 .
Parameter: p_month(2).
SELECTION-SCREEN END OF BLOCK b1 .
CALL FUNCTION 'MONTH_NAMES_GET'
  TABLES
    MONTH_NAMES                 = lt_month_names
EXCEPTIONS
   MONTH_NAMES_NOT_FOUND       = 1
   OTHERS                      = 2
  lv_date = sy-datum.
  l_month = lv_date+4(2).
   l_month2 = l_month + p_month.

Hi fractal,
Try this code , its just that u need..
DATA : lt_month_names LIKE t247 OCCURS 0 WITH HEADER LINE.
DATA : lv_date LIKE sy-datum ,
l_month TYPE i,
l_month2 TYPE i.
DATA: BEGIN OF itab OCCURS 0,
  spras TYPE spras,
  mnr LIKE t247-mnr,
  ktx LIKE t247-ktx,
  ltx LIKE t247-ltx,
  END OF itab.
DATA : BEGIN OF itab1 OCCURS 0,
temp LIKE t247-ltx,
END OF itab1.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-005 .
PARAMETER: p_month(2).
SELECTION-SCREEN END OF BLOCK b1 .
SELECT * FROM t247 INTO CORRESPONDING FIELDS OF TABLE itab            " TO GET THE SHORT MONTH NAMES...I.E. MAR FOR MARCH
     WHERE spras = 'E'.
lv_date = sy-datum.
l_month = lv_date+4(2).
DO p_month TIMES.
  READ TABLE itab WITH KEY mnr = l_month.
  IF sy-subrc = 0.
    itab1-temp = itab-ltx.
    APPEND itab1.
  ENDIF.
  l_month = l_month + 1.
  IF l_month > 12.
    l_month = 1 .
  ENDIF.
ENDDO.
LOOP AT itab1.
  WRITE : / itab1-temp.
ENDLOOP.
Regards,
Bijal

Similar Messages

  • Change of Month names as per selection of Month / Year

    We have the following requirements:
    1. Change of Month names as per selection of Month / Year e.g. If the user select April 08 then the column name should be April 08, at the same time the next column should be April 07.
    2. Next there are two in -line totals as per different logic as recurring rows. e.g Row header is Total and it totals the items in the column, next row header is Comparable total and it is based on checking the adjacent column values for doing the total.
    Please let us know if this is feasible and can be done using BI Publisher. If you have any alternate way of doing it using OBIEE also , please share.

    Hi,
    The parameter / prompt used is for month which can have values from JAN , feb, MAR, APR,....... DEC. and the other PROMPT being YEAR e.g. 2006, 2007, 2008.
    The Column Name of the Report SHould get changed as April 08 if selected as month APril and year 2008.The subsequent column of the report should be April 2007. The same applicable for selecting any month/ year
    Layout of Report as below
    SALES
    || April 08 || April 07
    Shop1 100 200
    Shop2 300 100
    Thanks
    NJ

  • Change of Month names as per selection

    We have the following requirements:
    1. Change of Month names as per selection of Month / Year e.g. If the user select April 08 then the column name should be April 08, at the same time the next column should be April 07.
    2. Next there are two in -line totals as per different logic as recurring rows. e.g Row header is Total and it totals the items in the column, next row header is Comparable total and it is based on checking the adjacent column values for doing the total.
    Is this feasible and can be done using BI Publisher? If you have any alternate way of doing it using OBIEE also , please share.

    1. YOu should use AGO function (something like AGO (measure, fiscal_month, 1) ) and Variable to define your column's name
    2. maybe you should look into RSUM and I think you can build this logic in the BMM layer.
    Good luck

  • Sort the month name column based on month id in rpd itself only

    sort the month name column based on month id in rpd itself only without creating the logical column.

    Hi,
    sort the month name column based on month id in rpd itself only without creating the logical column. Can you be bit specific?
    Is this what you want..http://www.biconsultinggroup.com/knowledgebase.asp?CategoryID=198&SubCategoryID=368
    Regards,
    Srikanth
    http://bintelligencegroup.wordpress.com

  • Want to get the month number from month name

    Hi Friends
    Can you suggest  me a function module which would <b>convert the month name to the month number.</b>?
    Example : suppose the input is<b> December 20,2006</b> I want to get it converted to SAP internal format YYYYMMDD i.e. <b>20061220.</b>
    Would reward pointns for immediate help.:-)
    Also is there a function module which would convert date given in any format to the SAP internal format.
    Thanks
         Rita.

    Hi,
    I am not aware of any FM that will convert alphnumeric dates to SAP internal format.
    However, you could create a simple logic to convert this with the assumption that your first string is for the month then date then year:
    =====
    DATA: l_date(20) VALUE 'December 20,2006',
          l_new_date(8),
          l_month(10),
          l_day(2),
          l_year(4).
    START-OF-SELECTION.
      TRANSLATE l_date TO UPPER CASE.
    *- Get month string (separated by space from day & year)
      SPLIT l_date AT space INTO l_month l_date IN CHARACTER MODE.
    *- Get day & year (separated by comma)
      SPLIT l_date AT ',' INTO l_day l_year IN CHARACTER MODE.
      l_new_date0(4) = l_year0(4).
      l_new_date6(2) = l_day0(2).
    END-OF-SELECTION.
    *- Get numeric month
      SELECT SINGLE mnr FROM t247
        INTO l_new_date+4(2)
        WHERE ktx = l_month+0(3).
      IF sy-subrc = 0.
        WRITE:/ l_new_date.
      ELSE.
        WRITE:/ 'Invalid date'.
      ENDIF.
    Thanks.
    Kind Regards,
    Darwin

  • Month name displayed in month calendar view for previous month

    In iPad IOS 7.04 iCal month view the month name displayed at the top of the window is incorrect. The previous month name show when viewing a calendar month. Test by selecting year view and the any month from the year. The month view will be for the selected month, but the month name will be for the preceding month. The incorrect month name in month vie is also displayed if the month view is scrolled to new months.
    I observe this on my iPad II.
    Ha s anyone seen this error? Does anyone know if Apple has seen this and has a plan to correct it?

    Imhave the same exact problem on my iPad2.  It was not fixed in the recent iOS 7.1 release, even though modifications were made to the calendar app.  Very frustrating, since this is such an easily observable problem.

  • Checking for month name and number in different language?

    I have to let people search for documents by date. The database is used by French-speakers as well as English-speakers. The search allows users to type in free text (because it's not just dates they might search by, though if they do type in something that's intended to be interpreted as a date, that's the only thing they're allowed to type in). So, I might get '23/Apr/2009' or '2009/04/23', for example. (I also have to allow them to submit 23.04.2009 and 23 04 2009 and any combination of the above!)
    I have written a function which breaks the string into three bits, and then I work out if each bit is a year, or a month, or a day with simple rules (eg, if it's a number between 1900 and 2400, it must be the year component).
    When it comes to the month, I do two things. One is obvious: is it a number between 1 and 12? The other is, is it a month name that appears in a list of 'allowed' month names. So my function does this at the start:
    v_validmonths := 'january,february,march,april <and so on>';
    v_validmonths := v_validmonths || ',janv,fevr,avr,mai, <and so on>';Then I do this:
        for x in 1 .. listlen(v_validmonths,',') loop
          v_probemonth := listgetat(v_validmonths,x,',');   
          if instr(lower(v_partone),v_probemonth) > 0 then
            v_month := extract (month from to_date(v_partone,'MON'));
          end if;
        end loop;   IE, I compare the first component of the string (v_partone) with the list of allowed month names. I repeat that for the other two parts of the supplied string. As you can see, if one of the parts of the supplied string matches an allowed month name, I then try to extract the month number into a variable, using Oracle's own extract function.
    And that's where my problem arises. Because although "aout" is valid French for August and is permitted by my list of valid months, the extract function fails to understand it. A simple select extract (month from to_date('AOUT','MON')) from dual, for example, gives an ORA01843 (invalid month).
    How can I get the code to work with French (and German, actually) months and month abbreviations whilst also being able to understand English ones? Is there an in-built function that would allow me to do this? Or is there some way neatly to say, 'yes: AOUT is in the list, and it's month 8' without me having to rely on the extract function to work it out?
    (I realise that the business requirement here is very peculiar and your first reaction will probably be "this is horrible!". I will absolutely agree with you! But this is the requirement as has been explicitly specified by the MD and I can't negotiate it away, sadly.)

    Hi,
    Many of Oracle's date functions allow a parameter where you can override the current NLS settings only for that function call.
    For example:
    SELECT  TO_DATE ( 'JUIL.'
                     , 'MON'
                     , 'NLS_DATE_LANGUAGE=FRENCH'
                     ) AS month
    FROM    DUAL;You could also create your own table of month names
    NAME     NUM     LANGUAGE
    JANVIER   1     FRENCH
    JANV       1     FRENCHand look up the names in this table, rather than in a string hard-coded in the function. This might be especially useful if you wanted to allow your own abbreviations or spellings (e.g., ignoring accent marks).
    Edited by: Frank Kulash on Dec 16, 2010 11:40 PM

  • How to create a formula to get the month name based on userresponse

    Hi,
    I have created a report using E-Fashion - Actually i need  a report like  -  For ex i need 4 months data from 12 months
    My report should display the 4 months data along with starting & end month data in the next 2 columns
    I have used the prompt to fetch the data & i have created a formula in the cloumn like below:
    For the column haader i have given = Tonumber(userresponse("Enter start:")) - I am getting the Month number in the header But i need the month name in the header.Please guide me
    Regards
    Karthika

    Hi Ram,
      Thanks for your Help.I tried in an another way like I created 2 Variable -
    Start Date  =UserResponse("Enter Month(Start):"
    End Date = =UserResponse("Enter Month(End):"
    I have created the column header for
    start date:
    =If([start Date] = "1";"January";If( [start Date] = "2"; "February";If([start Date] = "3";"March";If([start Date] = "4";"April";If([start Date] = "5";"May";If([start Date] = "6";"June";If([start Date] = "7";"July";If([start Date] = "8";"August";If([start Date] = "9";"September";If([start Date] = "10";"October";If([start Date] = "11";"November";If([start Date] = "12";"December"))))))))))))
    End Date:
    =If([End Date] = "1";"January";If( [End Date] = "2"; "February";If([End Date] = "3";"March";If([End Date] = "4";"April";If([End Date] = "5";"May";If([End Date] = "6";"June";If([End Date] = "7";"July";If([End Date] = "8";"August";If([End Date] = "9";"September";If([End Date] = "10";"October";If([End Date] = "11";"November";If([End Date] = "12";"December"))))))))))))
    For the Datas in the column:
    Start Date:
    =[Sales revenue] Where([Month]=ToNumber(UserResponse("Enter Month(Start):")))
    End Date:
    =[Sales revenue] Where([Month]=ToNumber(UserResponse("Enter Month(End):")))
    I got the Report format as i required
    Thanks
    Karthika

  • Display Month name Year

    Hi,
    Which variable Displays Month name Year (Exaple: July 2007)???
    Help will be gratly appreciated...
    Thanks...

    Hi,
    Thanks for your information..
    But i am not getting like month and year display( Example:  Sept 2007)
    I am using Text variable 0P_FPER on 0Fiscal year/period..
    and entering Input as 006.2007 then the resultant query displays as 06.
    Please suggest me how to do it??
    For entry i should give 006.2007 (or) Sept 2007..
    But in the result it should display as Sept 2007..
    Help will be greatly appreciated...
    Thanks

  • FM to get the month name based on numeric value

    Hi , Is there any FM which returns the month name when we enter the corresponding numeric value . E.g. if the input is 3 the output must be March

    Hi,
    Try
    DATA: mon_number TYPE numc VALUE '03',
          month_name(20).
    SELECT ltx
      FROM t247
      INTO month_name
    WHERE spras = 'EN'
       AND mnr   = mon_number.
    Hope it helps.
    Regards
    Message was edited by: Shehryar Khan

  • Problem of sorting month name in pivot table

    Hello,
    I have a month name that is sorted by month number in my repository.
    When I select Year + month name + measure sorted by year then by month name and I look the result in a table, everything works perfectly but when I switch to a pivot table the sorting doesn't work : the pivot table sorts my month name in an alphabetical order instead of using the month number .... Is it normal ?
    To find a solution, I have added my month number and I have sorted by year then by month number and I have hidden my column month number. This have solved my problem for the pivot table but if I attached a chart to it (by selecting "Chart Pivoted Results"), the label of the bottom axis contains the month number and the month name and I haven't found where I can hide this month number. Why the hidden option only works on the pivot table and not on the pivot chart ? And how I can do that ?
    Thanks in advance for your help.

    No there is no Transient attribute involved , could you please tell me what might cause this error .
    Basically this page is for inserting a record.
    Thanks ,
    Keerthi
    Edited by: user1140193 on Oct 21, 2011 7:15 AM
    Edited by: user1140193 on Oct 21, 2011 7:16 AM

  • Period number to be displayed as month name

    Hi,
    I have Fiscal year/Period defined in the column section of the BW query.  Currently the column will be displayed for example: Period 01, 2009, Period 02 2009 and etc.   Our users are asking to display the month name instead of the Period#.  Is it something can be handled within the query definition (or) via the BW query user exit. 
    Thanks in advance for any response.

    Hi Venugopal,
    Fiscal period is not always the same as calmonth.
    For eg - In India, you have April as the 1st fiscal period of this year.
    Hence, it does not make sense to have month names for fiscal period.
    Also in FICO you may have special periods..ie periods after period 12.( eg period 13 to 16) you wont be able to map them to a particular month in some cases.
    If you want to display month name in your column selections, use 0calmonth object with text display.
    However, this would mean you are view a dataset as per calmonth and not as per fiscal period.
    Check if this is acceptable for your business requirement.
    Lastly, you can always have a formula, to check the value and put texts instead.
    ( if fiscal period is 02/2009 then month is feb ..(based on the country).
    Hope it helps,
    Best regards,
    Sunmit.

  • Why do the foreign language Siri voices use English day and month names?

    I had picked French (Canada) and was ready to believe that "nous sommes le Sunday, June seize, deux mille treize" was correct in Quebec and Nova Scotia, until I checked in German and Japanese, and all the answers used English day and month names!

    Hutchpat wrote:
    is the Spellchecker language tied to the keyboard one is using?
    Yes, that is exactly how it works.  You can quickly switch among keyboards using the Globe key.
    I'm sure you will easily find the Region Formats if you have a look at Settings/General/International

  • Function Modules for Format Date, Month Name and Quarter value.

    Hi All,
    1. I am getting the date field from the Flatfile, so i need to format the date to YYYYMMDD. Is there any Function module for that in BW.
    2. Based on the above Formated Date i have to find out the Name of the Month like JANUARY, FEBUARY etc.
    3. Based on the same above Formated Date i need to find out the Quarter like 1, 2 etc.
    Could you please let me know if any function modules are there for the above questions in BW not in ABAP, why i mention is some Function modules are there in ABAP but not in BW.
    Thanks in advance.
    Regards,
    srinivas

    Hi ,
    1.If your input date format is MMDDYYYY then Use SDATE as conversion routine in trans strucutre to convert into YYYYMMDD.
    2.By passing year as input parameter for the following FM you would get all the months with text.Using READ statement in routine you can get month name
    MONTH_NAMES_GET
    3.For Quarters you can use the following FM:
    TSTR_PERIODS_QUARTERS
    hope it helps...
    regards,
    Raju

  • Sort By Month Name in Crosstab report

    Hi,
    I have one cross tab report in which in Datapoint I have one column which shows Month Details. When I run the reports the heading of Column comes as Month Name (ie Aug, April, Dec,.....) . Can you please help me to understand how can it be done it displayed in sorted month according to Month Name (ie. Jan, Feb, Mar, Apr.......). As per one of the Thread I tried to use to_date(Column_name) but it does not work as Column name is char column and cannot be converted to date.

    Hi ,
    What if you use the following ...in bold?????
    SQL> select ename,hiredate from emp;
    ENAME      HIREDATE
    SMITH      18/12/1980
    ALLEN      20/02/1981
    WARD       22/02/1981
    JONES      02/04/1981
    MARTIN     28/09/1981
    BLAKE      01/05/1981
    CLARK      09/06/1981
    SCOTT      18/04/1987
    KING       17/11/1981
    TURNER     08/09/1981
    ADAMS      21/05/1987
    JAMES      03/12/1981
    FORD       03/12/1981
    MILLER     23/01/1982
    14 rows selected
    SQL> select hiredate , to_number(to_char(hiredate,'MM')) from emp order by 2;
    HIREDATE    TO_NUMBER(TO_CHAR(HIREDATE,'MM
    23/01/1982                               1
    20/02/1981                               2
    22/02/1981                               2
    02/04/1981                               4
    18/04/1987                               4
    21/05/1987                               5
    01/05/1981                               5
    09/06/1981                               6
    08/09/1981                               9
    28/09/1981                               9
    17/11/1981                              11
    18/12/1980                              12
    03/12/1981                              12
    03/12/1981                              12
    14 rows selectedOR ....
    EVEN BETTER AS YOU NEED THE MONTH NAME....
    SQL> ALTER SESSION SET NLS_DATE_LANGUAGE='AMERICAN';
    Session altered
    SQL> select hiredate , to_char(hiredate,'MON') , to_number(to_char(hiredate,'MM')) from emp order by 3;
    HIREDATE    TO_CHAR(HIREDATE,'MON') TO_NUMBER(TO_CHAR(HIREDATE,'MM
    23/01/1982  JAN                                                  1
    20/02/1981  FEB                                                  2
    22/02/1981  FEB                                                  2
    02/04/1981  APR                                                  4
    18/04/1987  APR                                                  4
    21/05/1987  MAY                                                  5
    01/05/1981  MAY                                                  5
    09/06/1981  JUN                                                  6
    08/09/1981  SEP                                                  9
    28/09/1981  SEP                                                  9
    17/11/1981  NOV                                                 11
    18/12/1980  DEC                                                 12
    03/12/1981  DEC                                                 12
    03/12/1981  DEC                                                 12
    14 rows selectedRegards,
    Simon
    Message was edited by:
    sgalaxy

Maybe you are looking for

  • Pdf on iOS devices damaged or white screen

    Hello our iPhone and iPads can not display a Pdf-File that was scanned. Sometimes they only display a white screen or the pdf file is damaged (color stripes) but on every computer it´s being displayed without any error. The Pdf file you´ll find as at

  • When will the next ESR release be available?

    Hi - I am writing some GUI based code and plan to release towards the end of the year. I imagine that a new FF ESR will be available by then. When will the new version of FF ESR be available so I can try and ensure that we test our GUIs using it? Tha

  • Photo Booth issues ie - Effects

    I have owned my iMac since December and had no problems until I took the last version of Leopard V10.5.2 One issue I have is with Photo Booth. It pertains to the effect section, which is the third option after clicking the effect button. I click on o

  • Java Mailer and R12

    Gurus, We have an R12 instance running on Solaris. I had configured the Java mailer during the installation and it used to work fine. For the past few days (and am still trying to figure out what was changed) the behaviour of the mailer is inconsiste

  • 3 EA1 problem in 64-bit environment

    I'm definitely not able to start Data Modeler 3 EA1 on a 64-bit environment (64-bit Windows 7, 64-bit Jvm) I knew (and I read from Release notes) that SQL Developer Data Modeler is supported on 64-bit platforms, but datamodeler.bat is simply missing