Get the date range

Hi,
There is a requirement that we need to get date range.This date range will be arrived at using the function module BKK_GET_PRIOR_WORKDAY. The factory calender id is GB. It should return the date range. Therefore, for weekends the date range will be Saturday, Sunday and Monday.  The date range will change based on holidays that exist in the holiday calendar.
Now my question is how to calculate that there are two days between friday and monday.
Please help.

Hi Nishigandha,
If i am correct you need the number of days between two dates
ex:
date1: 04/06/2009
date2: 12/06/2009
you need the number of days??
then probably check this Fm out:
SD_DATETIME_DIFFERENCE this is a function module which gives the difference in Days and Time for entered two dates
P.S Additionally  Chk this out:
/people/mustafabaris.gunes/blog/2009/03/16/calculating-number-of-working-days-in-query-level
Hope its useful
Thanks and Regards
Srikanth.P
Edited by: SRIKANTH P on Jun 4, 2009 2:33 PM

Similar Messages

  • How to get the date range for a given fiscal period.

    Hi All,
    There is two fields (select options) on my selection screen
    1. Fiscal Year
    2. Fiscal Period.
    I just want the date range between the given year and period on selection screen.
    Thanks,
    Gaurav Mittal

    Check FM's FIRST_DAY_IN_PERIOD_GET and LAST_DAY_IN_PERIOD_GET.

  • MDM ABAP API query to pass the date range

    Hi
    I want to retrieve certain data from MDM repository based on filter criteria by date stamp.
    Not sure how to do it to pass the select option value in the query.
    select-options: s_cdate for sy-datum obligatory .
    DATA  wa_query     TYPE mdm_query.
    DATA: v_search_date1    TYPE MDM_CDT_DATE_TIME.
    data: v_datestamplow1   type string.
    data: v_datestamplow    type TZNTSTMPL.
    concatenate s_cdate-low '000000' into v_datestamplow1
    v_datestamplow  = v_datestamplow1.
    clear wa_query.
        wa_query-parameter_code = 'Changed_On '.             "Field code ( Field name )
        wa_query-operator = 'EQ'.
        wa_query-dimension_type = mdmif_search_dim_field.    "Field search
        wa_query-constraint_type = MDMIF_SEARCH_CONSTR_DATE. "Date  serach
    I am able to get the data when I just pass the low value from selecct option.  But I dont how  to pass the date range.
       v_search_date1-CONTENT = v_datestamplow.
        ET REFERENCE OF v_search_date1 INTO wa_query-value_low.
        APPEND wa_query TO gt_query.
      CALL METHOD cl_api->mo_core_service->query
          EXPORTING
            iv_object_type_code = 'Vendors'
            it_query            = gt_query
          IMPORTING
            et_result_set       = gt_result.
    II could see the below operator types . Although EQ says "Like standard select-options parameter" not sure how to pass the value.
    EQ     Equal to (like standard select-options parameter)
    NE     Not equal to (like standard select-options parameter)
    LT     Less than (like standard select-options parameter)
    LE     Less than or equal to (like standard s-o parameter)
    GT     Greater than (like standard select-options parameter)
    GE     Greater than or equal to (like standard s-o parameter
    SW     Starts with (MDM specific parameter)
    Thanks,
    Krishna.

    Hi,
    To get the date range for select options, pass the low value with 'GE' operator and another query option with 'LE' operator for high value.
    select-options: s_cdate for sy-datum obligatory .
    DATA wa_query TYPE mdm_query.
    DATA: v_search_date1 TYPE MDM_CDT_DATE_TIME.
    data: v_datestamplow1 type string.
    data: v_datestamplow type TZNTSTMPL.
    concatenate s_cdate-low '000000' into v_datestamplow1
    v_datestamplow = v_datestamplow1.
    clear wa_query.
    wa_query-parameter_code = 'Changed_On '. "Field code ( Field name )
    wa_query-operator = 'GE'.
    wa_query-dimension_type = mdmif_search_dim_field. "Field search
    wa_query-constraint_type = MDMIF_SEARCH_CONSTR_DATE. "Date serach
    GET REFERENCE OF v_search_date1 INTO wa_query-value_low.
    APPEND wa_query TO gt_query.
    concatenate s_cdate-high '235959' into v_datestamphigh1
    v_search_date2 = v_datestamphigh1.
    clear wa_query.
    wa_query-parameter_code = 'Changed_On '. "Field code ( Field name )
    wa_query-operator = 'LE'.
    wa_query-dimension_type = mdmif_search_dim_field. "Field search
    wa_query-constraint_type = MDMIF_SEARCH_CONSTR_DATE. "Date serach
    GET REFERENCE OF v_search_date2 INTO wa_query-value_low.
    APPEND wa_query TO gt_query.
    CALL METHOD cl_api->mo_core_service->query
    EXPORTING
    iv_object_type_code = 'Vendors'
    it_query = gt_query
    IMPORTING
    et_result_set = gt_result.
    Thanks.

  • How to get a date range in JDBC sql

    I am using the following in my sql to get a date range... but what if the field is a timestamp will that still work or not...
    AND a.date>=? AND a.date<=?

    Suzie,
    No offence, but is there something stopping you from testing it yourself?
    Good Luck,
    Avi.

  • To check the date range

    Hi,
    I have a table that records the leave for employees. Like employee id , leave start date, leave end date and total hours. I need to find out , if the start date or end date was on weekend , or if the date range includes weekends . And there is one more table that stores public holidays. I also need to check if the leave start date or end date was on the public holiday or the range includes any public holidays.
    Thanks

    Hi,
    Assuming the time of day for all the dates involved is the same (e.g., if they are all TRUNCated DATEs, where the time is 00:00:00), that leave_start_date <= leave_end_date, and that the weekend consiists of Saturday and Sunday, you can do something like this:
    SELECT     leave_start_date
    ,     leave_end_date
    ,     CASE
             WHEN  TRUNC (leave_start_date, 'IW')     < TRUNC (leave_end_date + 2, 'IW')
             THEN  'Includes Saturday or Sunday'
             ELSE  'No weekend'
         END              AS weekend
    ,     CASE
             WHEN  EXISTS (
                              SELECT  1
                        FROM    holiday_table
                        WHERE   holiday_date BETWEEN m.leave_start_date
                                              AND       m.leave_end_date
             THEN  'Leave includes at least 1 holiday'
             ELSE  'No holidays'
         END          AS holiday
    FROM     leave_table     m
    ;This does not depend on your NLS settings.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for both tables, and also post the results you want from that data, as Andy requested.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using.

  • Calculate the date range from entered date

    HI
    My requirement is to get the data in a perticular intervals of posting date.
    Directly we can create a variable with interval on posting Date to have the required data but Here we need two have two varibles because in one varibale user enters posting date and in second variable user enters any number like 1,2,3....etc
    Let's say user enetered posting date as 30.08.2010 in the first variable and number 4 in the second variable.
    Finally out put range should be calculted from entred posting date 30.08.2010  date to four days back  
    i.e output  should be appear in the report  from 27.08.2010 to 30.08.2010.
    My question i can create first avariable on posting Date but  where shoud i create the second variable on which field.
    Please help me on this..points will be awrded.
    Regards,
    Siva Thottempudi.

    R you talking about the below to create new variable on the existing key figure
    Selecting Variables
    When you select characteristic values in the query definition, you can also select variables instead of fixed values. These act as placeholders and are only filled with fixed values when the query is executed.
    When selecting variables, you can also define new variables, change variables, or delete variables. These functions are always available to the right of the selection of the variable type.
    Selecting Variables
    1.      Choose Show ® Variables.
    2.      Under Type, select the variable type (such as Characteristic Value Variable, Hierarchy Node Variable) from which you want to select the variable.
    3.      Select one (or, in exceptional cases, more than one) variable from the list of available variables in the left window and add them (using the right arrow) to the right Selection window.
    Selecting Variable Value Range Limits
    1.      Choose Show ® Value Ranges.
    2.      Select your required operator from the dropdown box. You can choose from the following operators:
    ○       Between
    ○       Less Than or Equal to
    ○       Greater Than or Equal to
    ○       Less Than
    ○       Greater Than
    3.      Select the required value or values for the value range and choose . The input help appears in a new dialog box and displays the selection of variables under Show  ® Variables.
    4.      Under Type, select the variable type (such as Characteristic Value Variable, Hierarchy Node Variable) from which you want to select the variable.
    5.      Select the required variable and choose OK.
    6.      For the Between operator, two single values are required for the interval limits; the system automatically displays two dropdown boxes. In this case, repeat steps 3-5.
    7.      After you have set the value range, choose OK.
    8.      Add the selection to the right Selection window using the right arrow.

  • How to approach in getting the dates for the user given periods

    Hi All,
    I have areuirement where the calendar would be like as 466 for a period
    for eg. period 1(Jan) has 4 weeks
    period 2(Feb) has 6 weeks
    period 3(Mar) has 6 weeks
    again period 4(Apr) has 4 weeks
    period 5(May) has 6 weeks
    period 6(June) has 6 weeks
    How to get the dates (from date and end date) for the periods.
    Anybody's help will be appreciated
    Regards
    Saugata

    I have areuirement where the calendar would be like as 466 for a periodWhat does that mean? Is 466 the format of the data?
    The end date depends on the start date. This query might be helpful for you
    SQL> WITH data AS(
      2    SELECT 1 period, 4 duration FROM dual UNION ALL
      3    SELECT 2, 6 FROM dual UNION ALL
      4    SELECT 3, 6 FROM dual UNION ALL
      5    SELECT 4, 4 FROM dual UNION ALL
      6    SELECT 5, 6 FROM dual UNION ALL
      7    SELECT 6, 6 FROM dual)
      8  SELECT
      9    period,
    10    duration,
    11    SYSDATE + SUM(duration) OVER (ORDER BY period RANGE UNBOUNDED PRECEDING) * 7 AS end_date
    12  FROM data
    13  ;
        PERIOD   DURATION END_DATE
             1          4 16-NOV-07
             2          6 28-DEC-07
             3          6 08-FEB-08
             4          4 07-MAR-08
             5          6 18-APR-08
             6          6 30-MAY-08
    6 rows selected.
    SQL>

  • How would I get the date of last Monday?

    How would I get the date of last Monday?

    I've done the following, does it seem right?
    public static const millisecondsPerDay:int = 1000 * 60 * 60 *
    24;
    * This function sets the mimimum and maximum range
    private function sliceChartWeek():void{
    var max:Date = new Date();//current date is our max from
    which we will calculate the min
    var day:uint = max.day;
    var min:Date = new Date(max.getTime() - (millisecondsPerDay
    * (max.day - 1)));
    dateTimeAxis.minimum = min;
    }

  • FM to get the date specific structural help

    I am working on structural help for Org id  for a selection screen parameter.
    I am using  FM RH_OBJID_REQUEST. It is giving the structure valid ion today. My requirement is to get the structure valid on given period in the above selection field.
    Please let me know is there any other way(other FM) to get the date specific structural help.

    Pass your dates to ORGBEG     & ORGEND                                                                               
    Description                                                                               
    This parameter only applies to the search function.                                                                               
    The parameters ORGEND and ORGBEG together determine the period in which          
         the organizational assignment data for positions is read. The entry in           
         ORGBEG specifies the start of the search period.                                                                               
    Value range                                                                               
    Allowed values are all dates smaller than the date in ORGEND.                                                                               
    Default                                                                               
    The default value is the smallest system date.                                                                               
    Function Module                                                                      
    ^Saquib

  • To get the dates between a month

    Hi,
    i'm working in forms 6i and database 10g.
    i have a table named attendance which contains only the dates on which the employees are present.
    i need the dates on which the employees are absent when i give the date range.
    So how will I get the other days in a month if I give the start and end date of a month.
    I think u understood what I mean.
    Pls help..

    Rereading your post my guess is you're after something like below
    NOT TESTED ! I don't have database access
    select employee,the_date absent
      from (select x.employee,x.the_date,a.present_on
              from (select a.employee,md.the_date
                      from (select to_date(:yyyymm,'yyyymm') + level - 1 the_day
                              from dual
                            connect by level <= to_number(to_char(last_day(to_date(:yyyymm,'yyyymm')),'dd'))
                           ) md,  /* generating dates for a year_month given */
                           (select distinct employee
                              from attendance
                           ) a  /* retrieving all employees */
                   ) x,  /* cartesian join between employees and days in a month */
                   attendance a
             where x.employee = a.employee(+)
               and x.the_date = a.present_on(+)
    where present_on is nullRegards
    Etbin

  • How to get the data into select options if we have 10 select options

    Hi Experts,
         I facing problem to get the data from diffrent tables and different select options.
    I have to pass different parameter ranges.
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: rb1 RADIOBUTTON GROUP g1.     "Existing Key Accounts
    PARAMETERS: rb2 RADIOBUTTON GROUP g1.     "Potential Key Accounts
    SELECT-OPTIONS: s_part FOR but000-partner."Business Partner Number
    PARAMETERS: p_bpkind LIKE but000-bpkind.    "Business Partner Type
    PARAMETERS: p_but000 LIKE but000-partner.   "Key Account Manager
    SELECT-OPTIONS : s_vkont FOR fkkvkp-vkont. "Contract Account
    SELECT-OPTIONS : s_ktokl FOR fkkvkp-ktokl. "Debtor Type
    SELECT-OPTIONS : s_sparte FOR ever-sparte.  "Division
    SELECT-OPTIONS : s_vertra FOR ever-vertrag. "Contract
    SELECT-OPTIONS : s_budat FOR erdk-budat.   "Invoice Date
    SELECT-OPTIONS : s_netto FOR dberchv-nettobtr."Billing Amount
    SELECT-OPTIONS : s_abrm FOR abc.               "Consumption Value
    SELECTION-SCREEN: END OF BLOCK b1.
    need response asap.
    Thanking you.
    Regards Surya Ramireddy

    HI,
    You can use as many Select-options in the select statment,
    Select XXXX yyyy from TABLE where FIELD In S_FIELD1 and
    FIELD2 In S_FIELD2.
    Regards
    Sudheer

  • How to get the data from a cluster table to BW

    Dear All,
    I want to extract the data from R/3 to BW by using 2 tables and one Cluster B2.
    Actually my report contains some fields from PA2001, PA2002 and one cluster table B2 (Table ZES). Can I create View by using these 3 tables? If it is not possible how can I get the data from the cluster? Can I create generic datasource by using cluster tables directly?
    In SE11 Transaction the Cluster (table ZES) is showing invalid table.
    I referred some Forums, but no use.
    Can any body tell me procedure to get the data from a cluster (table ZES) ?
    Waiting for you results.
    Thanks and regards
    Rajesh

    HI Siggi,
    Thank you for your reply..
    I am also planning to do FM to get the data. But it is saying that the Cluster table ZES does not exist (ZES is the the standard table, in SE11 also).
    How can I use the Fields from the that table.?
    What can I do now, can you please explain me about this point.
    Waiting for your reply.
    Thanks and Regards
    Rajesh
    Message was edited by:
            rajesh

  • Why do we get the data from a view to a report.

    hi
    why do we get the data from a view to a report. is it possible to get the data from a view in all the cases?

    hi Jyotssna,
      Suppose you are planning to get the data from multiple tables then you got to specify seveal condtions and make use of joins which results in poor performance in fetching the data . In order to improve the performance we make use of views where the conditions of different tables are defined and the data is fetched accordingly.
    Regards,
    Santosh

  • DataSource 0CRM_SRV_PROCESS_H is not getting the data in infopackage

    Hi Masters,
    I have to upload the data from the datasources 0CRM_SRV_PROCESS_H and 0CRM_SRV_PROCESS_I into Infopackages, but when i execute the infockage it shows
    No data available
    Diagnosis
    The data request was a full update.
    In this case, the corresponding table in the source system does not
    contain any data.
    System Response
    Info IDoc received with status 8.
    Procedure
    Check the data basis in the source system.
    In CRM system when i checked it in RSA3 it is showing the data.
    I checked the older posts but i havn't find any answer post. I also checked the SAP note 692195, but it is applicable for 4.0. I am working on 7.0.
    Please suggest something so that I can get the data into infopackage.
    Thanks and Regards,
    Vicky.

    Hi Lokesh,
    Thanks for your reply.
    Actually i am working on such a project where they don't give SAP_ALL authorization to any user. If we need any authorization we need to show them particular SAP note of same version in my case it is CRM 7.0. If you know any note on CRM 7.0 which gives all the authorization objects required or it says we need SAP_ALL authorization please tell me.
    It will be very help full for me to get the authorization.
    Regards,
    Vicky.

  • Refernce Nav igational Attribute is not getting the data in Infoprovider

    Hi,
    I am facing the issue with Reference Characteristic which is  a navigational attribute for which data  is not getting populated in the cube.Please find the below scenario.
    We have three characteristics 0RECV_WBS_E , 0WBS_ELEMT, ZPSBUSA .Char 0RECV_WBS_E is reference of 0WBS_ELEMT.
    0RECV_WBS_E__ZPSBUSA,0WBS_ELEMT__ZPSBUSA are the Navigational attributes of ZPSBUSA, these two are maintained as Navigational attributes in the cube and at info object level. The Nav Attribute  0RECV_WBS_E__ZPSBUSA is not getting the data in infocube where as 0WBS_ELEMT__ZPSBUSA is getting the data .The data is available for the two Nav attributes in the info object ZPSBUSA .Can you please suggest why this reference Nav attribute  0RECV_WBS_E__ZPSBUSA is not getting data in the infocube.
    Thanks,
    SUbhash

    Hi,
    I am facing the issue with Reference Characteristic which is a navigational attribute for which data is not getting populated in the cube.Please find the below scenario.
    We have three characteristics 0RECV_WBS_E , 0WBS_ELEMT, ZPSBUSA .Char 0RECV_WBS_E is reference of 0WBS_ELEMT.
    0RECV_WBS_E__ZPSBUSA,0WBS_ELEMT__ZPSBUSA are the Navigational attributes of 0WBS_ELEMT, these two are maintained as Navigational attributes in the cube and at info object level. The Nav Attribute 0RECV_WBS_E__ZPSBUSA is not getting the data in infocube where as 0WBS_ELEMT__ZPSBUSA is getting the data .The data is available for the two Nav attributes in the info object 0WBS_ELEMT .Can you please suggest why this reference Nav attribute 0RECV_WBS_E__ZPSBUSA is not getting data in the infocube.
    Thanks,
    SUbhash
    Edited by: MarkSubhash on Dec 9, 2011 11:11 AM

Maybe you are looking for