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

Similar Messages

  • 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

  • Pivot with Month and Year

    Hi all Thanks in Advance
    I need help in Pivoting Data
    SELECT ID,MONTH,COUNT FROM TABLE_PIVOT ORDER BY ID,MONTH
    ID     MONTH          COUNT
    10     10/01/2009     60
    10     11/01/2009     80
    10     12/01/2009     78
    10     01/01/2010     81
    10     02/01/2010     73
    10     03/01/2010     84
    10     04/01/2010     100
    10     05/01/2010     107
    10     06/01/2010     90
    10     07/01/2010     0
    10     08/01/2010     0
    10     09/01/2010     73
    20     10/01/2010     71
    20     11/01/2010     76
    20     12/01/2010     79
    20     01/01/2011     79
    20     02/01/2011     81
    20     03/01/2011     88
    20     04/01/2011     97
    20     05/01/2011     87
    20     06/01/2011     97I tried to pivot with below query
    SELECT ID,
    SUM(DECODE(to_char(month,'MM'),'01',count,0)) " Jan",
    SUM(DECODE(to_char(month,'MMYY'),'02',count,0)) Feb,
    SUM(DECODE(to_char(month,'MM'),'03',count,0)) Mar,
    SUM(DECODE(to_char(month,'MM'),'04',count,0)) Apr,
    SUM(DECODE(to_char(month,'MM'),'05',count,0)) May,
    SUM(DECODE(to_char(month,'MM'),'06',count,0)) June,
    SUM(DECODE(to_char(month,'MM'),'07',count,0)) July,
    SUM(DECODE(to_char(month,'MM'),'08',count,0)) August,
    SUM(DECODE(to_char(month,'MM'),'09',count,0)) September,
    SUM(DECODE(to_char(month,'MM'),'10',count,0)) October,
    SUM(DECODE(to_char(month,'MM'),'11',count,0)) November,
    SUM(DECODE(to_char(MONTH,'MM'),'12',count,0)) December
    FROM Table_PIVOT
    GROUP BY ID
    ORDER BY ID
    ID      Jan     FEB     MAR     APR     MAY     JUNE     JULY     AUGUST     SEPTEMBER     OCTOBER     NOVEMBER     DECEMBER
    10      81     0     84     100     107     90     0     0          73          60          80          78
    20      79     0     88     97     87     97     0     0          0          71          76          79I want output to display the column names with Month and Year like below
    ID     Oct-2009     Nov-2009     Dec-2009   Jan-2010  Feb-2010 ................... OCT-2010  NOV-2010 DEC-2010 JAN-2011 FEB-2011 ......
    10     60          80          78          81          73     ...................
    20                                                                    71           76          79     79          81
    CREATE TABLE "TABLE_PIVOT"
       (     "ID" NUMBER,
         "MONTH" DATE,
         "COUNT" NUMBER
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('10/01/2009','MM/DD/YYYY'),60);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('11/01/2009','MM/DD/YYYY'),80);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('12/01/2009','MM/DD/YYYY'),78);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('01/01/2010','MM/DD/YYYY'),81);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('02/01/2010','MM/DD/YYYY'),73);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('03/01/2010','MM/DD/YYYY'),84);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('04/01/2010','MM/DD/YYYY'),100);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('05/01/2010','MM/DD/YYYY'),107);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('06/01/2010','MM/DD/YYYY'),90);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('07/01/2010','MM/DD/YYYY'),0);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('08/01/2010','MM/DD/YYYY'),0);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('09/01/2010','MM/DD/YYYY'),73);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('10/01/2010','MM/DD/YYYY'),71);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('11/01/2010','MM/DD/YYYY'),76);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('12/01/2010','MM/DD/YYYY'),79);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('01/01/2011','MM/DD/YYYY'),79);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('02/01/2011','MM/DD/YYYY'),81);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('03/01/2011','MM/DD/YYYY'),88);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('04/01/2011','MM/DD/YYYY'),97);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('05/01/2011','MM/DD/YYYY'),87);
    Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('06/01/2011','MM/DD/YYYY'),97);
    COMMIT;

    Hi,
    user1849 wrote:
    Any Sample code is appreciated
    I didn't see any solution for following one in your linklI think Centinul was specifically referring to:
    Help for a query to add columns
    but other links from
    SQL and PL/SQL FAQ
    may help you more.
    >
    Re: How to pipeline a function with a dynamic number of columns?
    Posted: May 9, 2006 2:58 PM in response to: Billy Verreynne Reply
    Interesting stuff! It's going to take me awhile to digest it.
    For what it's worth, I was trying to build a pivoting function that would take a MYTABLE table like this:
    YEAR CITY X Y
    2000 BAL 95 96
    2000 BOS 101 101
    2001 BAL 92 94
    2001 BOS 101 101
    2002 BAL 98 98
    2002 BOS 98 99
    2003 BAL 95 96
    2003 BOS 105 104
    and allow me to do something like:
    CREATE VIEW MYPIVOT
    AS
    SELECT *
    FROM TABLE (PIVOT(MYTABLE, [with other params]))
    and get the following view MYPIVOT on the table:
    YEAR BOS_X BOS_Y BAL_X BAL_Y
    2000 101 101 95 96
    2001 101 101 92 94
    2002 98 99 98 98
    2003 105 104 95 96
    Where the number of distinct CITY values will vary over time. I am able to build the query I need dynamically, but since the CITY data values in the original table change, the columns are not necessarily static from invocation to invocation. Therefore I didn't want to just create a view using the dynamic SQL once, because it may need to be created next time I need to access the view. I wanted to be able to access the pivoted data on demand.A pipelined function is your best bet for that.
    I couldn't do was be able to execute the query and treat it as a pipelined function, hence my original question.Sorry, I don't understand.
    I'll dig into the code above to see if it does what I wanted, but if someone has a better suggestion on how to approach this, I'd be interested in hearing it.A completely different approach is String Aggregation , where you would get output like this:
    YEAR  TXT
            BOS_X    BOS_Y    BAL_X    BAL_Y
    2000      101      101       95       96
    2001      101      101       92       94
    2002       98       99       98       98
    2003      105      104       95       96Note that this output contains 6 rows and 2 columns. On the first row, year is NULL and txt='  BOS_X    BOS_Y    BAL_X    BAL_Y'. You can do this is pure, static SQL, without knowing the number of cities in advance.

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

  • Calculating previous month and year of the previous month

    Hi frenz,
    Can anybody know FM to calculate the previous month and year of the previous month.
    are there any standard FMs existed to achieve this?
    br,
    anil.

    hi,
    lv_period gives the month and year which is two months earlier now as we have specified lv_months as -2.
        DATA: LV_PERIOD LIKE S001-SPMON,
              LV_MONTHS(2) TYPE C VALUE '2-',
              LV_DATUM LIKE SY-DATUM,
              LV_NEWDT LIKE SY-DATUM,
            P_SPMON LIKE S001-SPMON VALUE '200601'.
        CONCATENATE P_SPMON '01' INTO LV_DATUM.
        LV_PERIOD = P_SPMON+0(6).
        CALL FUNCTION 'MONTH_PLUS_DETERMINE'
             EXPORTING
                  MONTHS  = LV_MONTHS
                  OLDDATE = LV_DATUM
            IMPORTING
                 NEWDATE = LV_NEWDT
             EXCEPTIONS
                  OTHERS  = 1.
         IF SY-SUBRC = 0.
           LV_PERIOD = LV_NEWDT+0(6).
         ENDIF.
    WRITE :/ LV_PERIOD.
    Regards,
    Sailaja.

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

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

  • How to get Week,Month and Year details from a date column

    Hi frenz,
    I've a column like tran_date which is a date column..... I need the next week details based on this column and so on...
    I need month and year details as well based on this tran_date column.... can any one tell me how...
    Thanks in advance

    My example for objects:
    create or replace type date_object as object
      centure number,
      year    number,
      month   number,
      day     number,
      hour    number,
      minute  number,
      second  number,
      daypart number,
      week    number,
      constructor function date_object(p_dt date)
        return SELF as result
    create or replace type body date_object is
      constructor function date_object(p_dt date)
        return SELF as result
      as
      begin
        SELF.centure:= trunc(to_char(p_dt,'YYYY')/100);
        SELF.year:=    to_char(p_dt,'YYYY');
        SELF.month:=   to_char(p_dt,'MM');
        SELF.day:=     to_char(p_dt,'DD');
        SELF.hour:=    to_char(p_dt,'HH24');
        SELF.minute:=  to_char(p_dt,'MI');
        SELF.second:=  to_char(p_dt,'SS');
        SELF.daypart:= p_dt-trunc(p_dt,'DD');
        SELF.week:=    to_char(p_dt,'IW');
        return;
      end;
    end;
    select date_object(sysdate),
           date_object(sysdate).year
    from dual;Regards,
    Sayan M.

  • 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

  • Daily, Monthly, and Yearly Report

    Hi I am new to the BAM. I have a BPM process. I want to generate the daily, monthly and yearly report for it. Please advise how can I achieve it. I have a one dimension variable on the process.
    Thanks in advance!

    Hi,
    Try this query to get default ware house and its quantity and modify above query.
    SELECT T0.[ItemCode], T0.[WhsCode], T0.[OnHand] FROM OITW T0  INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode WHERE T0.[WhsCode] =  T1.[DfltWH] and  T1.[ItemCode]  = [%0]
    Thanks & Regards,
    Nagarajan

  • Table for Material Quantity and Value for particular month and year

    Hi All
    My requirement is that for a particular month and year I want to know the stock quantity and stock value for a particular material for a given plant.From which SAP table can I get this data as I want to fetch data for my Y report?
    Regards
    Satish Kumar

    Hi,
    You can use MB5B table as suggested earlier.also you can use:
    MBEW-VMKUM --> stock for previous month period
    MBEW-VJKUM --> stock for previous year period
    PLease view these links which migh tbe helpful to you:
    http://help.sap.com/saphelp_47x200/helpdata/en/39/55fee3bc6111d4b3960050dadf0791/content.htm
    TableStock
    Thanks
    Nisha

  • Fetching month and year from CV of Time dim

    Hi,
    I am working on BPC 7 MS version, SP3. I need to fetch Month and Year values from my Current View (i.e., %TIME_SET%) .... and if the month is AUG and year is Current I then want a logic to run... Is this possible??
    I have written the following code, and only if i hardcode the time (WHEN TIME IS 2009.AUG) the logic seems to work. But I want it to be dynamic
    *XDIM_MEMBERSET ACCOUNT=INC_REC_IN_AD
    *XDIM_MEMBERSET TIME=%YEAR%.AUG,%TIME_SET%
    *XDIM_MEMBERSET CATEGORY=ACTUAL
    *WHEN ACCOUNT
    *IS *
    *WHEN TIME.MONTHNUM
    *IS 8
    *FOR %YEAR%=%TIME_SET%.YEAR
    *FOR %MONTH%=AUG,SEP,OCT,NOV,DEC
    *REC(FACTOR=1/5,TIME="%YEAR%.%MONTH%",ACCOUNT="TEMPSTUDYEDU")
    *NEXT
    *NEXT
    *ENDWHEN
    *ENDWHEN
    *COMMIT
    Thanks,
    Prasanth.

    I think your formula is correc the %YEAR% is not a valid, Can you trap that and see what is being passed, you may also try to split the year out of %TIME%
    hope it helps.

  • Month and Year in Input Field

    Hi Gurus,
    I m Using SPMON(Period to analyze month and year) as input Field in my BSP Application.
    If i Click the Input Help i want to call a Function module "popup_to_display_month" ..
    How to acheive this.
    I have used onValueHelp attribute in which it will call only the Javascript.
    Please guide me...
    Thanks n Regards
    Aravindh

    Hi Aravindh,
    First thing if this FM 'POPUP_TO_SELECT_MONTH' gives a popup in SAPGUI , you can not use it in BSP since SAP GUI popups are not supported in BSP.
    I have used onValueHelp attribute in which it will call only the Javascript.
    If triggering a server side event using onValueHelp solves you  problem that you can do it as follows..
    1)In the layout somewhere use a blankimage that will not be visible in UI.
    2)Suppose ID of this image is 'blank'
    now call javascript function for onValueHelp
    and in this javascript function use
    dacument.getElementById('blank').click();
    change dacument to document.
    This will trigger a server event which you can process in onInputProcessing and call the FM.
    Regards,
    Anubhav

  • 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

  • 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

Maybe you are looking for

  • Problem with Net Service name

    while installing oracle data warehouse builder 10g i am getting prob such tat INS0009:Unable to connect to the database with user SYS java.sql.SQLException:Io exception : could not resolve the connect identifier OraHome_1\network\ADMIN\SAMPLE\TNSNAME

  • Sending and receivind ADC coefficients from/to soundcard in VBA for Excel 2010

    How to send  and receive ADC coefficients from/to soundcard(mixer,microphone)     in VBA for Excel 2010   (noncom. edition, x64)   to Excel macros for DFT (from IDFT), IIR , user defined samples parser   (special noise generator, graphic s(t),S(jw),

  • Switching from PC to Mac / iTunes: Rating is Gone....

    Irecently switched to Mac and got back my old library using latest itune version but my Ratings is gone... Have more than 3.000 songs and lost all the ratings now... Is there a way to get it back from my old PC Files in iTunes??? Thanks

  • Crystal Reports 2008 SP5

    Wasn't sure this was the best place to post this....apologies if it is a mispost I recently downloaded and attempted to install SP5 (12.5.0.1190) for Crystal Reports 2008 (12.3.6.1006/SP3.6). What I got was a message of the sort "Another version of t

  • Meaning of status message

    Hi, Whenever i place the cursor on HD00 line and press the pushbutton for condition records in VA02 i'm getting a message saying below "Condition type HD00 is not determined using condition records". What do you mean by this message? Thanks & Regards