Problem to insert only month and year instead of full date

select b.penjara_id, p.penj_lokasi, a.no_daftar, b.episod, b.nama1,to_char(a.trkh_mula_prl,'dd/mm/yyyy') as trkh_mula_prl, to_char(bulan_proses,'mm/yyyy') as bulan_proses,
        b.epd, b.lpd
from prl_daftar_proses a, senarai_pesalah b, penjara p
where a.no_daftar=b.no_daftar
and a.episod=b.episod
and b.penjara_id = p.penjara_id
and a.setuju_jplp is null
and a.bulan_proses between to_date(:FROM,'dd/mm/yyyy') and to_date(:TO,'dd/mm/yyyy')
order by b.penjara_id, a.bulan_proses,a.no_daftarHi,anyone can help me how i can insert only month and year from the value that have full date in the database??
for example,the date is 09/18/2012, but i just want to insert 09/2012 as parameter. If i want to insert only one parameter, i can do that..But i have problem when I want to insert two parameters..

jeneesh wrote:
Welcome to the forum..
This..?
Assuming bulan_proses is a date without time part
select b.penjara_id, p.penj_lokasi, a.no_daftar, b.episod, b.nama1,to_char(a.trkh_mula_prl,'dd/mm/yyyy') as trkh_mula_prl, to_char(bulan_proses,'mm/yyyy') as bulan_proses,
        b.epd, b.lpd
from prl_daftar_proses a, senarai_pesalah b, penjara p
where a.no_daftar=b.no_daftar
and a.episod=b.episod
and b.penjara_id = p.penjara_id
and a.setuju_jplp is null
and a.bulan_proses between to_date(:FROM,'mm/yyyy') and last_day(to_date(:TO,'mm/yyyy'))
order by b.penjara_id, a.bulan_proses,a.no_daftar
i got another problem..
before that.may i know what is the function of last_day?

Similar Messages

  • Can we modify the pnp selection screen and get only month and year?

    Dear Freinds,
                  I have requirement where i have to modify the PNP selection screen. So with the help of report category and coding in AT SELECTION-SCREEN OUTPUT  , i have modified all the fields relating to dates . i.e i have removed all the radio buttons (i.e Today, Current month,current year etc) and finally
    i have landed with only Period ( PNPBEGDA & PNPENDDA range) . But i dont want the PNPBEGDA & PNPENDDA range , but i want only is the month and year ( i.e just like the PNPPABRP & PNPPABRJ)
    on my selection screen along with the pernr .
    i have used the below code to close all the fields except pnpbegda and pnpendda.
    AT Selection-Screen output.
    loop at screen.
      IF screen-group4 = '098' .
          screen-input = '0'.
          screen-invisible = '1'.
        ENDIF.
        IF screen-group4 = '092' .
          screen-input = '0'.
          screen-invisible = '1'.
        ENDIF.
        IF screen-group4 = '094' .
          screen-input = '0'.
          screen-invisible = '1'.
        ENDIF.
        IF screen-group4 = '100' .
          screen-input = '0'.
          screen-invisible = '1'.
        ENDIF.
        IF screen-group4 = '104' .
          screen-input = '0'.
          screen-invisible = '1'.
        ENDIF.
        MODIFY SCREEN.
    endloop.
    i.e on my selection screen i want only  month & year combination and pernr -
    when iam using the logical database PNP . Could any one please let me know how can i get only mon & year only on my selection screen .
    If it is possible please let me know .
    Thanks & regards
    divya.

    Hi ,
       The requirement is that the user doesnt want to enter the date range i.e for ex:  01012008 to 31012008.
    As per the requirement the user will enter only the month and year only . so i on the selection screen
    i want only the month and year only . Is there any means i can modify the date period which is there by
    default (PNPbegda and PNPendda) on PNP selection screen. Instead of we givign to the user the
    PNPBEGDA and PNPPENDA i want is only month and year .
    AS already the code has already been written and now they have asked that they want only the month and year on the selection screen.
    Please suggest me in this regard.If iam hiding all the buttons relating the dates fields, and now if iam adding the parameters for the month and year  it is coming below below the fields pernr , personnel ara and subara , company code , payroll area, employee group of the standard fields of PNP selection screen , there by any body could please suggest me how to change.
    regards
    divya.

  • Find month and year of a given date

    Hi,
    How to find the month and year of a given date.
    month ( sy-datum)  year ( sy-datum )
    --Bala

    hi
    DATA: EDAYS LIKE VTBBEWE-ATAGE,
    EMONTHS LIKE VTBBEWE-ATAGE,
    EYEARS LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
    TODATE LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
    Call Function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
      exporting
        i_date_from          = FROMDATE
        i_date_to            = TODATE
      I_FLG_SEPARATE       = ' '
      IMPORTING
        E_DAYS               = EDAYS
        E_MONTHS             = EMONTHS
        E_YEARS              = EYEARS.
    WRITE:/ 'Difference in Days   ', EDAYS.
    WRITE:/ 'Difference in Months ', EMONTHS.
    WRITE:/ 'Difference in Years  ', EYEARS.
    INITIALIZATION.
    FROMDATE = SY-DATUM - 60.
    Using teh abiove u can get difference but when u pass previous year u wont get the exact.
    There is no seperate FM for this, u have to use three FM.
    If possible using these three FM code u can create an FM.
    For years and months between two days:
    DATA:   EYEARS  LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE PREL-BEGDA,
                     TODATE   LIKE PREL-BEGDA DEFAULT SY-DATUM.
    CALL FUNCTION 'COMPUTE_YEARS_BETWEEN_DATES'
      EXPORTING
        first_date                        = fromdate
      MODIFY_INTERVAL                   = ' '
        second_date                       = todate
    IMPORTING
       YEARS_BETWEEN_DATES               =  EYEARS
    EXCEPTIONS
      SEQUENCE_OF_DATES_NOT_VALID       = 1
      OTHERS                            = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Write:/ eyears.
    DATA:       EMONTHS LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE SY-DATUM,
                TODATE   LIKE SY-DATUM
    DEFAULT SY-DATUM.
    CALL FUNCTION 'MONTHS_BETWEEN_TWO_DATES'
      EXPORTING
        i_datum_bis         = fromdate
        i_datum_von         = todate
      I_KZ_INCL_BIS       = ' '
    IMPORTING
       E_MONATE            = emonths
    write:/ emonths
    CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
    EXPORTING
    I_DATUM_BIS = x_faede-zfbdt
    I_DATUM_VON = p_fdat
    I_KZ_EXCL_VON = '0'
    I_KZ_INCL_BIS = '0'
    I_KZ_ULT_BIS = ' '
    I_KZ_ULT_VON = ' '
    I_STGMETH = '0'
    I_SZBMETH = '1'
    IMPORTING
    E_TAGE = dias_v.
    IF SY-SUBRC <> 0.
    ENDIF.
    x_faede-zfbdt -> 20050915
    p_fdat -> 20050811
    dias_v = 4
    try this and let me know.
    regards
    ravish
    <b>plz dont forget to reward useful points</b>

  • 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

  • Problem in conversion of month and year from R/3 into 0calmonth of BI

    Hi,
    I have to convert two fields of R/3 Calendar month and year into one field of Calendar year/month of BI.
    How can i do this..... i have tried using concatenation formula in transformation rules but its not working and converting 09, 2006 into 06.2009.
    Please help me if you guys have any idea.
    regards

    Why do you want to combine CALMONTH and CALYEAR ??
    CALMONTH will give you both month and year (eg: 09.2007)
    you can directly map (R/3)KMONTH to 0CALMONTH(BI).

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

  • Can the standard datepicker show only Month and Year

    Hi All,
    My requirement is to show the Date Picker with only the Month picklist and Year picklist.
    That is there shouldnt be the date table below.
    Is it possible to show...
    Thank You,
    Sombit.

    Sombit,
    You can create a poplist and show there Month & Year. like Jan, 2009, Feb- 2009.
    Thanks
    --Anil                                                                                                                                                                                                                           

  • Only month and year

    i have a date column
    date_1
    01-jan-06
    19-feb-06
    i want to remove the date part
    date_1
    jan-06
    feb-06

    I think this is what you're after.....
    SQL> select to_char(sysdate,'Mon-RR') from dual;
    TO_CHAR(SYSDATE,'Mon-RR')
    Oct-06

  • How to get the currrent month and year from a new date object

    If I create a new Date object as "d",
    java.util.Date d = new java.util.Date();how can I format the date to get the current Month as 'Jan' and the current year as '2008'. So if I have something like d.getMonth() gets the current month as 'Oct' and d.getYear() gets '2008'
    Thanks,
    Zub

    [Read the flamin' manual you must. Hmm.|http://en.wikipedia.org/wiki/RTFM]
    ~~ Yoda.
    Well no actually, he didn't say that, but he should have.
    Cheers. Keith.
    PS: Don't say that to a 7 foot pissedOff wookie when he's got his head stuck in a smoking hyperdrive, and you're being chased by a S-class battle cruiser... Ask Yoda how he got to be so short.
    PPS: It is the SimpleDateFormat you seek ;-)
    Edited by: corlettk on 14/10/2008 22:37 ~~ Also far to slow... but funny.

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

  • 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

  • Date must be truncated to month and year

    Hi,
    I have a date field
    after the user gives F4 help I need to truncate the date , i.e I want only month and year
    For Ex.
    If the user selects as 12/12/2009
    I must display as 12/2009
    How can It be done?

    Hi,
    go thru this threads
    Re: Date validation and conversion
    Re: Is DD/MM/YYYY supported in webdynpro for abap application
    it might provide you some guidance

  • 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

  • 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

Maybe you are looking for

  • I recently reinstalled windows, no music how can I get it back? x

    I recently reinstalled windows on my computer which means I have lost all of my music files. Is there any way I can get them back?  I have one copy of the majority of the music on my i pod and the rest is (hopfully) backed up on an external hard-driv

  • Newbee-Question: Connection without RFC / SM59

    Hello! In classical R/3-Systems you have chosen a RFC-Destination to connect serveral R/3 systems together. What about Netweaver? I saw there is a Message Server, is that the point where R/3-Systems are connected together concerning netweaver technol

  • Customer related queries

    Sir,       1st we create customer invoice of Rs.100 (through fb70) Then we post customer down payment of Rs.150 (through f-29) Then we clear down payment of Rs.100 (through f-39) Now the situation is that I have to pay the customer of Rs. 50/-.      

  • Logic Pro X - an error has occurred

    Hi, I bought the new LPX yesterday, started downloading and left my MBP. When I got back I had a message saying "Can not get Logic Pro X". Among my programs in App Store I find LPX and after that it says in red letters "An error has occurred" (well,

  • Re: CALLING A UK MOBILE IN THE USA

    I have the same query, my daughter is over in america and is using a UK mobile with Skype installed, she will also be using a WiFi link, but it is still saying i need to either buy credit or subscribe. I would rather subscribe as this seems cheaper,