Get working day of month for specific date

Hi,
I need to get the working day of a month for a specific date. For example: Which working day is the 15th of september 2005...
Is there any function module, I could use?
Cheers Arne

HI arne,
1.  DATE_CHECK_WORKINGDAY
    This is the FM.
2. Along with that u will have to use some logic.
3. Just copy paste in new program
   (it will help in the logic)
<b>It will list out
all the working days
between two given dates</b>
REPORT abc.
data : num type i.
parameters : frdate type sy-datum default '20051216'.
parameters : todate type sy-datum default '20051221'.
perform getinfo using frdate todate changing num.
break-point.
*&      Form  getinfo
      text
FORM getinfo USING fromdate todate CHANGING numofdays type i.
  DATA :  d TYPE sy-datum.
  d = fromdate - 1.
  DO.
    d = d + 1.
    IF d > todate.
      EXIT.
      endif.
      CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
        EXPORTING
          date                       = d
          factory_calendar_id        = '01'
          message_type               = 'I'
        EXCEPTIONS
          date_after_range           = 1
          date_before_range          = 2
          date_invalid               = 3
          date_no_workingday         = 4
          factory_calendar_not_found = 5
          message_type_invalid       = 6
          OTHERS                     = 7.
    IF sy-subrc = 0.
      numofdays = numofdays + 1.
      write :/ d.
    ENDIF.
    ENDDO.
  ENDFORM.                    "getinfo
regards,
amit m.

Similar Messages

  • Getting total days in month

    please tell me how to get total days in month by calendar:
    suppose i pass these parameters in calendar:=
    Calendar c1=new GregorianCalendar(2005,1,6);
    means it is feb 2005
    now i want to find the No of days in current month:
    it should give 28 .
    please tell how to get.progarmatically i know.
    i want API

    Hi,
    I don't know if you got it working or not, but I was looking for the same thing and I found the following at this address
    http://javaalmanac.com/egs/java.util/GetDaysInMonth.html
    // Create a calendar object of the desired month
        Calendar cal = new GregorianCalendar(1999, Calendar.FEBRUARY, 1);
        // Get the number of days in that month
        int days = cal.getActualMaximum(Calendar.DAY_OF_MONTH); // 28
        // Try month in a leap year
        cal = new GregorianCalendar(2000, Calendar.FEBRUARY, 1);
        days = cal.getActualMaximum(Calendar.DAY_OF_MONTH);     // 29

  • User login report in Active Directory for specific date and time

    I want to get User login report in Active Directory for specific date and time e.g user logged in at15-01-2015 from 8:00am to 4:00pm
    Is any query, script or any tool available?
    Waiting for reply please

    You can identify the last logon date and time using my script here: https://gallery.technet.microsoft.com/scriptcenter/Get-Active-Directory-User-bbcdd771
    If you would like to get back in time and see when the user did a logon / logoff then you need to have auditing enabled. Once done, you can records from Security log in the event viewer: https://social.technet.microsoft.com/Forums/windowsserver/en-US/98cbecb0-d23d-479d-aa65-07e3e214e2c7/manage-active-directory-users-logon-logoff-events
    I have started a Wiki about how to track logon / logoff and it can help too: http://social.technet.microsoft.com/wiki/contents/articles/20422.record-logon-logoff-activities-on-domain-servers-and-workstations-using-group-policy.aspx
    This posting is provided AS IS with no warranties or guarantees , and confers no rights.
    Ahmed MALEK
    My Website Link
    My Linkedin Profile
    My MVP Profile

  • How to restore Project from repository for specific date ?

    Hello,
    I have Web Dyn Pro Project. Some files were deleted in project and were checked in to repository.
    Could you please describe easy steps how to restore project state for specific date ?

    The only way you could do that was if you used Time Machine on the computer to make backups. You could simply store the mobile backups folder on the day you wanted and then restore the iPhone.
    I've done this successfully in the past.

  • Get table partition name dynamically for given date range

    Dear All,
    Could you please tell me how to get the partition name dynamicaly for given date range ?
    Thank you.

    SQL> select table_name,
           partition_name,
           to_date (
              trim (
                 '''' from regexp_substr (
                              extractvalue (
                                 dbms_xmlgen.
                                 getxmltype (
                                    'select high_value from all_tab_partitions where table_name='''
                                    || table_name
                                    || ''' and table_owner = '''
                                    || table_owner
                                    || ''' and partition_name = '''
                                    || partition_name
                                    || ''''),
                                 '//text()'),
              'syyyy-mm-dd hh24:mi:ss')
              high_value_in_date_format
      from all_tab_partitions
    where table_name = 'SALES' and table_owner = 'SH'
    TABLE_NAME                     PARTITION_NAME                 HIGH_VALUE_IN_DATE_FORMAT
    SALES                          SALES_1995                     01-JAN-96               
    SALES                          SALES_1996                     01-JAN-97               
    SALES                          SALES_H1_1997                  01-JUL-97               
    SALES                          SALES_H2_1997                  01-JAN-98               
    SALES                          SALES_Q1_1998                  01-APR-98               
    SALES                          SALES_Q2_1998                  01-JUL-98               
    SALES                          SALES_Q3_1998                  01-OKT-98               
    SALES                          SALES_Q4_1998                  01-JAN-99               
    SALES                          SALES_Q1_1999                  01-APR-99               
    SALES                          SALES_Q2_1999                  01-JUL-99               
    SALES                          SALES_Q3_1999                  01-OKT-99               
    SALES                          SALES_Q4_1999                  01-JAN-00               
    SALES                          SALES_Q1_2000                  01-APR-00               
    SALES                          SALES_Q2_2000                  01-JUL-00               
    SALES                          SALES_Q3_2000                  01-OKT-00               
    SALES                          SALES_Q4_2000                  01-JAN-01               
    SALES                          SALES_Q1_2001                  01-APR-01               
    SALES                          SALES_Q2_2001                  01-JUL-01               
    SALES                          SALES_Q3_2001                  01-OKT-01               
    SALES                          SALES_Q4_2001                  01-JAN-02               
    SALES                          SALES_Q1_2002                  01-APR-02               
    SALES                          SALES_Q2_2002                  01-JUL-02               
    SALES                          SALES_Q3_2002                  01-OKT-02               
    SALES                          SALES_Q4_2002                  01-JAN-03               
    SALES                          SALES_Q1_2003                  01-APR-03               
    SALES                          SALES_Q2_2003                  01-JUL-03               
    SALES                          SALES_Q3_2003                  01-OKT-03               
    SALES                          SALES_Q4_2003                  01-JAN-04               
    28 rows selected.

  • Fail to add all day event on a specific date

    Hi, my ical fail to add all day event on a specific date 2nd of Oct, when i double clickto add all day event, it falls on the 1st or 3rd but not the 2nd?

    Hi Maggie,
    Yes you can change your timezone, but in my opinion only Apple can really fix this problem. The more people they know are having the this issue the more likely Apple will fix it. Therefore I suggest you send them feedback about the problem.
    Best wishes
    John M

  • Display data for last working day of month

    Hi
    I am trying to chart values for the last six years but only to plot the value for the last working day of the month, except for the current month where I am taking an average of the month so far. Everything I've tried has so far failed spectacularly. Has anyone resolved a similar problem?

    If I understand your dilemma correctly, you may want to create a cross-tab and then create the chart off of the cross-tab. Is the data in your tables that you want to chart on something like this:
             4/30   5/30   6/30   7/31   8/29       Sept.
    Row 1    20      30      10      25      20    (avg for month) 
    Row 2    5         10      8       15     15    (avg for month)
    etc.
    If so, 1) can you show an example of the data and 2) what kind of chart do you want to create?

  • Get working days of actual month in time management

    Hello,
    a customer wants his employees to work some additional time every workday. The time is different for each employee and has to be specified on a monthly basis, but has to be shown daily in time sheet.
    Days with holidays or illness do not require additional work, but count when calculation daily quota.
    I would like to use P0050-ZTZUA to store the value of the hours which the employee has to work extra per month.
    Now I need to divide this value through the number of workdays of the actual month, to get a value per day. Unfortunately I did not find any operation to get number of workdays.
    Thanks in advance

    Hello again.
    I did not get it!
    I made a simple PCR "Z123" just to test, how to count days. It looks like this:
               D VARSTCURMO
    **           HRS=1     ADDDB9082
    I call this with ACTIO Z123 and see, that the result for timetype 9082 is 1 at every day that is evaluated in my calculation period.
    In the example I do not care for workingdays, I just wanted to test, if the counting of days is functioning.
    Since the timetype 9082 is cumulated, I get number of days of period at the end of the time calculation in SALDO-Table.
    For example:
    Day               Saldo in 9082
    January  1             1
    January  2             2
    January  3             3
    January 31            31
    My problem is, that I need the number of days at each day of the calculation. Already at January 1 I need to divide a given amount of time through the number of days (31 in the example).
    I'm afraid, that this issue cannot be solved?

  • What phones can you still get the $15/month for limited data plan?

    I am aware Verizon has switched over to the "Share Everything" plan. I think it's obsurd to charge $50 a month for only 1GB of data to share with the whole family. Anybody who pays for that, must be insane. But, that's not what I'm asking about.              I have talked to my local Verizon store and they said I can keep my plan if I just want to upgrade my phone. There are 3 other phones on my plan, by the way. I have a basic Samsung Rogue that has unlimited texting and a shared amount of minutes for phone calls. I asked about changing my phone to a smart phone and they said I could have the $45/month plan, or whatever it was, for unlimited everything. That was just a little bit more than what I was willing to spend. I considered switching carriers and decided against it, as Verizon seems to have the best coverage. Then, it occured to me that they used to offer a limited data plan that my sister had before she got unlimited. I thought it was about $15 on top of what I already pay, but I'm not for sure. So, since I am still on my old plan, would it be possible to add the limited data package to my plan?? Also, if that is possible, what phones have an option to have a data plan? Can it just be any smart phone? I would prefer a touch screen phone.
    All answers are appreciated. Thank you!!

    Yes it is true. when you add a line you are required to change to the share everything plan.
    <Moderator comment. This information is incorrect. Current customer are not required to switch to the Share Everything Plan if the customer deals with a corporate store or VZW directly through Customer Service.<
    Message was edited by: Verizon Moderator

  • Customer Exit to get last day of month from Year/month

    Hi Experts,
    I need to create a customer exit to get the last day of month from Cal Year month input variable.
    Examples
    1)
    User input period: 12.2008
    I need from the customer exit: 31.12.2008
    2)
    User input period: 02.2009
    I need from the customer exit: 28.02.2009
    Can someone help me with the ABAP code to achieve this with a customer exit?
    Help will be appreciated.

    Hi,
    Please use the following code,
    Second one is the suitable solution for you, I can understand that, if it leafe year then you have the problem so use the secon one.
    First one is using Period i.e. 010.2008 (December 2008).
    Secodn one is based on Date/Month.
    Note: Insted of SY-DATUm, you give your variable name
    *******To get the Last day of the Fy Period entered by User in ZFYP***
        WHEN 'ZLDAY_FI'.
          LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZFYP'.
            zbdatj = loc_var_range-low+0(4).
            zbuper = loc_var_range-low+4(3).
            CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
              EXPORTING
                i_gjahr = zbdatj
                i_periv = 'V3'
                i_poper = zbuper
              IMPORTING
                e_date  = zzdate.
            CLEAR: l_s_range.
            l_s_range-low = zzdate.
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO e_t_range.
          ENDLOOP.
    Note: in the below code I given SY-DATUM, so you change to your Month Variable like using  
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'XXXX'.
    ** Last Day of Current Calendar month
          zzdate = sy-datum.
          CALL FUNCTION '/OSP/GET_DAYS_IN_MONTH'
            EXPORTING
              iv_date = zzdate
            IMPORTING
              ev_days = znum.
          CLEAR: l_s_range.
          l_s_range-low+6(2) = znum.
          l_s_range-low+0(4) = sy-datum+0(4).
          l_s_range-low+4(2) = sy-datum+4(2).
          l_s_range-sign = 'I'.
          l_s_range-opt = 'EQ'.
          APPEND l_s_range TO e_t_range.
    Thanks
    Reddy
    Edited by: Surendra Reddy on Jan 27, 2009 2:47 PM
    Edited by: Surendra Reddy on Jan 28, 2009 6:12 AM

  • Issue with displaying QM control chart for specific date range

    Dear All
    In our chemical mfg organisation, we just implemented SAP QM solution and things are working fine. I have implemented control  chart functionalities as below:
    SPC Criteria in Inspection Plan: Task List Charateristics / Material (0020)
    Sampling Procedure: Fixed Sample / SPC Inspection (without inspection point)
    We use process orders to get the inspection lots for products (material) and record results for the MICs and UD the inspection lots.
    Currently all our Control Chart have status 1 (created) and we have not moved any of those charts to status 3 and 5 yet.
    Using QGC1 when user trying to run control chart for any particular material in the plant and for a specific date range, report showing all the charts for that material with different MICs as expected. Though the result is NOT restricted to the selection dates either against "Lot Created On" or " Insp. Start Date" ( may be due to SPC criteria????) , its always showing all the result for any particular MIC for that material starting from go live till today.
    How to restrict the dispaly of result on the chart for any particular MIC against the Material / Plant within a specific date range ?
    Looking forward for your response.
    Best Regards
    SK

    Hi,
    1. Even though when i give the Created on, and to date the system is displaying the report which is prior to the created on date.
    2. Similarly the report data is different when the field is maximum no of Hits is given. for example when i giving this field as 10, 20, 30, etc the report is showing only 10 line items. if i enter 50, 60 etc it is showing the list for half i given.
    Note that system is having more than 1000 line items to display..
    Regards,
    R. Loganathan

  • Can I get the value closest to a specific date?

    I wonder if it's possible to fetch a value from a table that is closest to a specific date. An example is that you want to fetch the value of 31 of May. This date does not exist instead I want to get the closest value to the 31 of May. It doesn't matter if it's an earlier date or later just the closest. Between doesn't work since I only have one date and I just want to get another date.

    Sri Dhar,
    In the following tests, I added quotes around &test_date that were necessary in order to enable the query to run. I also changed the date format to DD-MON-YYYY, because you should always include the full year, in order to avoid Y2K problems. I changed the nls_date_format to match, so that it could still do an implicit conversion. I also did a little formatting for readability. If either of your sub-queries does not return a row, as with the given test date of 31-MAY-2002, then your query returns no rows. However, each of the individual sub-queries does function properly. But, as you noted, you need to get the result all in one shot. If you use a different value for the test_date that allows both sub-queries to return rows, like 31-JAN-2002, then your query returns the correct result, but the cost is still extremely high.
    SQL> -- test table and data:
    SQL> CREATE TABLE user_objects2
      2  AS
      3  SELECT *
      4  FROM   user_objects
      5  /
    Table created.
    SQL> -- test index:
    SQL> CREATE INDEX user_objects2_created_idx
      2  ON user_objects2 (created)
      3  /
    Index created.
    SQL> -- test analysis:
    SQL> ANALYZE TABLE user_objects2
      2  COMPUTE STATISTICS
      3  FOR TABLE
      4  FOR ALL INDEXES
      5  FOR ALL INDEXED COLUMNS
      6  /
    Table analyzed.
    SQL> -- change date format for testing:
    SQL> ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY'
      2  /
    Session altered.
    SQL> -- accept date value for variable:
    SQL> ACCEPT test_date PROMPT 'Enter test_date in format DD-MON-YYYY: '
    Enter test_date in format DD-MON-YYYY: 31-MAY-2002
    SQL> -- original query with quotes added around &test_date
    SQL> -- and date format changed to DD-MON-YYYY
    SQL> -- and some formatting for readability
    SQL> -- (returns no rows when one sub-query returns no rows)
    SQL> -- (returns correct result when both sub-queries return rows,
    SQL> --  but cost is still high):
    SQL> SELECT DECODE (LEAST (a.next_diff, b.prev_diff),
      2                b.prev_diff, b.prev_date, a.next_date)
      3  FROM   (SELECT next_date,
      4                TO_DATE (next_date, 'DD-MON-YYYY') -
      5                TO_DATE ('&test_date', 'DD-MON-YYYY') next_diff
      6            FROM   (SELECT   DISTINCT created next_date
      7                 FROM     user_objects2
      8                 WHERE    TRUNC (created) >= '&test_date'
      9                 ORDER BY created)
    10            WHERE  ROWNUM <= 1) a,
    11           (SELECT prev_date,
    12                TO_DATE ('&test_date', 'DD-MON-YYYY') -
    13                TO_DATE (prev_date, 'DD-MON-YYYY') prev_diff
    14            FROM   (SELECT   DISTINCT created prev_date
    15                 FROM     user_objects2
    16                 WHERE    TRUNC (created) < '&test_date'
    17                 ORDER BY created DESC)
    18            WHERE  ROWNUM <= 1) b
    19  /
    old   5:                TO_DATE ('&test_date', 'DD-MON-YYYY') next_diff
    new   5:                TO_DATE ('31-MAY-2002', 'DD-MON-YYYY') next_diff
    old   8:                 WHERE    TRUNC (created) >= '&test_date'
    new   8:                 WHERE    TRUNC (created) >= '31-MAY-2002'
    old  12:                TO_DATE ('&test_date', 'DD-MON-YYYY') -
    new  12:                TO_DATE ('31-MAY-2002', 'DD-MON-YYYY') -
    old  16:                 WHERE    TRUNC (created) < '&test_date'
    new  16:                 WHERE    TRUNC (created) < '31-MAY-2002'
    no rows selected
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=200 Card=1521 Bytes=         
              45630)                                                               
       1    0   MERGE JOIN (CARTESIAN) (Cost=200 Card=1521 Bytes=45630)            
       2    1     VIEW (Cost=5 Card=39 Bytes=585)                                  
       3    2       COUNT (STOPKEY)                                                
       4    3         VIEW (Cost=5 Card=39 Bytes=351)                              
       5    4           SORT (UNIQUE STOPKEY) (Cost=4 Card=39 Bytes=273)           
       6    5             TABLE ACCESS (FULL) OF 'USER_OBJECTS2' (Cost=2 C         
              ard=39 Bytes=273)                                                    
       7    1     SORT (JOIN) (Cost=200 Card=39 Bytes=585)                         
       8    7       VIEW                                                           
       9    8         COUNT (STOPKEY)                                              
      10    9           VIEW (Cost=5 Card=39 Bytes=351)                            
      11   10             SORT (ORDER BY STOPKEY) (Cost=5 Card=39 Bytes=27         
              3)                                                                   
      12   11               SORT (UNIQUE) (Cost=4 Card=39 Bytes=273)               
      13   12                 TABLE ACCESS (FULL) OF 'USER_OBJECTS2' (Cost         
              =2 Card=39 Bytes=273)                                                
    SQL> -- individual subqueries return
    SQL> -- correct results:
    SQL> SELECT next_date,
      2           TO_DATE (next_date, 'DD-MON-YYYY') -
      3           TO_DATE ('&test_date', 'DD-MON-YYYY') next_diff
      4  FROM   (SELECT   DISTINCT created next_date
      5            FROM     user_objects2
      6            WHERE    TRUNC (created) >= '&test_date'
      7            ORDER BY created)
      8  WHERE  ROWNUM <= 1
      9  /
    old   3:        TO_DATE ('&test_date', 'DD-MON-YYYY') next_diff
    new   3:        TO_DATE ('31-MAY-2002', 'DD-MON-YYYY') next_diff
    old   6:         WHERE    TRUNC (created) >= '&test_date'
    new   6:         WHERE    TRUNC (created) >= '31-MAY-2002'
    no rows selected
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=5 Card=39 Bytes=351)         
       1    0   COUNT (STOPKEY)                                                    
       2    1     VIEW (Cost=5 Card=39 Bytes=351)                                  
       3    2       SORT (UNIQUE STOPKEY) (Cost=4 Card=39 Bytes=273)               
       4    3         TABLE ACCESS (FULL) OF 'USER_OBJECTS2' (Cost=2 Card=         
              39 Bytes=273)                                                        
    SQL> SELECT prev_date,
      2           TO_DATE ('&test_date', 'DD-MON-YYYY') -
      3           TO_DATE (prev_date, 'DD-MON-YYYY') prev_diff
      4  FROM   (SELECT   DISTINCT created prev_date
      5            FROM     user_objects2
      6            WHERE    TRUNC (created) < '&test_date'
      7            ORDER BY created DESC)
      8  WHERE  ROWNUM <= 1
      9  /
    old   2:        TO_DATE ('&test_date', 'DD-MON-YYYY') -
    new   2:        TO_DATE ('31-MAY-2002', 'DD-MON-YYYY') -
    old   6:         WHERE    TRUNC (created) < '&test_date'
    new   6:         WHERE    TRUNC (created) < '31-MAY-2002'
    PREV_DATE    PREV_DIFF                                                         
    29-APR-2002         32                                                         
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=5 Card=39 Bytes=351)         
       1    0   COUNT (STOPKEY)                                                    
       2    1     VIEW (Cost=5 Card=39 Bytes=351)                                  
       3    2       SORT (ORDER BY STOPKEY) (Cost=5 Card=39 Bytes=273)             
       4    3         SORT (UNIQUE) (Cost=4 Card=39 Bytes=273)                     
       5    4           TABLE ACCESS (FULL) OF 'USER_OBJECTS2' (Cost=2 Car         
              d=39 Bytes=273)                                                      
    SQL> ACCEPT test_date PROMPT 'Enter test_date in format DD-MON-YYYY: '
    Enter test_date in format DD-MON-YYYY: 31-JAN-2002
    SQL> -- original query with quotes added around &test_date
    SQL> -- and date format changed to DD-MON-YYYY
    SQL> -- and some formatting for readability
    SQL> -- (returns no rows when one sub-query returns no rows)
    SQL> -- (returns correct result when both sub-queries return rows,
    SQL> --  but cost is still high):
    SQL> SELECT DECODE (LEAST (a.next_diff, b.prev_diff),
      2                b.prev_diff, b.prev_date, a.next_date)
      3  FROM   (SELECT next_date,
      4                TO_DATE (next_date, 'DD-MON-YYYY') -
      5                TO_DATE ('&test_date', 'DD-MON-YYYY') next_diff
      6            FROM   (SELECT   DISTINCT created next_date
      7                 FROM     user_objects2
      8                 WHERE    TRUNC (created) >= '&test_date'
      9                 ORDER BY created)
    10            WHERE  ROWNUM <= 1) a,
    11           (SELECT prev_date,
    12                TO_DATE ('&test_date', 'DD-MON-YYYY') -
    13                TO_DATE (prev_date, 'DD-MON-YYYY') prev_diff
    14            FROM   (SELECT   DISTINCT created prev_date
    15                 FROM     user_objects2
    16                 WHERE    TRUNC (created) < '&test_date'
    17                 ORDER BY created DESC)
    18            WHERE  ROWNUM <= 1) b
    19  /
    old   5:                TO_DATE ('&test_date', 'DD-MON-YYYY') next_diff
    new   5:                TO_DATE ('31-JAN-2002', 'DD-MON-YYYY') next_diff
    old   8:                 WHERE    TRUNC (created) >= '&test_date'
    new   8:                 WHERE    TRUNC (created) >= '31-JAN-2002'
    old  12:                TO_DATE ('&test_date', 'DD-MON-YYYY') -
    new  12:                TO_DATE ('31-JAN-2002', 'DD-MON-YYYY') -
    old  16:                 WHERE    TRUNC (created) < '&test_date'
    new  16:                 WHERE    TRUNC (created) < '31-JAN-2002'
    DECODE(LEAS                                                                    
    29-JAN-2002                                                                    
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=200 Card=1521 Bytes=         
              45630)                                                               
       1    0   MERGE JOIN (CARTESIAN) (Cost=200 Card=1521 Bytes=45630)            
       2    1     VIEW (Cost=5 Card=39 Bytes=585)                                  
       3    2       COUNT (STOPKEY)                                                
       4    3         VIEW (Cost=5 Card=39 Bytes=351)                              
       5    4           SORT (UNIQUE STOPKEY) (Cost=4 Card=39 Bytes=273)           
       6    5             TABLE ACCESS (FULL) OF 'USER_OBJECTS2' (Cost=2 C         
              ard=39 Bytes=273)                                                    
       7    1     SORT (JOIN) (Cost=200 Card=39 Bytes=585)                         
       8    7       VIEW                                                           
       9    8         COUNT (STOPKEY)                                              
      10    9           VIEW (Cost=5 Card=39 Bytes=351)                            
      11   10             SORT (ORDER BY STOPKEY) (Cost=5 Card=39 Bytes=27         
              3)                                                                   
      12   11               SORT (UNIQUE) (Cost=4 Card=39 Bytes=273)               
      13   12                 TABLE ACCESS (FULL) OF 'USER_OBJECTS2' (Cost         
              =2 Card=39 Bytes=273)                                                
    SQL> -- individual subqueries return
    SQL> -- correct results:
    SQL> SELECT next_date,
      2           TO_DATE (next_date, 'DD-MON-YYYY') -
      3           TO_DATE ('&test_date', 'DD-MON-YYYY') next_diff
      4  FROM   (SELECT   DISTINCT created next_date
      5            FROM     user_objects2
      6            WHERE    TRUNC (created) >= '&test_date'
      7            ORDER BY created)
      8  WHERE  ROWNUM <= 1
      9  /
    old   3:        TO_DATE ('&test_date', 'DD-MON-YYYY') next_diff
    new   3:        TO_DATE ('31-JAN-2002', 'DD-MON-YYYY') next_diff
    old   6:         WHERE    TRUNC (created) >= '&test_date'
    new   6:         WHERE    TRUNC (created) >= '31-JAN-2002'
    NEXT_DATE    NEXT_DIFF                                                         
    06-FEB-2002          6                                                         
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=5 Card=39 Bytes=351)         
       1    0   COUNT (STOPKEY)                                                    
       2    1     VIEW (Cost=5 Card=39 Bytes=351)                                  
       3    2       SORT (UNIQUE STOPKEY) (Cost=4 Card=39 Bytes=273)               
       4    3         TABLE ACCESS (FULL) OF 'USER_OBJECTS2' (Cost=2 Card=         
              39 Bytes=273)                                                        
    SQL> SELECT prev_date,
      2           TO_DATE ('&test_date', 'DD-MON-YYYY') -
      3           TO_DATE (prev_date, 'DD-MON-YYYY') prev_diff
      4  FROM   (SELECT   DISTINCT created prev_date
      5            FROM     user_objects2
      6            WHERE    TRUNC (created) < '&test_date'
      7            ORDER BY created DESC)
      8  WHERE  ROWNUM <= 1
      9  /
    old   2:        TO_DATE ('&test_date', 'DD-MON-YYYY') -
    new   2:        TO_DATE ('31-JAN-2002', 'DD-MON-YYYY') -
    old   6:         WHERE    TRUNC (created) < '&test_date'
    new   6:         WHERE    TRUNC (created) < '31-JAN-2002'
    PREV_DATE    PREV_DIFF                                                         
    29-JAN-2002          2                                                         
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=5 Card=39 Bytes=351)         
       1    0   COUNT (STOPKEY)                                                    
       2    1     VIEW (Cost=5 Card=39 Bytes=351)                                  
       3    2       SORT (ORDER BY STOPKEY) (Cost=5 Card=39 Bytes=273)             
       4    3         SORT (UNIQUE) (Cost=4 Card=39 Bytes=273)                     
       5    4           TABLE ACCESS (FULL) OF 'USER_OBJECTS2' (Cost=2 Car         
              d=39 Bytes=273)                                                      
    SQL> UNDEFINE test_date
    SQL> DROP TABLE user_objects2
      2  /
    Table dropped.

  • Schedule - 3rd working day of month

    How to set up a schedule that will execute on 3rd (or fourth) working day of every month?

    Hi
    The schedule expression is something like below, but OWB can't express that - you can express execute a weekday every 4/5 weeks for example. Or you can execute on the 3/4 day (no working day specification in OWB) of each month.
    I think this is what you really want though... (this is the schedule expression for Oracle database scheduler);
    FREQ=MONTHLY; BYDAY=MON,TUE,WED,THU,FRI; BYSETPOS=3
    Cheers
    David

  • To get working day

    Hi Gurus,
         my requirement is to get a working day.
    I know how many days my work will take to finish i.e no of days, let us say 10 days
    I need to add these number of working days to the system date excluding the weekend days.i.e I need to add 10 working days to the system date.
    Any help is appreciated...........
    Thanks,
    Sudhaaaaaaaa........

    Do like this:
    DATA: it_psp TYPE STANDARD TABLE OF ptpsp WITH HEADER LINE,
          wrk_days type i.
    CALL FUNCTION 'HR_PERSONAL_WORK_SCHEDULE'  "get EE working days
        EXPORTING
          pernr = "EE number here
          begda = "start date in your case sy-datum
          endda = "end date in your case sy-datum+10
        TABLES
          perws = it_psp.  "now you will get work schedule within this period but more general
      "you have to take only days you are interested in
      wrk_days = 0.
      LOOP AT it_psp WHERE datum BETWEEN sy-datum AND sy-datum+10
                     AND tagty = 0      "work/paid
                     AND stdaz <> 0.   "working hours
        ADD 1 TO wrk_days.  "here you have how many days are really working ones between sy-datum and 10 days later
      ENDLOOP.

  • How to get name of the month from current date.

    Hi,
       How to get the name of the month from current date.
    Thanks,
    Senthil

    Sethil,
    Use your date(let us say Date1) instead of sy-datum.
    CALL FUNCTION 'MONTH_NAMES_GET'
    EXPORTING
    LANGUAGE = SY-LANGU
    IMPORTING
    RETURN_CODE =
    TABLES
    MONTH_NAMES = itab_month
    EXCEPTIONS
    MONTH_NAMES_NOT_FOUND = 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.
    READ TABLE itab_month
    WITH KEY MNR = date1+4(2).
    itab_month-LTX will contain the value you are looking for
    Good luck
    Raghava

Maybe you are looking for

  • IPhone 4 middle button not working

    Having problems with the iPhone 4 middle button not working anyone else with the same problem ? Thanks

  • Re-installing Snow Leopard OEM

    Hi, I've recently decided to use bootcamp to install Windows 7, but cannot partition the drive due to the space being used. So I'm going to reinstall Snow Leopard, I am wondering when I reinstall, will I need a serial number and if so where do I find

  • Vendor Consignment - Returned material from customer directly to consignmen

    Hi, I'm working with a consignment vendor process. I'd like to know how should I manage the return from my costumer. I'd like to move this returned material directly to my vendor consignment. Is it possible? How can I do it? How affects it to the con

  • Can we build custom code in xsl-xml

    Hi, We are using one of the .xml dump which is stored as a row in the table iby_trxn_documents We are mapping .xsl (a custom template with the above .xml tags) We are getting the below tags in .xml (which is stored in table iby_trxn_documents) but th

  • Host command privileges

    Hello, If my form does a host('cmd /c dir > d:\output.txt') I get the resulting listing on my application server but if I do a host('cmd /c net send myhost ping > d:\ouput.txt) I get an output.txt of size 0 and no message is sent. I have tried sendin