Data element for Month and Year

Hello All,
Is there any data element which will have only Month and Year.
I have to introduce this field in a table. It should have convesion exits also.
Ex: If i give 092009, it sould come like 09.2009
Thank you.
Best Regards,
Sasidhar Reddy Matli.

Kindly Try this code for Month and year as input and having standard F4 help..
INCLUDE RMCS0F0M.
TYPES : BEGIN OF TY_SELECT,
          MONTH TYPE FTI_MONTH_YEAR,
        END OF TY_SELECT.
DATA : WA_SELECT TYPE TY_SELECT.
SELECTION-SCREEN : BEGIN OF BLOCK SANDEEP WITH FRAME.
  SELECT-OPTIONS : S_MONTH FOR WA_SELECT-MONTH OBLIGATORY NO INTERVALS NO-EXTENSION.
SELECTION-SCREEN : END OF BLOCK SANDEEP.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_MONTH-LOW.
  PERFORM MONAT_F4.
SANDEEP JAIN

Similar Messages

  • 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?

  • SELECTION SCREEN FIELD FOR MONTH AND YEAR

    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 Venkat,
    Copy the following code.
    DATA :  ws_billfrom    TYPE dats,
            ws_billto      TYPE dats.
    DATA : mon TYPE fcltx.
    SELECT-OPTIONS: s_month FOR mon
                MATCHCODE OBJECT zsdhtch_sh_mnth
                OBLIGATORY. "o get values for F4
    PARAMETER :  p_year LIKE bkpf-gjahr
                 MATCHCODE OBJECT zsdhtch_sh_year
                 OBLIGATORY.
    RANGES : s_date FOR sy-datum.
    DATA : ws_fcmnr TYPE fcmnr.
    START-OF-SELECTION.
      SELECT SINGLE mnr
             INTO ws_fcmnr
             FROM t247
             WHERE ltx = s_month-low.
      CONCATENATE p_year ws_fcmnr '01' INTO ws_billfrom.
      CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
           EXPORTING
                iv_date             = ws_billfrom
           IMPORTING
                ev_month_begin_date = ws_billfrom
                ev_month_end_date   = ws_billto.
      s_date-low = ws_billfrom.
      s_date-high = ws_billto.
      s_date-sign = 'I'.
      s_date-option = 'BT'.
      IF NOT s_month-high IS INITIAL.
        SELECT SINGLE mnr
               INTO ws_fcmnr
               FROM t247
               WHERE ltx = s_month-high.
        CONCATENATE p_year ws_fcmnr '01' INTO ws_billfrom.
        CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
             EXPORTING
                  day_in            = ws_billfrom
             IMPORTING
                  last_day_of_month = ws_billto.
        s_date-high = ws_billto.
      ENDIF.
      APPEND s_date.
      WRITE s_date.
    You can write your select statement here.  
      select * from dbtable where date in s_date.
    If 'HR_JP_MONTH_BEGIN_END_DATE' is nto there in your server, you can use 'RP_LAST_DAY_OF_MONTHS' in both cases.
    Regards,
    Susmitha.
    Dont forget to reward points for  useful answers

  • How to set filter criteria for month and year using in timestamp input field?

    Hi,
    I am using jdev 11.1.2.3,
    I have one problem with Report generation,,,,,,I have one report table which is in the form of VO(query based) and i want to search this table as month and year basis
    but in this table(query) that field having timestamp based value.. how to search with month name and year only.. Here i am using totally query base VO's for generating
    reports........ Can any one guide me.
    Thank You.

    You can use a inputdate, which allows you to selecte a moth, year and a day. Once the selection is made you convert it to only allow moth and date like
            <af:inputDate label="Label 1" id="id1" autoSubmit="true" value="#{bindings.myMonthYear1.inputValue}">
              <f:convertDateTime pattern="MM/yyyy"/> 
            </af:inputDate>
            <af:outputText value="Selected #{bindings.myMonthYear1.inputValue}" id="ot1" partialTriggers="id1"/>
    then you have a string holding month and year only. This value you split into two variables you or pass it as a whole parameter to the query and split it there.
    Another way is to add two static lovs one for month and one for year and use them to get to the filter values.
    Timo

  • F4 option for Month and Year

    hi
    In Selection Screen i have Month and Year as input.....
    How to give "F4" Option for both Month and Year?
    Regards
    Smitha

    hi,
    this will help u get the month in f4 help .
    similarly u can fill up the itab for year and get that f4 help too i guess.
    TABLES: T247 ,
            DFIES.
    PARAMETERS:P_MONTH LIKE T247-MNR.
    DATA: BEGIN OF ITAB OCCURS 0,
    MNR LIKE T247-MNR,
    KTX LIKE T247-KTX,
    END OF ITAB .
    DATA : LT_FIELDS TYPE TABLE OF DFIES,
           LWA_FIELD TYPE DFIES.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MONTH.
      SELECT MNR
             KTX
      FROM T247 INTO CORRESPONDING FIELDS OF TABLE ITAB
      WHERE SPRAS = 'EN'.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          RETFIELD    = 'P_MONTH'
          DYNPPROG    = SY-CPROG
          DYNPNR      = SY-DYNNR
          DYNPROFIELD = 'MNR'
          VALUE_ORG   = 'S'
        TABLES
          VALUE_TAB   = ITAB
          FIELD_TAB   = LT_FIELDS.

  • Date concatenation using MONTH and YEAR

    Env : Oracle Reports 9I.
    I need to display reports based on dates.
    If the user enters in one field 'SEP' and in another '2005',
    how can I concatenate both the fields as one and then display
    all results for SEP 2005?
    The Table has a field called Eff_Date (of type Date)
    and containing values:
    Eff_Date
    ==============
    01-09-05
    02-09-05
    04-09-05
    05-09-05
    My code is
    SELECT col1,
           col2
    FROM   TableA
    Where  TRUNC(Eff_Date )=:MONTH  ?? PARAMETER: Here is the month : SEPT
    and      TRUNC(Eff_date) =:YEAR     ?? PARAMETER: Here  is the Year : 2005I need to concatenate parameters MONTH and YEAR in one and then
    display records for that month.
    How can I write the SQL Query to concatenate MONTH and YEAR and
    TRUNCATE the column eff_date?
    Please help.

    Env : ORACLE REPORTS 9I
    I am passing 3 parameters to the report:
    Parameters are of type CHAR
    Report Parameters
    Year / Month :   2005 / AUG
    Effective Date :
    The colunm in table is eff_date
    eff_date
    01/08/2005
    02/08/2005
    03/08/2005
    15/09/2005
    17/09/2005
    18/09/2005
    29/09/2005The problem is:
    1)If I dont enter anything,I just get displayed 2 record for the above.
    It should display all records rather than 2.
    2)If I enter Effective date as 01-AUG-2005,no records are displayed.
    This is my code:
    Select col1,col2
    from   TableA
    where ( TRUNC(ch.eff_date) = nvl (:E_DATE, TRUNC(ch.eff_date) ) 
    AND     TRUNC(ch.eff_date, 'MONTH') = nvl (TO_DATE(:YR||:MTH,                                                                                                          'yyyymon') ,
                                               TRUNC(ch.eff_date) )
          )Shud i change the AND to OR?

  • Concatenate Date fields as month and year

    Hi,
      I want to concatenate the field bseg-augdt as month and year.
    And have to append as a seperate field (Fiscal month | fiscal year) in the output.
    Plz help me to overcome this issue.
    Thanks and Regards,
    Karthik
    Moderator message: very basic, please try yourself and search for information before asking.
    locked by: Thomas Zloch on Aug 4, 2010 1:22 PM

    Env : ORACLE REPORTS 9I
    I am passing 3 parameters to the report:
    Parameters are of type CHAR
    Report Parameters
    Year / Month :   2005 / AUG
    Effective Date :
    The colunm in table is eff_date
    eff_date
    01/08/2005
    02/08/2005
    03/08/2005
    15/09/2005
    17/09/2005
    18/09/2005
    29/09/2005The problem is:
    1)If I dont enter anything,I just get displayed 2 record for the above.
    It should display all records rather than 2.
    2)If I enter Effective date as 01-AUG-2005,no records are displayed.
    This is my code:
    Select col1,col2
    from   TableA
    where ( TRUNC(ch.eff_date) = nvl (:E_DATE, TRUNC(ch.eff_date) ) 
    AND     TRUNC(ch.eff_date, 'MONTH') = nvl (TO_DATE(:YR||:MTH,                                                                                                          'yyyymon') ,
                                               TRUNC(ch.eff_date) )
          )Shud i change the AND to OR?

  • F4 help for month and Year field in ztable please

    I have created a ztable. 
    The first field in my ztable is a primary key field and it holds MM/YYYY(eg.  08/2011).
    How ever my requirement is when ever we want to see the output, uer wants F4 help on that fields and when he selects the range , the ztable should display the values in that range.
    For eg.
    1). if user selects   01/2011  to 08/2011 using F4 Help,
    2). then the ztables should display all the records in that range.
    Thanks in advance for your help.
    Best regards,Sam
    Moderator message : Spec dumping / Outsourcing is not allowed.  Thread locked.
    Edited by: Vinod Kumar on Aug 8, 2011 11:17 AM

    Hi Sam,
    Create an F4 help using this FM
    l_t_date" has month and date
    l_f_programm = sy-repid.
        l_f_dynnr    = sy-dynnr.
        CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
          EXPORTING
            retfield         = 'Date'"Field name of coloum of value tab
            dynpprog         = l_f_programm
            dynpnr           = l_f_dynnr
            dynprofield      = <>"Screen field name'
            value_org        = 'S'
            callback_program = l_f_programm
            callback_form    = ''
          TABLES
            value_tab        = l_t_date"Value table for date and month
    *      FIELD_TAB        = L_T_RETURN
            return_tab       = l_t_return_tab
          EXCEPTIONS
            parameter_error  = 1
            no_values_found  = 2
            OTHERS           = 3.
        READ TABLE l_t_return_tab INDEX 1.
        IF  sy-subrc = 0 .
        <fields> = l_t_return_tab-fieldval.
        ENDIF.
    Regards,
    Amit
    then filter the ztable accordingly

  • FM for month and year to Fiscal year period

    Hello ABAP Experts,
    Please suggest a FM to convert month+year to fiscal year period.
    Suggestions appreciated.
    Thanks in advance,
    BWer

    use the function moduleGM_GET_FISCAL_YEAR
    pass date and fiscal year variant as 24..
    see all the values of the fiscal year variant in the table T009
    Check with fm FI_PERIOD_DETERMINE
    Thanks
    Seshu

  • 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

  • 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());

  • Need Batch Expiry in month and year

    Hi all
    Is there any facility in SAP where I can map product batch expiry in month and year only ? or is there any facility for PLD on AR invoice where I can design expiry date in only month and year
    Kindly Advise
    Thanks

    Hi,
    Yes you can add expiry date while receiving the items through stock receipt or GRPO or receipt from production.
    Why do you need only mm/yy in PLD?
    Thanks & Regards,
    Nagarajan

  • Returning  'Day' value based on month and year parameters

    Hi,
    Is there a code that would return an end of the month  Day value based on month and year parameters?
    For example if my parameters yield 9 or September for a month value and 08 or 2008 for the year value, can a formula generate a value of 30 (the last day of the given month in the specific year)?
    This way the formula would pick up the different last day of the month in February for the leap years.
    Thank you.
    Vic

    1. Open the formula workshop.
    2. From the Repository Custom Functions, under Crystal and then Date, RIGHT click on cdlastdayofmonth, click on ADD TO REPORT.
    3. Create a new formula, in the formula workshop, under FUNCTIONS, go down the list till you see "CUSTOM FUNCTIONS", expand that till you see cdlastdayofmonth.
    4. In your formula, type cdlastdayofmonth(currentdate)
    5. Save and close and display the formula in your report, you should see 11/30/2008.
    If you want just the day then modify the formula to:
    totext(day(cdlastdayofmonth(currentdate)),0,'','');
    since you have parameters for month and year, do this:
    totext(day(cdlastdayofmonth(date({?year},{?month},01))),0,'','');
    to give you the last day of the month.

  • How to save and month and year wise values

    Hi friends,
    in my ztable i have to enter values manually for month and year wise..
    so i have to create parameter for month and year how to create it.
    in my parameter month and year fields..
    once he given month and year  then he should enter values for fields..
    i have doubt how to give parameter for this...table..
    example: month: 1
                 year : 2007
    after that user enter values for following fields.
           kunnr
           name
           core values
           noncorevalues
    above fields user will enter values month wise ..
    once he enter the values for january it should save ...
    next he enter values for february and it will save..
    when ever he want to see the january month data how can he see..
    is there any logic for the above problem...

    Hai venkat,
    I am not totally clear with your question some how i understood. I give my opinion may be it ll help ful to you.
    In your ztable you want to enter the values for the fields kunnr, name, core values ,noncorevalues as per month. 
    As i say in your ztable add another field as  month  with other 4 fields. Provide the table maintenance for your table or else in se11 -> table display ->utilities -> table contents -> create entries is one way.
    If you proivided  maintenance for your table go to SM30. where you can manually enter values .
    <b>reward if useful</b>
    Regards,
    sunil kairam.

  • Find the difference between two dates for the specific month and year

    Hi,
    I have two dates, start date is 30/12/2012 and end date is 04/01/2013. Using datediff I found the difference of days between two dates. But I find the no of days in January 2013. ie output is 4 instead of 6. I input month and year to find the no of days
    for that date. In this case I input Jan 2013. How can I sql this ?

    I don't understand how most of the answers provided here not analytically solving the problem with many cases possible.
    First let me understand you:
    You have 2 dates range and you want to calculate day range for specific month and year between the original date range.
    declare @for_month int = 1 --January
    declare @for_year int = 2013
    declare @StartDate date = '2012-12-20'
    declare @EndDate date = '2013-01-04'
    SELECT
    CASE
    WHEN (DATEPART(MONTH, @StartDate) = @for_month and DATEPART(MONTH, @EndDate) = @for_month) and ((DATEPART(YEAR, @StartDate) = @for_year or DATEPART(YEAR, @EndDate) = @for_year)) THEN
    DATEDIFF(DAY, @StartDate,@EndDate)
    WHEN (@StartDate < cast(CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) and (@EndDate between (cast(CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) and (cast(DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) + 1, 0)) as date))) THEN
    DATEDIFF(DAY, DATEADD(MONTH, DATEDIFF(MONTH, -1, @EndDate)-1, 0),@EndDate)
    WHEN (@EndDate > cast(DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) + 1, 0)) as date)) and (@StartDate between (cast(CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) and (cast(DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) + 1, 0)) as date))) THEN
    DATEDIFF(DAY, @StartDate,DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, @StartDate) + 1, 0))) + 1
    WHEN ((DATEDIFF(DAY, @StartDate, cast(DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) + 1, 0)) as date)) >= 0) and (DATEDIFF(DAY, cast(CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date), @EndDate) >= 0)) THEN
    DATEDIFF(DAY, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as datetime), DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as datetime)) + 1, 0))) + 1
    ELSE
    0
    END as [DD]
    I don't know how you calculate day range between 01/01/2013 and 04/01/2013
    is 4, it is actually is 3 but if that is the case, you can add 1 from the condition.

Maybe you are looking for