Re:regarding date function:urgent

Hi,
        below is my code, i need to run monthly report, s_wadat is select-option variable, if i give 06/26/2003 i should get from month 05/01/2003 to 05/31/2003 data, my below code is working for current year only(2007 only), how to modify
    data: last_month_last_day like S_WADAT.
last_month_last_day =  S_WADAT  .
last_month_last_day+6(2) = '01'.
last_month_last_day = last_month_last_day - 1.
*write:/ last_month_last_day.
data : date1 like S_WADAT.
date1 = last_month_last_day .
date1+6(2) = 01.   "set the date to first of month
*write:/ date1.
SELECT  LIKP~VBELN
          LIKP~WADAT_IST
          KNA1~NAME1
          LIPS~MATNR
          LIPS~CHARG
          LIPS~LFIMG
          LIPS~WERKS
          VBKD~BSTKD
                  INTO CORRESPONDING FIELDS OF TABLE ITAB
                  FROM LIKP
                  JOIN LIPS ON LIKPVBELN = LIPSVBELN
                  JOIN VBKD ON LIPSVGBEL = VBKDVBELN
                  JOIN KNA1 ON KNA1KUNNR = LIKPKUNNR
              WHERE LIPS~LFIMG GT 0 AND
                    LIKP~KUNAG IN S_KUNAG AND
                   LIKP~WADAT_IST between date1 and last_month_last_day
                  AND   "S_WADAT-low and S_WADAT-high  AND
                   LIKP~VBELN IN S_VBELN
              ORDER BY LIKP~WADAT_IST
                       LIKP~VBELN.

Hi,
The following code i used find last day of last month from sy-datum.
May this one help you
data: date1 like sy-datum.
parameters: p_date like sy-datum default sy-datum.
p_date+6(2) = 01.
date1 = p_date - 1.
aRs

Similar Messages

  • Regarding Date Function

    Hi All,
    Hi i want to implement the functionality as below, if i gave the Date as Input then i have to get the Respective Timezones is it possible, if yes then can u plz produce a sample snippet of it.
    With Regards,
    Justin

    java.text.SimpleDateFormat to parse and format a date in any time zone.

  • Regarding date function module

    Hi abapers,
    We have one requirement in selection screen validation.
    From date is Day 1 of the next period(month).
    To date is Day 1 of the next period*(month) + (next) 3 months.
    which function module we can use.
    how we can pass the selection screen of this date.
    Thanks
    Nani.

    Hi
    Why we need the fun module
    Just write the code as
    select-options : s_date for sy-datum no display.
    data: date like sy-datum, fdate like sy-datum, tdate is like sy-daum, mon(2),
           mon1(2), mon2(2), year(4).
    date =  sy-datum.
    year = date+0(4).
    mon = date+4(2).
    mon1 = mon + 1.
    mon2 = mon + 3.
    concatenate year mon1 '01' into fdate.
    concatenate year mon2 '01' to tdate.
    use the fdate and tdate and write the code
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Date function: urgent : please help

    This is the problem statement.:
    Problem: Given two dates (during the years 1901 and 2999, inclusive), find
    the number of days between the two dates.
    Input: Two dates consisting of month, day, year. For example, the inputs
    '6, 2, 1983' and '6, 22, 1983' represent the date range June 2, 1983 to
    June 22, 1983.
    Output: The number of days between the given dates, excluding the starting
    date and the ending date. For example, there are 19 days between June 2,
    1983 and June 22, 1983; namely, June 3, 4, ..., 21.
    Test Input (3 sets):
    Input Line #1: 6, 2, 1983, 6, 22, 1983
    Output #1: 19
    Input Line #2: 7, 4, 1984, 12, 25, 1984
    Output #2: 173
    Input Line #3: 1, 3, 1989, 3, 8, 1983
    Output #3: 1979
    ==========
    I have a GregorianCalender function that works. But I want to use a basic java function that can solve the above problem.
    regards
    ~m

    Here is the code that uses the Gregorian Funtion. Does anybody know of anything basic that replaces what gregorian does in this case.
    import java.util.*;
    import java.io.*;
    import java.math.*;
    import java.text.*;
    import java.lang.*;
    public class Days {
         static int year1,month1,day1;
         static int year2,month2,day2;
         public static void main(String[] args) throws Exception{
              parse(args);
              GregorianCalendar gc1 = new GregorianCalendar(year1, day1, month1);
              GregorianCalendar gc2 = new GregorianCalendar(year2, day2, month2);
              DateFormat df1 = DateFormat.getDateInstance();
              DateFormat df2 = DateFormat.getDateInstance();
              try {
                   Days ds = new Days();
                   ds.getDays(gc1, gc2);
                   System.out.println("Output #: " + (ds.getDays(gc1, gc2) - 1));
              } catch (java.lang.IllegalArgumentException e) {
                   System.out.println("Unable to parse");
         // validate input values,
              // if input parameters are not correct and not in a proper format
              // then throw an exception
         private static void parse(String[] args) throws Exception{
              boolean flag = true;
              if(args == null) output();
              if(args != null && args.length != 2) output();
              validate(args);
              return;
         private static void output() throws Exception{
                   throw new Exception("Input arguments are not correct. You should pass "+
                                            "two input dates with a space such as 1901,1,1 2999,1,1");
         private static void validate(String[] args) throws Exception{
              String arg1 = args[0];
              String arg2 = args[1];
              System.out.println(arg1);
              System.out.println(arg2);
              java.util.StringTokenizer tokenizer = new StringTokenizer(arg1,",");
              if(tokenizer.countTokens() < 3) output();
              String year1AsString = tokenizer.nextToken(",");
              String month1AsString = tokenizer.nextToken(",");
              String day1AsString = tokenizer.nextToken(",");
              year1 = getInt(year1AsString,4);
              month1 = getInt(month1AsString,2);
              day1 = getInt(day1AsString,2);
              java.util.StringTokenizer tokenizer2 = new StringTokenizer(arg2,",");
              if(tokenizer2.countTokens() < 3) output();
              String year2AsString = tokenizer2.nextToken(",");
              String month2AsString = tokenizer2.nextToken(",");
              String day2AsString = tokenizer2.nextToken(",");
              year2 = getInt(year2AsString,4);
              month2 = getInt(month2AsString,2);
              day2 = getInt(day2AsString,2);
         private static int getInt(String string, int maxLimit) throws Exception{
              if(string.length() > maxLimit) output();
              int temp = 0;
              try{
                   temp = Integer.parseInt(string);
              }catch(NumberFormatException e){
                   output();
              return temp;
         public int getDays(GregorianCalendar g1, GregorianCalendar g2) {
              int elapsed = 0;
              GregorianCalendar gc1, gc2;
              if (g2.after(g1)) {
                   gc2 = (GregorianCalendar) g2.clone();
                   gc1 = (GregorianCalendar) g1.clone();
              } else {
                   gc2 = (GregorianCalendar) g1.clone();
                   gc1 = (GregorianCalendar) g2.clone();
              gc1.clear(Calendar.MILLISECOND);
              gc1.clear(Calendar.SECOND);
              gc1.clear(Calendar.MINUTE);
              gc1.clear(Calendar.HOUR_OF_DAY);
              gc2.clear(Calendar.MILLISECOND);
              gc2.clear(Calendar.SECOND);
              gc2.clear(Calendar.MINUTE);
              gc2.clear(Calendar.HOUR_OF_DAY);
              while (gc1.before(gc2)) {
                   gc1.add(Calendar.DATE, 1);
                   elapsed++;
              return elapsed;
    ~m

  • Query regarding Date Function

    All,
    Can I know the difference between the following two queries
    select TO_CHAR(TRUNC(sysdate),'dd-mon-rr') from dual;
    select TO_CHAR(TRUNC(sysdate),'dd-mon-yy') from dual;
    However, both the query gives the same result as '03-nov-09'.
    Regards
    ND

    ...of which century?
    SQL> var dt varchar2(10)
    SQL>
    SQL> begin
      2     :dt := '03-11-51';
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select TO_CHAR(to_date (:dt, 'dd-mm-rr'),'dd-mon-yyyy') from dual;
    TO_CHAR(TO_DATE(:DT,
    03-nov-1951
    SQL>
    SQL> select TO_CHAR(to_date (:dt, 'dd-mm-yy'),'dd-mon-yyyy') from dual;
    TO_CHAR(TO_DATE(:DT,
    03-nov-2051Don't use a two digit year...

  • Problem regarding data function 'SUMGT' (Overall Result) in BEx query desig

    Hi,
    I have created one query where I want to see the inventory data month wise. That's why at first I have placed 0calmonth (with variable) in column, secondly kept all the key figures which I want to see month wise under one structure, then placed the structure under 0calmonth in column. Now in that structure I have one key figure like 'total stock' and another global calculated key figure '% of total inventory' (='total stock' <b>%A</b> <b>SUMGT</b> 'total stock').
    Now the problem is when ever I'm giving the value of month from 02.2006 to 05.2006, it is calculating the value of '% of total inventory' for every month with respect to the overall result of 'total stock' for month 05.2006. 
    But I want to calculate the value of '% of total inventory' for each month with respect to the overall result of 'total stock' for corresponding month.
    Please suggest what I'll do now.
    Thanks,
    Arijit.

    Hi,
    now i got whats the issue is.
    Check aggregation properties of 'total stock'(RSD1>provide tech name of total stock>display-->aggragation tab)...
    Exception aggregation would have been set to <b>'Last Value'</b> with some time char as aggregation ref characteristic..
    That is the reason why  SUMGT (or %SUMGT) is calculating on Last value of the 0calmonth interval.
    i.e if you provide 02.2006 to 07.2006, %of total inventory for every month would be with respect to value of 07.2006...
    Hope this helps...
    Dont forget to reward if it helps!
    thanks
    Message was edited by: Murali

  • SQL Date Function

    Hi
    I have problem regarding date function in the following statment and unable to sort out the real cause as yet, i am not finding any materail for using date function in sql where clause any one can help me why is it.
    Sector Table
    Sect_Id Varchar2(2),
    Sect_name Varchar2(100),
    Wef Date
    :Adate--->Forms Field ,Datatype --->Char(11)
    Trigger Post-Query <Block Level>
    BEGIN
    SELECT SECT_NAME INTO :SECTORNAME FROM SECTOR     
    WHERE SECT_ID=:SECTOR
    AND TO_DATE(WEF,'MON-YYYY')=TO_DATE(:ADATE,'MON-YYYY');
    EXCEPTION WHEN NO_DATA_FOUND THEN
    MESSAGE ('DEFINE SECTOR SETUP...');
    MESSAGE ('DEFINE SECTOR SETUP...');
    END;
    FRM-40735: POST-QUERY trigger raised unhandled exception ORA-01843.
    Any help in this regard.
    Thanks in advance

    TO_DATE converts from a character string such as '2004-11-24' into an Oracle DATE. If you pass it an Oracle DATE, it first converts it to a character string using the default date format, then converts that back into a date. This is not only inefficient but unsafe, since the default date format can change, breaking your code.
    TO_CHAR converts from various datatypes into a VARCHAR2 string. When converting from an Oracle DATE, it can provide the output in a variety of formats.
    It's worth bookmarking the Oracle Documentation Library:
    10g: download-west.oracle.com/docs/cd/B14117_01/nav/portal_3.htm
    9i: otn.oracle.com/pls/db92/db92.docindex
    TO_DATE(WEF,'DD-MON-YYYY')=TO_DATE(:ADATE,'YYYY-MM-DD');WEF is already a date. If you want to remove any time portion, use TRUNC(wef).

  • Regarding dates.

    hi gurus, i have some doubt regarding dates function.
    if i enter any date of present month i wand the first date of next month.
    for example  if i enter any date in january from 01/01/2007  to 31/01/2007 i want
    first date of february. ie 01/02/2007. plz help me.
    regards
    vamsi.

    Hi
    use this coding
    data : d1 type sy-datum,
            d2 type sy-datum,
            d3 type sy-datum,
            d4(8),
            m(2),
            y(4).
    d1 = sy-datum.
    CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
      EXPORTING
        I_DATE        = d1
    IMPORTING
       E_DATE        =  d2 .
    write :   d1.
    skip 3.
    m = d2+4(2).
    y = d2+0(4).
    concatenate  y m '01' into d4  .
    d3 = d4.
    write : / d3.
    write : / d2.
    write / '***********2 month****************************'.
    d3 = d2 + 1.
    CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
      EXPORTING
        I_DATE        = d3
    IMPORTING
       E_DATE        =  d2 .
    write :/ d3,
            / d2.
    write / '**************3 month ***************************'.
    d3 = d2 + 1.
    CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
      EXPORTING
        I_DATE        = d3
    IMPORTING
       E_DATE        =  d2 .
    write :/ d3,
            / d2.

  • Urgent regarding Data & Task Audits Back Up

    Hi Experts
    Here my question is regarding Data Audit and Task audits in V 11.1.2.1
    -->If we take the back up of Data & Task audit tables data in to other backup_tables in same schema how this can be viewed through task audit and data audit through HFM?
    -->Whether any third part tools available to audit the tasks (DATA & TASK ) information...?
    -->Whether EPM maestro can be used here..?
    Thanks in advance
    Edited by: RajaKK on May 29, 2012 6:19 PM

    Use the Audit Extract utility bundled with HFM 11.1.2.1 to export this information periodically to a CSV file that you can view offline through any text editor, or even Excel. There is a command line feature for this as well, so you could incorporate this into a batch routine.
    For anyone attending Kaleidoscope in San Antonio, TX next month, I will present the various utilities that ship with HFM including this one. Hope to see you there!
    --Chris                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to guarantee that all events regarding Data Cache are dispatched when application is terminating? Urgent

    Hello,
    we have the phenomena that when an application is commiting a transaction and then terminating,
    often not all events regarding Data Cache are dispatched by the TCP kodo.RemoteCommitProvider.
    It seems that the JVM on termination is not waiting until RemoteCommitProvider has dispatched all events regarding Data
    Cache. In this way we sometimes loose some cache synchronization and some of our customers run into serious problems.
    Is there a way to guarantee that all Data Cache events are dispatched before the aplciation terminates
    (maybe implementing a shutdown hook?).
    best regards
    Guenther Demetz
    Wuerth-Phoenix SRL

    Hi,
    as nobody answered to my question I try to explain it more simple:
    Are the TCP-kodo.RemoteCommitProvider threads acting as user threads or as threads of type 'deamon' ?
    I hope that soon someon can answer
    best regards
    Guenther Demetz
    Wuerth-Phoenix SRL
    G.Demetz wrote:
    Hello,
    we have the phenomena that when an application is commiting a transaction and then terminating,
    often not all events regarding Data Cache are dispatched by the TCP kodo.RemoteCommitProvider.
    It seems that the JVM on termination is not waiting until RemoteCommitProvider has dispatched all events regarding Data
    Cache. In this way we sometimes loose some cache synchronization and some of our customers run into serious problems.
    Is there a way to guarantee that all Data Cache events are dispatched before the aplciation terminates
    (maybe implementing a shutdown hook?).
    best regards
    Guenther Demetz
    Wuerth-Phoenix SRL

  • Pl/sql Year to Date Function

    Dear All!
    Its very urgent task for me. i'm working on Oracle discoverer. i'm creating Project Year to Date report. i need one year to date function. i've only period name. The scnerio is this, in our company financial year is starting from (April to March i.e 01-April-2011 to 31-mar-2012). i need to apply YTD function on Period name. when any user select any period it will show from 01-apr-2011 to select mont. for example if user select Feb-12 then it must be from 01-apr-2011 to 29-feb-2012.
    Please this is urgent.. give Query for function. please
    Regards
    Ahmed....

    Hello,
    Can you put an example on apex.oracle.com and provide a link, it will be much easier to help you out?
    Regards,
    Carl
    blog : http://carlback.blogspot.com/
    apex examples : http://apex.oracle.com/pls/otn/f?p=11933:5

  • Data Federator Universe Date Functions

    Hi,
    I created a Data Federator Universe from target tables (Source Tables from: Sql Server 2005 and Oracle 10g). Now, I want to create a object in the universe: "Days between 2 dates"(coming from 2 different target tables). I don't see any other date functions other than CURDATE(). How to create my object?
    Alternatively, Can I create a caliculated column in the existing target table? For Example, I want to create a new column "Days between 2 Dates" from 2 different tables by using a formula in Default mapping of the target table.
    Thanks & Regards,
    Peter

    Hi Amit,
    Thanks for your reply.
    Ok. So, Universe on top of Data Federator has limited functionality.
    And, other option you mentioned is on report level. I am creating an adhoc universe and I have few objects which will calculate days between 2 dates coming from 2 different tables.
    But, how can I achieve this on Data Federator level. I have no function there to find Days Between 2 dates. I see lot of time and date functions but not the one I required. Also, I added a column in the target table and tried to apply the formula there in the default mapping area. But, I see only the selected target table. I need another date column from another table, which is not displayed in the default mapping area.
    How can I achieve this?
    Regards,
    -Peter

  • Date function doesn't work in Message Subject when scheduling batch

    Hi,
    When I was scheduling a batch and went to PDF attached E-Mail panel, in the Message Subject line I added a function <<Date(yyyy-MM-dd)>>,but when the email was sent, the date function in the subject didn't show the actual date, just showed the original function text <<Date(yyyy-MM-dd)>>, Is there anyone can help on this? Thanks in advance.

    Hi,
    Can I know the Hyperion Version you referring ?
    regards,
    Harish.

  • DATE function to get name of day for a Date given?

    hi guys,
    can anyone tell me what is the DATE function to get the name of day for a date given
    (12/dec/2004)---returns SUNDAY

    Hi peter
    Your Query will return an error.
    SQL> select to_char(to_date('12/dec/2004', 'mm/mon/yyyy'), 'DAY')from dual;
    select to_char(to_date('12/dec/2004', 'mm/mon/yyyy'), 'DAY')from dual
    ERROR at line 1:
    ORA-01816: month may only be specified once.
    month is specified twice.
    select to_char(to_date('12/dec/2004', 'dd/mon/yyyy'), 'DAY')from dual;
    Regards
    Sasidhar.P

  • Date function in XSLT

    Hi All,
    I am trying to use date function in XSLT, I am using the below code, please correct me if i am wrong
    <corecom:EffectiveDate>
    <xsl:value-of select='xp20:format-dateTime(ns0:Segment-DTM/ns0:Element-373,"[YYYY][M01][D01]")'/>
    </corecom:EffectiveDate>
    Regards
    Francis

    Hi Francis,
    It doesn't seem to be anything wrong with the code itself, but what's the content of ns0:Segment-DTM/ns0:Element-373 ???
    The xp20:format-dateTime function will work if the date on the first parameter is on ISO 8601 format...
    http://www.w3.org/TR/NOTE-datetime
    Examples
    1994-11-05T08:15:30-05:00 corresponds to November 5, 1994, 8:15:30 am, US Eastern Standard Time.
    1994-11-05T13:15:30Z corresponds to the same instant.
    Cheers,
    Vlad

Maybe you are looking for

  • Wrong Calculation of Custom Duty for Import PO

    Dear Experts, We have made one PO for Import and after that we have made custom duty for the same PO and then we have captured the excise invoice through J1iex T.code. But when we have posted the MIGO it is calculating wrong custom duty that particul

  • Secondary Index Picked with one field short in select query

    Hi, We have a select query as follows select  single lgort       vgbel        vgpos     into   (lips-lgort,lips-vgbel,lips-vgpos)     from    lips    where         vbeln          Eq p_zlcpp-vbeln      and         matnr          Eq p_zlcpp-matnr     

  • Is this sleep light behavior normal w/ a MacBook Pro?

    This is the deal. I just purchased a new MacBook Pro 2.4GHz Intel core 2 Duo and I've noticed that the 'sleep light' comes on and stays on when I have my Cinema Display plugged in with the laptop cover closed down (so, therefore, I'm using just the e

  • How can i install the web connector in the IWS for IAS SP3?

    i have installed the IAS 6.0 SP3 and IWS 6.0 on two different NT server. How do i install the web connector to the IWS. How can i access the IAS form the IWS. The IAS 6.0 SP3 Evaluation does not allow to install only the web connector componet. Pls a

  • Good Signal, but not Internet with built-in Airport card

    Hi, I'm sorry if this is a duplicate question, but I couldn't seem to find a similar situation. I'm trying to get my wireless (or any) Internet working at my house with my Powerbook G4 with a built-in Airport card. We have a Linksys 802.11g router wi