Reg:how disaplay selection range for date field

hi all
can you please  let me know how to write  the code in wdabap  to display a date field with range option.i mean in abap we use at selection screen  ,but coming to wdabap can you  help how to write the code in wdabap.
Thanks in advance
Deepika

To simplify the requirement, let me consider the followign understanding:
1. You need few fields in the selection screen. They need to be select options and some parameter fields.
2. The user clicks the button. You need to read teh user entered data.
Once, you have teh data in your code, assign it to the context node - attributes. later, you need to decide what you shoudl do with that data.
Sol: 1. To obtain fields into selection screen, use the component "wdr_select_options" and *** the interface view into your window. Make the view as default.
Now,  you need to build the select options. Firstly create a method or insert the code in init().
DATA: lr_componentcontroller TYPE REF TO ig_componentcontroller,
        l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
create the used component
  l_ref_cmp_usage = wd_this->wd_cpuse_select_options( ).
  IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
    l_ref_cmp_usage->create_component( ).
  ENDIF.
  wd_this->m_wd_select_options = wd_this->wd_cpifc_select_options( ).
init the select screen
  wd_this->m_handler = wd_this->m_wd_select_options->init_selection_screen( ).
  wd_this->m_handler->set_global_options(
                              i_display_btn_cancel  = abap_false
                              i_display_btn_check   = abap_false
                              i_display_btn_reset   = abap_true
                              i_display_btn_execute = abap_false ).
Adding a block (type Tray) to the select-options
  wd_this->m_handler->add_block(
    i_id         = `BSC01`
    i_block_type = if_wd_select_options=>mc_block_type_tray
    i_title      = `Selection Screen` ).
Adding a parameter field to the created block
Create a reference to the type of customer number KUNNR
  CREATE DATA lr_field TYPE kunnr.
Sets the airline code initial value
  ASSIGN lr_field->* TO <fs_field>.
Add the parameter to the group
  wd_this->m_handler->add_parameter_field(
    i_id           = `KUNNR`
    i_within_block = `BSC01`
    i_obligatory   = abap_true
    i_value        = lr_field ).
FREE lr_field.
Adding a select-options field to the created block
Create a reference to the material number range table
  lr_field = wd_this->m_handler->create_range_table( `MATNR` ).
Add the select-option to the group
  wd_this->m_handler->add_selection_field(
    i_id           = `MATNR`
    i_within_block = `BSC01`
    it_result      = lr_field ).
  FREE lr_field.
The code with method "set_global_options" is used to make the buttons visible or disappear.
Its convinient to create your own button with an action instead or subscribing to the action of exceute button.
Sol. 2: Read the data.
  FIELD-SYMBOLS:
    <fs_sel_item> LIKE LINE OF lt_sel_item,
    <fs_kunnr>   TYPE kunnr,
    <fs_matnr>   TYPE ranges_matnr.
    wd_this->m_handler->get_value_of_parameter_field(
      EXPORTING i_id = 'KUNNR'
      RECEIVING r_value = p_kunnr ).
Get the selection-screen items
      wd_this->m_handler->get_selection_fields(
        IMPORTING et_fields = lt_sel_item ).
Retrieve the values from the select-options items
      LOOP AT lt_sel_item ASSIGNING <fs_sel_item>.
        CASE <fs_sel_item>-m_id.
          WHEN `MATNR`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_matnr>.
         WHEN < Other sel-option'
       ENDCASE.
     ENDLOOP.
Obtain a reference to your context node and assign the field symbols to the attributes.
Finally, you would have the data in your nodes. Now, you need to handle the coe as per your req.
Regards,
Sharath
Edited by: Sharath M G on Aug 27, 2010 9:45 AM

Similar Messages

  • How to select range for dater in BAPI_DOCUMENT_GETLIST2

    Hi All
    I have following problem with this FM BAPI_DOCUMENT_GETLIST2. I was looking a lot on different forums but I cannot find answer which corresponds to my problem.
    I have in DMS saved files for our customer and Iu2019m using object linking as
    Objlinkselection-DOKOB  =  KNA1
    Objlinkselection- OBJKY   = KUNNR.
    It works well, but it takes all doc from beginning.  Iu2019d like to make selection that final table documentdata is in range of defined range date with values 20111201 to 20111231
    Now I have to select all documents for this customer and after that I have to make loop to get correct files. And it takes a huge time and in a few years it will collaps
    LOOP AT LT_DOCUMENTDATA INTO <FS> WHERE CREATEDATE IN  rn_DATE.
    ENDLOOP.
    Any hint how to make this faster? 
    Just to avoid any misunderstandings, I'm not asking on loop speed but how to select by FM less rows based on create date.
    Thank a lot fo any hint
    Petr

    Hello Deepak,
    Thanks a lot for your answer. I have read this thread already, but it is not realy what I need. But anyway in the night I have found solution.
    I will go through table DRAW where I will get just DOCNUMS for current date range.
    Than I will select correct rows from table DRAD for selected KUNNR.
    Final set od DOCNUMS I will use as selection criteria for BAPI.
    It should help, now I go to try it.
    Thansk anyway
    Petr

  • How to set a date range for date field ?

    Dear Experts,
    Scenario:
    I have a query in validating the date field in my BSP application. My application is for maintain infotype 0023 Other/Previous Employers online by employees in the company.
    As per our design we are maintaining the all employment details of the employee both ( with in the current company / previous employment outside the company) in the same infotype.
    Every employee will have a hiring date within the SAP HR system. We consider this date as the cutoff date between current and previous employment in our application. When the employee updating the details wia BSP page I need to check the following.
    Record inside current company: Validation that, the user should only able to enter BEGIN DATE (BEGDA)  greater than or equal HIRING DATE and END DATE(ENDDA) should be greater than FROM  DATE (BEGDA).
    Record outside current Company: Validation that, the user should only able to enter BEGIN DATE (BEGDA)  less than or equal HIRING DATE and END DATE (ENDDA) should be greater than FROM  DATE (BEGDA) and less than HIRING DATE.
    Technical Requirement:
    How to set a date range for date field, i.e. how we can limit the date range in a HTMLB date field? Can this it be achieved via standard functionality of HTMLB?
    Following is the code to describe date field in my application.
        <htmlb:inputField id= "ENDDA_NEW_IN"
                          type= "date"
                    doValidate= "TRUE"
                      showHelp= "TRUE"
                      disabled= "FALSE"
                         width= "183"
                         style= "cssTextAreadate"
                         value= "<%='99991231'%>"/>
    Thanks a lot in advance for your assistance and help.
    Cibinu2026
    Edited by: cibin kuruvilla on Nov 12, 2008 11:13 AM

    Hi,
    This functionality is known to be very important and is a key part of the next major release of the JRC planned for the first half of 2008.
    Regards,
    <p>Blair Wheadon</p>
    <p>Product Manager, Crystal Reports</p>

  • Select-options for date field.

    Hi all,
    i need to give select options for Date field.How can i give that.
    Thanks & Regards
    Ravi.

    Hi Ravi,
    Use the Component WDR_SELECT_OPTIONS to include select options in Web Dynpro ABAP. Follow these steps:
    1. In your Component , "Used Componet" tab add Component WDR_SELECT_OPTIONS . Component Use can be any name that you want to give, eg SELECT_OPTIONS
    2. Go to the View where you want to include the Date Select Options. I am assuming that you already have an Attribute of Type DATS in your context.
    3. View: Properties Tab:Create Controller Usage and select
    SELECT_OPTIONS     WDR_SELECT_OPTIONS                   
    SELECT_OPTIONS     WDR_SELECT_OPTIONS     INTERFACECONTROLLER
    4. View Layout Tab:Include a View Container. In this view container we will show the Date Select Options.
    5. View Attributes Tab: Create Following two attributes:
    M_HANDLER type IF_WD_SELECT_OPTIONS
    M_WD_SELECT_OPTIONS type IWCI_WDR_SELECT_OPTIONS
    6: View Methods Tab: Create a method eg CREATE_SELECTION_SCREEN. Call this method in the WDDOINIT of the view.
    7:CREATE_SELECTION_SCREEN: Write following Code:
    * Data Declaration
      data:
            lt_range_table TYPE REF TO DATA.
      data:
            lr_componentcontroller TYPE REF TO IG_COMPONENTCONTROLLER,
            lr_componentusage TYPE REF TO IF_WD_COMPONENT_USAGE.
    * Execution
    *  Create Used Component
      lr_componentusage = wd_this->wd_cpuse_select_options( ).
      if LR_COMPONENTUSAGE->HAS_ACTIVE_COMPONENT( ) is initial.
        lr_componentusage->create_component( ).
      endif.
    *  Get pointer to interface controller of select options
      wd_this->M_WD_SELECT_OPTIONS = wd_this->wd_cpifc_select_options( ).
    * initialize selction screen
      wd_this->M_HANDLER = wd_this->M_WD_SELECT_OPTIONS->init_selection_screen( ).
    *  Create Range Table for: Date
      CALL METHOD WD_THIS->M_HANDLER->CREATE_RANGE_TABLE
        EXPORTING
          I_TYPENAME     = 'DATS'
        RECEIVING
          RT_RANGE_TABLE = lt_range_table.
    * Add Selection Field for: Date
      CALL METHOD WD_THIS->M_HANDLER->ADD_SELECTION_FIELD
        EXPORTING
          I_ID                         = '<name of date attribute in the context>'
    *      I_WITHIN_BLOCK               = MC_ID_MAIN_BLOCK
    *      I_DESCRIPTION                =
    *      I_IS_AUTO_DESCRIPTION        = ABAP_TRUE
          IT_RESULT                    = lt_range_table
    *      I_OBLIGATORY                 = ABAP_FALSE
    *      I_COMPLEX_RESTRICTIONS       =
    *      I_USE_COMPLEX_RESTRICTION    = ABAP_FALSE
    *      I_NO_COMPLEX_RESTRICTIONS    = ABAP_FALSE
    *      I_VALUE_HELP_TYPE            = IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_NONE
    *      I_VALUE_HELP_ID              =
    *      I_VALUE_HELP_MODE            =
    *      I_VALUE_HELP_STRUCTURE       =
    *      I_VALUE_HELP_STRUCTURE_FIELD =
    *      I_HELP_REQUEST_HANDLER       =
    *      I_LOWER_CASE                 =
    *      I_MEMORY_ID                  =
    *      I_NO_EXTENSION               = ABAP_FALSE
    *      I_NO_INTERVALS               = ABAP_FALSE
    *      I_AS_CHECKBOX                = ABAP_FALSE
    *      I_AS_DROPDOWN                = ABAP_FALSE
    *      IT_VALUE_SET                 =
    *      I_READ_ONLY                  = ABAP_FALSE
    *      I_DONT_CARE_VALUE            =
    *      I_EXPLANATION                =
          I_TOOLTIP                    = 'Select Date'.
    8: To Fetch Data entered in the selection field, write following code on action of button click:
      data:
            lt_date type REF TO DATA.
    FIELD-SYMBOLS:
                     <fs_date> TYPE table.
      *  retrieve Date from Select Options
      CALL METHOD WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD
        EXPORTING
          I_ID           = '<attrib_name>'
        RECEIVING
          RT_RANGE_TABLE = lt_date.
    *  assign Date Field Symbol
      ASSIGN lt_date->* to <fs_date>.
    9: Windows Window Tab: In the View Conatiner, embed the WND_SELECTION_SCREEN view from SELECT_OPTIONS component Usage of  WDR_SELECT_OPTIONS component.
    Regards,
    Reema.

  • How to use range for a field that is not in select options

    Dear All,
    I have a requirement to show Long Text of a G/L account , where G/L account is between a given range. But this field is not in select options. I have to show Long Text of this Account, if the field is in a given range. I have tried to use RANGE , but RANGE is not working here. Please help with some sample codes.
    Note: The range is too high so I cant use IN operator.
    Thanks ,
    Rosaline.

    Hi,
       Declare a range as :
    ranges : r_hkont for bseg-hkont.
    fill in the values
    r_hkont-sign = 'I'.
    r_hkont-option = 'BT'.
    r_hkont-low = '26000000'.
    r_hkont--high = '2999999'.
    append r_hkont.
    Select sgtxt from bseg into text
    where bseg-hkont in r_hkont.
    Regards,
    Srini.

  • How to select values for different fields in a report

    Beginner needs help!  I have five columns of linked data.  I want to show the counts of the number of "true" values in each column.  However when I set the first one to true none of the other rows which might be true for that instance when the first column is false show up anymore?  Any help appreciated.

    1st off how do you have your tables joined, suggest outter left joins.
    create a formula
    if (field) =true then 1 else 0 
    use manual running totals to calcualte your values
    RESET
    The reset formula is placed in a group header report header to reset the summary to zero for each unique record it groups by.
    whileprintingrecords;
    Numbervar  X := 0;
    CALCULATION
    The calculation is placed adjacent to the field or formula that is being calculated.
    (if there are duplicate values; create a group on the field that is being calculated on. If there are not duplicate records, the detail section is used.
    whileprintingrecords;
    Numbervar  X := x + ; ( or formula)
    DISPLAY
    The display is the sum of what is being calculated. This is placed in a group, page or report footer. (generally placed in the group footer of the group header where the reset is placed.)
    whileprintingrecords;
    Numbervar  X;
    X

  • Problem with select range for a character type field. Kindly Help! Urgent!

    Hi Experts,
        I have to write a report to pull data from a table BUT000 for a selected range of  BPEXT field values in selection screen.
        In the table BUT000, the BPEXT field is type char. Now what is happening is that if the user gives a range in selection screen from 1000 to 1010 the query pulls all the records where teh forst character starts from 1.
    For example if the table has
        BPEXT
        1
        10
        100
        101
        1000
        1001
        1002
        1005
        1010
        20
        200
        2000
    Then my query pulls
       BPEXT
        101
        1000
        1001
        1002
        1005
        1010
       Instead it should pull only
       BPEXT
        1000
        1001
        1002
        1005
        1010
        My guess this is because the BPEXT field is of CHAR type instead of numeric.
        What shall i do to solve this problem? Kindly help please!   
    Thanks
    Gopal
    Message was edited by:
            gopalkrishna baliga

    Hi Chakradhar,
        How to find the conversion exit for BPEXT field?
        How to use the conversion exit in a select query in my ABAP report? Any sample code will be really helpfull.
       Please help!
    Thanks
    Gopal

  • Query to find first and last call made by selected number for date range

    Hi,
    query to find first and last call made by selected number for date range
    according to filter:
    mobile_no : 989.....
    call_date_from : 25-april-2013
    call_date_to : 26-april-2013
    Please help

    Hi,
    It sounds like you want a Top-N Query , something like this:
    WITH    got_nums   AS
         SELECT     table_x.*     -- or list columns wanted
         ,     ROW_NUMBER () OVER (ORDER BY  call_date      ) AS a_num
         ,     ROW_NUMBER () OVER (ORDER BY  call_date  DESC) AS d_num
         FROM     table_x
         WHERE     mobile_no     = 989
         AND     call_date     >= DATE '2013-04-25'
         AND     call_date     <  DATE '2013-04-26' + 1
    SELECT  *     -- or list all columns except a_num and d_num
    FROM     got_nums
    WHERE     1     IN (a_num, d_num)
    ;This forum is devoted to the SQL*Plus and iSQL*Plus front ends. This question doesn't have anything to do with any front end, does it? In the future, you'll get better response if you post questions like this in the PL/SQL.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the SQL forum FAQ {message:id=9360002}

  • How to find the Ranges for a field ?

    Hello All,
               Can anyone tell me how to find the ranges for a field.
    <b>1</b>, i.e say I want the Ranges Structure for the field LIFNR.
        The ranges structure for this is "<b>RANGE_LIFNR</b>".
        This I used in my Program since I know it previously.
        But now I want the ranges structure for the field <b>VBELN (Delivery Document).</b>
        I  don't know what is it !!!!!
    <b>2</b>, Is there any procedure to know the ranges structure for a particular field ?
    Regards,
    Deepu.K

    Hi Deepu,
    Using 'Where used list' you can able to find out RANGES tables.
    For VEBLN range table is --> CRM_AC_ASSIGN_VBELN
    If you using a program defined as shown below.
    DATA: r_vbeln type ranges of vbeln.
    The above statement also creates ranges structure in Runtime.
    Procedure finding range table structures
    go to SE37 -> Enter domain or dataelement value
    Go to where used list --> search for 'Structures'
    After getting all structure  --> Click 'SEARCH' butoon in tool bar --> Search for 'RANGES' word
    You can get all ranges tables in the search window
    If helps plz reward points.
    Regards
    Bhupal Reddy

  • Date range using "Date Field" from basic component

    Hello Everyone,
    I have been trying to create date range option available on the dashboard based on 2 Date Filed component.
    Backend for this Dashboard is BW with using BEx query. I have a info object (Z_Date)
    Now I want to have 2 date box using Date Field component 1. Start Date 2. End Date.
    I have tried following
    1. Start Date - on Select
    DS_1.setFilter("Z_Date", {"low":StartDate.getDate()});
    2. End Date - on Select
    DS_1.setFilter("Z_Date", {"High":EndDate.getDate()});
    both the scripts do not have any problem but it doest work as it is suppose to be.
    I have also tried based on following How to write script for DATE Range
    But no luck so far.
    Please share if any one have achieved date range working as mentioned.
    Thanks,
    Rajan

    Hi,
    Set Default Date in Both Date Prompts initially .
    1. Start Date - on Select
    var startDate = StartDate.getDate();
    var endDate = EndDate.getDate();
    var varRange = startDate + " - " + endDate;
    DS_1.setFilterExt("Z_SDPCD", varRange);
    2. End Date - on Select 
    var startDate = StartDate.getDate();
    var endDate = EndDate.getDate();
    var varRange = startDate + " - " + endDate;
    DS_1.setFilterExt("Z_SDPCD", varRange);
    Or
    Select Dates First Then Provide a Button (Done) .
    And write code On Click Event of that Button
    var startDate = StartDate.getDate();
    var endDate = EndDate.getDate();
    var varRange = startDate + " - " + endDate;
    DS_1.setFilterExt("Z_SDPCD", varRange);

  • Search Help in Select - Options for Time field

    Hi,
    I have a select option which is a  time field.
    For date field the F4 help is automatically generated.
    How to get F4 help for time field.
    Regards,
    Remo

    Selection-Options or normal field - it doesn't matter.  There is no system delivered value help for a time field. This is documented in the online help:
    There is no automatic F4 help for data element TIMS.
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/9f724642314aabe10000000a42189b/frameset.htm
    You would have to create your freely programmed value help if you want something like the time value help available in the SAPGUI.

  • When we give wildcard for date field

    can we give wild card for date field in range table.
    my code is this
    RAnges r_erdat for mara-erdat
    r_erdat-sign = 'I'.
    r_erda-option =  'CP'.
    r_erdat-low = '2009'.*
    append r_erdat.
    select erdat from mara
      INTO CORRESPONDING FIELDS OF TABLE itab
      where erdat
      in
       r_erdat.
    Moderator Message: Basic date questions are not allowed.
    Edited by: kishan P on Oct 5, 2010 10:46 AM

    <<Don't answer questions that break the rules. Date questions are not permitted>>
    Hi,
           Instead you can take the entire range for that particular year.
    r_erdat-sign = 'I'.
    r_erda-option = 'BT'.
    r_erdat-low  = '20090101'.   <- begin date
    r_erdat-high = '20091231'.   <- end date
    append r_erdat.
    Regards,
    Srini.
    Edited by: Matt on Oct 5, 2010 12:46 PM

  • Can we use same number range for different  fields

    can we use same number range for different  fields. how can we see the number range defined for a particular field

    Hai,
    Yes you can have same number range for different fields  by using the same domain to the data elements that are user to your two fields.
    To see the range:
    Go to SE11,Type table Name open it-->double click on the DataElement adjasent to the field name ,You will get Domian ,Double click on Domain You will get Domain.There See Value range option .Value range cam also be defined by Value Table which will also at the Doamin level.
    <b>Reward points if it helps you.</b>
    Regds,
    Rama.Pammi

  • Mandatory for Date field

    Hi All,
         I want to display to Mandatory field if date field is blank or null...
    But this code only valiadate ,the Entered date correct or not...
    So how to display the Mandatory date field..
    Please suggest me ...What is the error..
         IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
              Object attributeValue = wdContext.currentDateFieldsElement().getAttributeValue(fieldName);
              Date theDate =
                   (Date) wdContext.currentDateFieldsElement().getAttributeValue(
                        fieldName);
              IWDAttributeInfo attributeInfo =
                   wdContext.nodeDateFields().getNodeInfo().getAttribute(fieldName);
              Calendar c = Calendar.getInstance();
              c.set(Calendar.HOUR_OF_DAY, 0);
              c.set(Calendar.MINUTE, 0);
              c.set(Calendar.SECOND, 0);
              c.set(Calendar.MILLISECOND, 0);
              Date currentDate = new Date(c.getTimeInMillis());
              if (theDate.before(currentDate)) {
    //       Throw an error message
                msgMgr.reportContextAttributeMessage(
                               wdContext.currentDateFieldsElement(),
                               attributeInfo,
                               IMessageRequisitionForm.MISSING_INPUT,
                               new Object[] { fieldLabel },
                               true);
    Please Tel me ......
    Thanks & regards
    Mathi

    Hi,
    Thanks for ur reply...
    I tel u what i do..
    1.first i set property...(reauired and set th label for)
    2.i code in method take a current date
    IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
              Object attributeValue =
                   wdContext.currentDateFieldsElement().getAttributeValue(fieldName);
              Date theDate =
                   (Date) wdContext.currentDateFieldsElement().getAttributeValue(
                        fieldName);
              IWDAttributeInfo attributeInfo =
                   wdContext.nodeDateFields().getNodeInfo().getAttribute(fieldName);
              Calendar c = Calendar.getInstance();
              c.set(Calendar.HOUR_OF_DAY, 0);
              c.set(Calendar.MINUTE, 0);
              c.set(Calendar.SECOND, 0);
              c.set(Calendar.MILLISECOND, 0);
              Date currentDate = new Date(c.getTimeInMillis());
              if (theDate instanceof Date) {
              <b>removeLeadingZeroes</b>(
                                  wdContext.currentDateFieldsElement().getAttributeAsText(
                                       fieldName));
                   if (theDate.before(currentDate))
                             //       Throw an error message
                             msgMgr.reportContextAttributeMessage(
                                  wdContext.currentDateFieldsElement(),
                                  attributeInfo,
                                  IMessageRequisitionForm.DATE_IS_IN_PAST,
                                  new Object[] { fieldLabel },
                                  true);
    public java.lang.String <b>removeLeadingZeroes</b>( java.lang.String fieldName )
                  if (fieldName == null)
                   return null;
              int i = 0;
              int n = fieldName.length();
              while (i < n) {
                   if (fieldName.charAt(i) != '0')
                        break;
                   ++i;
              return fieldName.substring(i);
    if could not give removeLeadingZeroes it produced error (runtime exception) (Null pointer exception)..
    My Question is...Mandatory is worked if date is incorrect....
    I want to set mandatory if that field name is null or balnk...
    Please suggest me ....what is my mistake...
    Thanks & regards
    Mathi

  • Select option for date

    i want give default values in select option for date (for a period)
    I used
    SELECT-OPTIONS y_s_mnth FOR y_v_dt_month default first to last OPTION BT.
    first and last are dates.
    I am getting error dialog box....specify ranges...
    Please give sample code..

    Hi Suhas,
    I hope this code will help you.  Reward me if it is helpful.
    select-options : y_s_mnth FOR sy-datum.
    initialization.
    y_s_mnth-sign   = 'I'.
    y_s_mnth-option = 'BT'.
    y_s_mnth-low    = sy-datum - 30.    "first_day
    y_s_mnth-high   = sy-datum.         "last_day
    append y_s_mnth.
    clear  y_s_mnth.
    Regards,
    Sagar

Maybe you are looking for