JPQL select based on OneToMany field

I have these entities:
This is a person
@Entity
@Table(name = "Person", schema = SCHEMA)
public class Person{
//TODO: select unique field. Now sourceUrl plays role of unique field.
     @Id
     @GeneratedValue
     private int id;
     @OneToMany(fetch=FetchType.EAGER, cascade={CascadeType.ALL}, mappedBy="person")
     private List<PoliticalPartyMembership> politicalPartyMemberships;
//other fields, getters and setters
}Person can have several PoliticalPartyMemberships (some kind of his political history)
@Entity
@Table(name = "PoliticalPartyMembership", schema = SCHEMA)
@IdClass(PoliticalPartyMembership.PK.class)
public class PoliticalPartyMembership {
     @Id
        @ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.MERGE, CascadeType.REFRESH, CascadeType.PERSIST})
     private Person person;
     @Id
     @ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.MERGE, CascadeType.REFRESH, CascadeType.PERSIST})
     private PoliticalParty politicalParty;
     @Id
     private Date dateIn;
     private Date dateOut;
     public static final class PK implements Serializable {
          public int person;
          public String politicalParty;
          public Date dateIn;
          @Override
          public boolean equals(Object o) {
               if (!(o instanceof PK))
                    return false;
               PK oPK = (PK)o;
               return this.politicalParty.equals(oPK.politicalParty)  && this.person == oPK.person && this.dateIn.equals(oPK.dateIn);
          @Override
          public int hashCode() {
               return ((person == 0) ? 0 : new Integer(person).hashCode())
               ^ ((politicalParty == null) ? 0 : politicalParty.hashCode())
               ^ ((dateIn == null) ? 0 : dateIn.hashCode());
//other fields, getters and setters
}And finally PoliticalParty entity
@Entity
@Table(name = "PoliticalParty", schema = SCHEMA)
public class PoliticalParty {
     @Id
     private String fullName;
     private String abbreviation;
     private String shortName;
//other fieldssetters and getters
}I have to make a query with these parameters:
1. PoliticalParty name
2. date period (dateIn and dateOut of politicalPartyMembership)
I want to retrieve all persons which were in specified PoliticalParty (by name) in the specified period (dateIn dateOut)
How can I do that using query, I don't understand. Is it possible?
I have only two Ideas:
1. Very stupid: get all (oh my god) Persons and examine their field named PoliticalPartyMembership. It's easy, stupid and slow
2. Not very stupid: select all PoliticalPartyMemebership with query like
Query q = em.createQuery("select ppm from PoliticalPartyMembership ppm where ppm.dateIn=: dateIn and dateOut=: date out and ppm.politicalParty.fullName=:fullname");Then, I'll get all PoliticalPartyMemeberships and field Person will help me to retrieve persons I need.
Are there any other solutions?

Hi Steve,
You cannot sort on a formula field that uses printime functions or executes in the 'whileprintingrecords' phase - example would be running totals or formulae based on shared variables from the subreport.
What you can however do is, suppress records where the formula returns zero.
To do this, go to the Section Expert > Select the section you wish to suppress > Click the formula button beside 'Suppress' and use this code"
{@Formula_name} = 0
-Abhilash

Similar Messages

  • Infopackage Abap Routine (Selection based on other fields?)

    Dear Friends,
    I know that Abap routine is used in infopackage to select or restrict using complex data selection.
    My requirement is to restrict Material no field based on 4 other fields. Is that possible?
    Actual condition is  to load Material no only if other 4 fields combination is new.
    Pls help.
    Guru

    Hi,
    Yes you can do this at infoPackage level using the ABAP routine.
    First read the Active Table of the DSO into internal table and do a lookup for the required four fields combination.
    If these four field are new allow the material number.
    Refer the below link for more help.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/a05ac9fa-f44c-2c10-dbb8-ef54c102707c
    Regards
    Manjula.B

  • How to creat a Data provider  based on different fields in SAP BW ?

    Hi,
    Experts,
    There are  20 fields  of  Plant Maintainace  like : 
    SWERK
    BEBER
    STORT
    TPLNR
    EQUNR
    INGRP
    QMDAT   ---peroid
    STTXT
    QMDAT  - Date of Notification
    QMNUM
    QMTXT
    QMART
    AUSVN
    AUZTV
    AUSBS
    AUZTB
    AUSZT
    ERNAM
    QMDAB
    AUFNR
    I  want to creat a  Report based upon these fields  ?
    For that I h'v  checked the relevant Fields to the   existing standard  Datasource  in Bw side   &
    Checked  cubes   created  based upon these Datasource  in Bw side !
    i h'v found  some fields are  existing different cubes & some are  missing .
    How to creat a Data provider  based on different fields in SAP BW ?
    plz suggest      !!!!!!!
    Thanx,
    Asit
    Edited by: ASIT_SAP on Jul 15, 2011 6:25 AM
    Edited by: ASIT_SAP on Jul 15, 2011 6:27 AM
    Edited by: ASIT_SAP on Jul 15, 2011 12:37 PM

    Hi Lee, Please see below..
    DECLARE @Machine2 TABLE
    DispatchDate DATE
    INSERT INTO @Machine2 VALUES ('2014/02/01'), ('2014/02/02'), ('2014/02/03')
    DECLARE @DateFrom DATE
    SELECT @DateFrom = DATEADD(D,1,MAX(DispatchDate)) FROM @Machine2
    SELECT @DateFrom AS DateFrom
    Please mark as answer, if this has helped you solve the issue.
    Good Luck :) .. visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.

  • How to find the list of  transaction code based on a  field ?

    Hi  Gurus
    I have a unique requirement.We are adding a  new field into our system and want to know which all t-code  contains that field ?  So that we can update the  user training manual. Can some one tell me the ways and means of  finding the list of all the t-code ( or where used e.g functional area ) based on  " a field" ?
    Thanks in advance
    SN

    Hi,
    1. Tcode KS02.
    2. click on the text "Cost Center"
    3. hit F1
    4. Click on the technical information
    5. in the next screen double click on Field name :KOSTL
    6. Select the row for the component KOSTL
    7. Click on the display list
    8. In the next screen, in the object name:KBAS
    Drilldown to transactions.
    Here you get a complete list of the transactions.
    Hope its useful.
    thanks.

  • Search help for a field in table control based on another field value

    Hi,
    I want to attach the Search help for a field in table control based on another field value.
    Please help me asap.
    Will be highly rewarded

    HI,..
      Check these links
    search help in table control
    Re: How to create Search Help for a field in Table control !!
    How to create Search Help for a field in Table control !!
    F4 Help In Table Control
    Control table F4 help
    Problem in F4 help in screen field
    check this code
    DATA: BEGIN OF it_value4 OCCURS 0,
             TEXTCODE  LIKE  ZXX-TEXTCODE,
             TEXTDESC  LIKE  ZXX-TEXTDESC,
           END OF it_value4.
      progname = sy-repid.
      dynnum   = sy-dynnr.
             SELECT TEXTCODE TEXTDESC
               FROM  xxxx
               INTO CORRESPONDING FIELDS OF TABLE<b> it_value4</b>
              WHERE  LOSS_CODE =<b> IT_VALUE1 .</b>
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield    = 'TEXTCODE'
          dynpprog    = progname
          dynpnr      = dynnum
          dynprofield = 'ITVALUE-TEXTCODE'  "-->UR  4 th filed value in screen
          value_org   = 'S'
        TABLES
          value_tab   = it_value4.
    endmodule.
    Message was edited by:
            veereshbabu ponnada

  • Populate a table field based on another field in the same table

    Hi,
        I have a table with fields collection profile and collection prfile text. When maintaining this table, the collection profile name should appear automatically ( from table UDM_COLL_GRPT) based on the collection profile entered.. In UDM_COLL_GRPT, collection profilr name is not a primary key. Please let me know how to do this.
    Thanks in advance,
    Jissa

    Guess you could make use of the event 05 from the TMG events to make the appropriate selections and populate the field.
    Vikranth

  • Change field value in a table, based on another field value in the same row (for each added row)

    Please Help, I want to change field value in a table, based on another field value in the same row (for each added row)
    I am using this code :
    <HTML>
    <HEAD>
    <SCRIPT>
    function addRow(tableID) {
    var table = document.getElementById(tableID);
    var rowCount = table.rows.length;
    var row = table.insertRow(rowCount);
    var colCount = table.rows[0].cells.length;
    for(var i=0; i<colCount; i++ ) {
    var newcell = row.insertCell(i);
    newcell.innerHTML = table.rows[1].cells[i].innerHTML;
    switch(newcell.childNodes[0].type) {
    case "text":
    newcell.childNodes[0].value = "";
    break;
    case "checkbox":
    newcell.childNodes[0].checked = false;
    break;
    case "select-one":
    newcell.childNodes[0].selectedIndex = 0;
    break;}}}
    function deleteRow(tableID) {
    try {var table = document.getElementById(tableID);
    var rowCount = table.rows.length;
    for(var i=0; i<rowCount; i++) {
    var row = table.rows[i];
    var chkbox = row.cells[0].childNodes[0];
    if(null != chkbox && true == chkbox.checked) {
    if(rowCount <= 2) {
    alert("Cannot delete all the rows.");
    break;}
    table.deleteRow(i);
    rowCount--;
    i--;}}}catch(e) {alert(e);}}
    </SCRIPT>
    </HEAD>
    <BODY>
    <INPUT type="button" value="Add Row" onClick="addRow('dataTable')" />
    <INPUT type="button" value="Delete Row" onClick="deleteRow('dataTable')" />
    <TABLE id="dataTable" width="350px" border="1">
    <TR>
    <TD width="32"></TD>
    <TD width="119" align="center"><strong>Activity</strong></TD>
    <TD width="177" align="center"><strong>Cost</strong></TD>
    </TR>
    <TR>
    <TD><INPUT type="checkbox" name="chk"/></TD>
    <TD>
    <select name="s1" id="s1">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    </select>
    </TD>
    <TD><input type="text" name="txt1" id="txt1"></TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>

    Hi,
    Let me make sure u r working with table control.
    First u have to create a event(VALIDATE) to do the validation.
    Inside the event,
    1. First get the current index where user has pointed the curson
    2. Once u get the index read the internal table with index value.
    3. Now u can compare the col1 and col2 values and populate the error message.
    1. DATA : lo_elt TYPE REF TO if_wd_context_element,
                   l_index type i.
    lo_elt = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
         CALL METHOD LO_ELT->GET_INDEX( RECEIVING  MY_INDEX = l_index.
    above code should be written inside the event.
    Thanks,

  • Select a number of fields between one field and another

    Hello,
    Is there any way to make a SELECT to show a number of fields between one field and another,
    without writting all the fields one by one ?
    For example, I have one table with these fields:
    TABLE EMPLOYEE:
    ID_EMPLOYEE NAME PHONE CAR AGE MARRIED
    and I just want to make a SELECT who shows only fields from NAME to AGE, but i don't want to
    write in the SELECT all the fields one by one.
    Is this possible?
    Thank you very much.
    Sorry for my english it's not very good.

    Swam wrote:
    Hello,
    Is there any way to make a SELECT to show a number of fields between one field and another,
    without writting all the fields one by one ?
    For example, I have one table with these fields:
    TABLE EMPLOYEE:
    ID_EMPLOYEE NAME PHONE CAR AGE MARRIED
    and I just want to make a SELECT who shows only fields from NAME to AGE, but i don't want to
    write in the SELECT all the fields one by one.
    Is this possible?
    Thank you very much.
    Sorry for my english it's not very good.If you use the DBMS_SQL package to execute your query you can reference the columns by position rather than name.
    One examples of using DBMS_SQL package:
    SQL> ed
    Wrote file afiedt.buf
      1  DECLARE
      2    cur       PLS_INTEGER := DBMS_SQL.OPEN_CURSOR;
      3    cols      DBMS_SQL.DESC_TAB;
      4    ncols     PLS_INTEGER;
      5    v_min_col NUMBER := 2;
      6    v_max_col NUMBER := 4;
      7    v_val     VARCHAR2(4000);
      8    v_bindval VARCHAR2(4000);
      9    v_ret     NUMBER;
    10    d         NUMBER;
    11  BEGIN
    12    -- Parse the query.
    13    DBMS_SQL.PARSE(cur, 'SELECT * FROM emp', DBMS_SQL.NATIVE);
    14    -- Retrieve column information
    15    DBMS_SQL.DESCRIBE_COLUMNS (cur, ncols, cols);
    16    -- Display each of the column names and bind variables too
    17    FOR colind IN v_min_col..v_max_col
    18    LOOP
    19      DBMS_OUTPUT.PUT_LINE ('Column:'||colind||' : '||cols(colind).col_name);
    20      DBMS_SQL.DEFINE_COLUMN(cur,colind,v_bindval,4000);
    21    END LOOP;
    22    -- Display data for those columns
    23    d := DBMS_SQL.EXECUTE(cur);
    24    LOOP
    25      v_ret := DBMS_SQL.FETCH_ROWS(cur);
    26      v_val := NULL;
    27      EXIT WHEN v_ret = 0;
    28      FOR colind in v_min_col..v_max_col
    29      LOOP
    30        DBMS_SQL.COLUMN_VALUE(cur,colind,v_bindval);
    31        v_val := LTRIM(v_val||','||v_bindval,',');
    32      END LOOP;
    33      DBMS_OUTPUT.PUT_LINE(v_val);
    34    END LOOP;
    35    DBMS_SQL.CLOSE_CURSOR (cur);
    36* END;
    SQL> /
    Column:2 : ENAME
    Column:3 : JOB
    Column:4 : MGR
    SMITH,CLERK,7902
    ALLEN,SALESMAN,7698
    WARD,SALESMAN,7698
    JONES,MANAGER,7839
    MARTIN,SALESMAN,7698
    BLAKE,MANAGER,7839
    CLARK,MANAGER,7839
    SCOTT,ANALYST,7566
    KING,PRESIDENT,
    TURNER,SALESMAN,7698
    ADAMS,CLERK,7788
    JAMES,CLERK,7698
    FORD,ANALYST,7566
    MILLER,CLERK,7782
    PL/SQL procedure successfully completed.
    SQL>Of course, if you were going to do this properly you would bind the correct datatypes of variables based on the types of the columns (the type information is also available through the describe information)

  • Fill DDL based on other field values in offline interactive adobe form

    Hi,
    I have a requirement where in i need to fill the values for a dropdown list  based on 3 other field values in offline adobe interactive forms which uses web service to interact with SAP.
    Note: I read many blogs and posts in SDN , but couldn get much info ab the same, so posting a new thread.
    Thank you.
    Regards,
    Soumya

    Hi Soumya,
    It is possible but a little bit tough and will make your form heavier.
    The solution is advisable only when there is not very much data required for the drop down(May be not more than 500 values as it will create performance issue).
    You can create a hidden table on the form contaning data for all the combinations. Depending on the selection of another 3 fields you can write the code to select only those values from this hidden table which are applicable to that selection. These values you can add to the drop down list removing the previous values.
    Only you have to do is on calculate or vlaidate event of target DDL you have to write your code.
    Pseudocode:
    1. Clear your DDL using deleteItem() method.
    2. Loop at your hidden table.
    3. Inside the loop check for applicable entries depending on selection in other 3 fields.
    4. Select the appropriate vlaues
    5. Add using additem method().
    Refer formCalc or JavaScript help for the appropriate code.
    Hope this will be helpfull.
    Regards,
    Vaibhav

  • Change the sort order (ascending/descending) based on parameter field

    I have created a formula on a subreport to change sorting based on variables.
    select {?Pm-@Sorting}
    case "property_type_desc ASC" :
    {owned_property.property_type_desc}
    case "property_type_desc DESC" :
    {owned_property.property_type_desc}
    default:
    ({owned_property.property_type_cd}; )
    how can I change the sort order ascending and descending using the formula??
    Thanks, Jessica

    Try this
    1. Create a parameter with 2 default values in the picklist: Descending and Ascending.
    NOTE:
    In Crystal Reports version 5 or 6, it is not possible to have a pick a parameter value from a list. The user must enter a specific value, guided by the prompting text. For example : To Sort in Ascending order type A, to sort in Descending order type D.
    u2022 On the 'Insert' menu, click 'Parameter', then click 'New'.
    u2022 Type the name and prompting text for the parameter in the corresponding boxes.
    u2022 In the 'Type' box, click 'String'.
    u2022 Click 'Set Default'.
    u2022 In the 'Value to add' box, type 'Descending' then click '>' to move it to the 'Default Values' list.
    u2022 Repeat the above step for 'Ascending'.
    u2022 Click 'OK', then click 'OK' again to return to the report.
    2. Create 2 formulas based on the field you want to change the sort direction on:
    u2022 On the 'Insert' menu, click 'Formula', then click 'New'.
    u2022 Create this formula:
    @Asc
    If {?Parameter} = "Ascending" then
    u2022 Save this formula and close the Formula Editor. This brings you back to the Formula tab of the Insert Fields dialog box.
    u2022 Click 'New' and create this formula:
    @Des
    If {?Parameter} = "Descending" then
    u2022 Save this formula and close the Formula Editor.
    u2022 Click 'Close' to return to the report.
    4. Sort the report based on these two formulas.
    u2022 On the 'Report' menu, click 'Sort Records'.
    u2022 In the 'Report Fields' list, click {@Asc} and move it to the 'Sort Fields' list.
    u2022 Under 'Sort Direction', click 'Ascending'.
    u2022 In the 'Report Fields' list, click {@Des} and move it to the 'Sort Fields' list.
    u2022 Under 'Sort Direction', click 'Descending'.
    u2022 Click 'OK' to return to the report.
    Once you preview the report you will be prompted to select a parameter value, which will determine how the report is sorted.
    Regards,
    Raghavendra

  • Ordering/Ranking based on Character field

    Hi All,
    I need to ordering/Rank a column based on varchar field.
    Here is my input
    Create table #InputTmp
    CustomerNumber Varchar(10),
    AccountNumber Varchar(10)
    Insert into #InputTmp
    Select '1234','123121'
    Union All
    Select '1234','4728272'
    Union All
    Select '3421','3234'
    Union All
    Select '434','232122'
    Expected output:
    here because customer number is same (1234) for first records i need assign 1 to 123121 and 2 to 4728272. if the customer number is not repeating then i have populate 1 in ordering field.
    I have do it without using WITH clause.
    Appreciate your inputs.
    Regards,
    Eshwar.
    Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.

    Out of curiosity, why without WITH clause?
    Create table #InputTmp
    CustomerNumber Varchar(10),
    AccountNumber Varchar(10)
    Insert into #InputTmp
    Select '1234','123121'
    Union All
    Select '1234','4728272'
    Union All
    Select '3421','3234'
    Union All
    Select '434','232122'
    select t.*
    from
    (SELECT *, RANK() OVER (PARTITION BY CustomerNumber ORDER BY AccountNumber) as Ordering
    FROM #InputTmp t
    ) t
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • Making a DFF field mandatory based on another field

    Hello All,
    We have a requirement where in we need to make a DFF field mandatory based on another field.
    example:
    DFF has two fields :
    Filed1 : values 'Email', 'Fax'
    Filed2
    If 'Email' is selected in 'Field1' then Field2 should become mandatory.
    Any inputs on this will be really helpful.
    Thanks & Regards,
    Satya.

    hi kumar3a,
    recently, i spent considerable amount of time wracking my brain on a similar problem. the nearest i came to a solution was when i used a forms personalisation. mind you, forms personalisation will not work directly on the DFF window, so it has to be approached in a roundabout sort of way.
    i got this information from an Oracle Support personnel - MOS Note 1078348.1.
    i would start with the flexfield segment as "not required", and then using Forms Personalization, i would make it "required". i would try to figure out how to establish a condition where the previous 'required' flexfield segment's value is checked to see if this 'not required' segment needs to be made 'required'. in theory, this should solve the issue. i gave up on it because the forms personalisation would need to cover WHEN-VALIDATE trigger event, and we had close to 100 validations going on through other preexisting forms personalisations, which rendered it near impossible to employ this method.
    best regards.

  • Choose field from joined table based on another field?

    Good morning!
    Is it possible to select a field from a joined table row based on another field? Consider the following data in the CVALUES table:
    ID  C1   C2    C3    C4    C5    C6
    T1  9.6  10.3  12.4  19.6  19.6    0
    T7  9.6  10.4     0     0     0    0
    T3  8.2   9.9  11.4  19.6  19.6    0
    T8  8.3  10.7  13.5  20.7     0    0
    T5  9.4  10.3  12.7  22.9  19.6    0
    ...And the following data in the MDETAIL table:
    ID           MDATE        CNUM     ...
    T1  03/28/2012 18:00:00    4
    T1  03/28/2012 18:00:00    1
    T8  03/29/2012 06:00:00    6
    T8  03/29/2012 06:00:00    5
    ...I want to get the column from CVALUES corresponding to the CNUM field in the MDETAIL table. I'm currently doing this:
    SELECT m.t1, m.mdate,
           CASE WHEN m.cnum = 1 THEN c.c1
                WHEN m.cnum = 2 THEN c.c2
                WHEN m.cnum = 3 THEN c.c3
                WHEN m.cnum = 4 THEN c.c4
                WHEN m.cnum = 5 THEN c.c5
                WHEN m.cnum = 6 THEN c.c6 END AS cvalue
      FROM mdetail m
      JOIN cvalues c ON m.id = c.idThe records in the CVALUES table are unique; only one row per ID.
    This method works, and it's fast but it's messy code and I think there has to be a better way to do it. I use the cvalue value in several calculations so every calculation I use it in has this giant glob of CASE in it!

    Since you're comparing the same column against scalar values, the CASE statement could be simplified in a similar way :
    CASE m.cnum
      WHEN 1 THEN c.c1
      WHEN 2 THEN c.c2
      WHEN 3 THEN c.c3
      WHEN 4 THEN c.c4
      WHEN 5 THEN c.c5
      WHEN 6 THEN c.c6
    END AS cvalueSince performance is not the issue here, now it depends on what you consider "more readable".
    Using a one-liner piece of code certainly makes the query looks less bulky, but I won't be so sure about readability and immediate understanding.

  • Jump from alv report to qa03 screen based on PRUEFLOS field

    Hi experts,
    I developed one alv report ,in that one field name is PRUEFLOS (inspection lot number).I want to jump from alv report
    to QA03 screen based on PRUEFLOS field.I wrote in this way but i didn't get.
    FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM SELFIELD TYPE SLIS_SELFIELD.
      CASE SELFIELD-FIELDNAME.
        WHEN 'PRUEFLOS'.
          READ TABLE T_FINAL INDEX SELFIELD-TABINDEX.
          SET PARAMETER ID  'QLS' FIELD T_FINAL-PRUEFLOS.
          CALL TRANSACTION 'QA03'   AND SKIP FIRST SCREEN.
      ENDCASE.
    ENDFORM.
    what is the problem ?pls help me in this.

    Hi Ram,
    Recheck:
    1) You have passed 'FORM USER_COMMAND' in 'I_CALLBACK_USER_COMMAND' while calling f.m. for ALV displa, and
    2) You have checked the value of user command, i.e.
    FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM SELFIELD TYPE SLIS_SELFIELD.
    CASE SY-UCOMM.
    WHEN '&IC1'.
    CASE SELFIELD-FIELDNAME.
    WHEN 'PRUEFLOS'.
    READ TABLE T_FINAL INDEX SELFIELD-TABINDEX.
    SET PARAMETER ID 'QLS' FIELD T_FINAL-PRUEFLOS.
    CALL TRANSACTION 'QA03' AND SKIP FIRST SCREEN.
    ENDCASE.
    ENDCASE.
    ENDFORM.
    Regards,
    Birendra

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

Maybe you are looking for

  • I cant seem to import video clips from lumix fz35 into iphoto '11

    Help please.......i dont know what im doing wrong,but i cant seem to do this,has anyone got any advice?

  • Problem with transient attribute attach to standard vo from the controller

    Hi all, I attached two transient attributes to the standard vo through controller. Then i passed values to these fields from controller based on another field in the standard vo. I created two columns in the table without given the view instance and

  • Unable to set Media location in iTunes

    Hi All, I have just finished the Yosemite upgrade and want to set my media folder in iTunes. In iTunes>Preferences>Advanced I select my music folder, (held on a separate internal drive), and then press Scan For Media, nothing happens, no media locate

  • Constantly disconnected, is it the modem?

    In the last month or so, my modem has been disconnecting every 3 to 7 minutes, sometimes I can stay connected up to 20 minutes, once in a great while it will remain connected over an hour. About every 6 attempts, I get a 'can't connect to server, che

  • Time machine error messages

    I have an external 1 tb backup drive (Seagate) which I've set up for TIME MACHINE.  Although it appears to be working (lights up, able to access back dates), I keep getting a messate "Time maching couldn't complete the backup to "Untitled" (my extere