Date field initial; Select clause.

Hi All,
I have a requirement where I need to select all the records where the data field (AUFK- IDAT2) is INITIAL.
I have given the query:
SELECT
A~AUFNR
A~AUFPL
INTO TABLE IT_ITAB
FROM AFKO AS A INNER JOIN AUFK AS U
ON AAUFNR = UAUFNR
WHERE
U~AUART = 'ZCPM' AND
U~IDAT2 = '00000000' AND
U~WERKS BETWEEN PLANT-LOW AND PLANT-HIGH AND
A~GSTRP BETWEEN CREATEDT-LOW AND CREATEDT-HIGH.
however, it gives an error on this line: U~IDAT2 = '00000000' .
Please reply urgently.
Thanks....

Hi Vishal,
According to ur query I have written the code as this :
tables :
  afko,
  aufk.
select-options:
  plant for aufk-werks,
  CREATEDT for afko-gstrp.
data :
  begin of it_itab   occurs 0,
    aufnr like afko-aufnr,
    aufpl like afko-aufpl,
    auart like aufk-auart,
    IDAT2 like aufk-idat2,
    WERKS like aufk-werks,
    GSTRP like afko-gstrp,
  end of it_itab.
SELECT
A~AUFNR
A~AUFPL
INTO TABLE IT_ITAB
FROM AFKO AS A INNER JOIN AUFK AS U
ON A~AUFNR = U~AUFNR
WHERE
U~AUART = 'ZCPM' AND
U~IDAT2 = '00000000' AND
U~WERKS BETWEEN PLANT-LOW AND PLANT-HIGH AND
A~GSTRP BETWEEN CREATEDT-LOW AND CREATEDT-HIGH.
It was not giving me any error.
But just change and try with the following select query.
SELECT
A~AUFNR
A~AUFPL
INTO TABLE IT_ITAB
FROM AFKO AS A INNER JOIN AUFK AS U
ON A~AUFNR = U~AUFNR
WHERE
U~AUART = 'ZCPM' AND
U~IDAT2 is null AND
U~WERKS BETWEEN PLANT-LOW AND PLANT-HIGH AND
A~GSTRP BETWEEN CREATEDT-LOW AND CREATEDT-HIGH.
Regards,
Swapna.

Similar Messages

  • Problem with date fields in where clause after changing driver

    Hi,
    We have changed the oracle driver we use to version 10
    and now we have some trouble with date-fields.
    When we run this SQL query from our Java program:
    select *
    from LA_TRANS
    where LA_TRANS.FROM_DATE>='20040101' AND LA_TRANS.FROM_DATE<='20041231'
    We get this error code:
    ORA-01861: literal does not match format string
    The query worked fine whit the previous driver.
    Is there some way I can run a SQL query with date fields
    as strings in the where clause?
    Thanks!

    Keeping the argument of standard SQL or not aside, comparing DATE columns to a constant string (which looks like a date in one of the thousands of the formats available, but not in others) is NOT one of the best programming practices and leads to heartburn and runtime errors (as you have seen yourself).
    I would rather compare a DATE to a DATE.
    Also, constants like that would be another issue to fix in your code:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:6899751034602146050::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:528893984337,

  • How to append new field in select clause of dynamic VO through CO

    I have dynamic VO "FaoWorkPerObjPerfRatingsVO" in controlloer below:
    public class FaoWorkApprObjectivesCO extends ApprObjectivesCO
    public void processRequest(OAPageContext oapagecontext, OAWebBean oawebbean)
    super.processRequest(oapagecontext, oawebbean);
    OAApplicationModule oam = oapagecontext.getApplicationModule(oawebbean);
    oracle.apps.fnd.framework.server.OADBTransaction oadbtransaction = oam.getOADBTransaction();
    OAViewObject oav = (OAViewObject)oam.findViewObject("FaoWorkPerObjPerfRatingsVO");
    if(oav != null)
    System.out.println("FAO Found VO PerObjPerfRatingsVO for ObjectivesAM. This means we have re-entered the page");
    } else
    oav = (OAViewObject)oam.createViewObject("FaoWorkPerObjPerfRatingsVO", "oracle.apps.per.selfservice.objectives.server.PerObjPerfRatingsVO");
    How can I append 2 new fields are MULTIRATERS_AVERAGE and COUNT_MULTIRATERS as statement below in select clause of dynamic VO above (FaoWorkPerObjPerfRatingsVO)
    fao_pems_utility.AVG_STEP_VALUE(fao_pems_utility.GET_APPRAISAL_ID(PCE.ASSESSMENT_ID),
    'MULTIRATER',
    Null,
    PCE.COMPETENCE_ID) MULTIRATERS_AVERAGE,
    fao_pems_utility.COUNT_RATINGS(Null,
    Null,
    fao_pems_utility.GET_APPRAISAL_ID(PCE.ASSESSMENT_ID),
    PCE.COMPETENCE_ID,
    Null,
    'MULTIRATER',
    Null) || ' out of ' ||
    (fao_pems_utility.HOW_MANY_RATING(fao_pems_utility.GET_APPRAISAL_ID(PCE.ASSESSMENT_ID),
    'GROUPAPPRAISER') +
    fao_pems_utility.HOW_MANY_RATING(fao_pems_utility.GET_APPRAISAL_ID(PCE.ASSESSMENT_ID),
    'REVIEWER')) COUNT_MULTIRATERS
    Thank you very much.

    Hi
    My VO is VO Extension below. In the seeded VO (oracle.apps.per.selfservice.objectives.server.PerObjPerfRatingsVO) doesn't include 2 fields that I want to add in VO.
    oav = (OAViewObject)oam.createViewObject("FaoWorkPerObjPerfRatingsVO", "oracle.apps.per.selfservice.objectives.server.PerObjPerfRatingsVO");
    Could you please provide me the coding to append 2 new fields in VO Extension approach. I would like to append them in select clause.
    Thank you.

  • Date field on Selection Screen

    Hi All,
    I need to create Date field (From and To) in the selection screen. The Date format should appear as YYYY-MM-DD.
    I have defined this requirement as below.
    select-options: s_date for sy-datum no-extension default sy-datum.
    Due to above line, date is appearing in DD.MM.YYYY format.
    How to code, so that date should appear in YYYY-MM-DD in the selection screen...????
    Please Help me....
    Regards
    Pavan

    Pavan,
    write below code.
    DATA : WS_DATE like sy-datum.
       select-options: s_date for sy-datum.
    AT SELECTION SCREEN OUTPUT.
        call function 'CONVERT_DATE_TO_INTERN_FORMAT'
      exporting
        datum         = sy-datum
        dtype         = 'DATS'
    IMPORTING
      ERROR         =
        IDATE          =  ws_date.
      MESSG         =
      MSGLN         =
      s_date-low  =  ws_date.
    Pls. reward if useful

  • Date Field Calendar Select F4 - F2 Not Working

    Gosh this really seems like a simple question, but I can't seem to find an answer to it.
    I am sure somebody has run into this before:
    When populating a date field, you should be able to highlight the field, hit F4 to pull up the calendar and F2 will then populate the field with the current date.
    The problem is, F2 is only highlighting the current date; not entering it into the field.
    This creates an extra step for order entry.
    Has anyone had this problem before and know a way to resolve it?

    Dear
    I think your best bet is to check for SAP notes on this topic.
    For example note:
    Note 94052 - Equipment master: F2 key does not work
    Example of solution of this note (but probably applicable for other issues as well)
    Enhance interface status to activate the F2 key. You receive its name via menu option System -> Status. Then change the status for program 'SAPMIEQ0' using Transaction SE41 as follows:
    In the 'Recommended function key settings' section enter 'OA' for the F2 key in the first column and 'Display object' in the second column.
    Kind regards
    Tom

  • Need to add date field on select screen of report RM06INP0.

    Hi All,
    I have to create a new report ZRM06INP0 as a copy from RM06INP0 and add a field in the selection.
    When the selection "Price Determination w/o PO" is not picked then we need a maintainable field from the info record. The default for the date is 9999.12.31 and should manually maintained. This date shoulde be written in the info record.
    How to achieve this?
    Please see OSS Note 392 988 Solution to 2 for more info.

    Hi Akash
    What kind of date is you wanted? You can try to find it in dynamic selections.
    regards,
    Archer

  • HR data/Fields in selection-screen..........

    Hi,
    I must define some fields related to HR.
    Cost centre, Business group, company code, site code.
    these 4 fields i need to delecre in select option.
    can i know table and fields for the above mentioned.
    Please tell are they available in single table.
    Thanks.
    Message was edited by: Deepak333 k

    Hi,
    Please refer to the PA0001 table which is the database table for infotype organization assignment.
    I hope this meet your requirement.
    If this help you out dont forget to reward points.
    Regards,
    Irfan Hussain

  • Select -option Date field in MM/YYYY format!

    Hi.. Friends..
       Iam having DATE field as selection screen SELECT_OPTION parameter.
    And I am fetching records from one of my tables with where condition of this select-option.
    Now my reuirement is to modify that DATE select-option with 7 characters i.e. MM/YYYY
    So if user enters 09/2008 as DATE-LOW.. I have to fetch all records of September 2008.
    If user enters 09/2008(lower limit) and 02/2009(Upper limit)...
    I have to fetch records between... September 1st 2008 to 28th february 2009.
    What is the simplest way to impliment this?
    Thanks,
    Naveen.I

    Hi
    Use data element SPMON as in below code.
      TABLES: S001.
      DATA: l_year(4)  TYPE n,
            l_month(3) TYPE n,
            g_sdate TYPE sy-datum,
            g_edate TYPE sy-datum.
      RANGES: gr_pdate FOR sy-datum.
      CONSTANTS: lc_low   TYPE sy-datum VALUE '00010101',
                 lc_high  TYPE sy-datum VALUE '99990101'.
      SELECT-OPTIONS:   s_spmon  FOR  s001-spmon.
      l_year  = s_spmon-low(4).
      l_month = s_spmon-low+4(2).
    * Get the first day of PERIOD-LOW
      CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
        EXPORTING
          i_gjahr        = l_year
          i_periv        = 'K2'
          i_poper        = l_month
        IMPORTING
          e_date         = g_sdate
        EXCEPTIONS
          input_false    = 1
          t009_notfound  = 2
          t009b_notfound = 3
          OTHERS         = 4.
      l_year  = s_spmon-high(4).
      l_month = s_spmon-high+4(2).
    * Get the last day of PERIOD-HIGH
      CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
        EXPORTING
          i_gjahr        = l_year
          i_periv        = 'K2'
          i_poper        = l_month
        IMPORTING
          e_date         = g_edate
        EXCEPTIONS
          input_false    = 1
          t009_notfound  = 2
          t009b_notfound = 3
          OTHERS         = 4.
      IF NOT s_spmon-low IS INITIAL.
        gr_pdate-low = g_sdate.
      ELSE.
        gr_pdate-low = lc_low.
      ENDIF.
      IF NOT s_spmon-high IS INITIAL.
        gr_pdate-high = g_edate.
      ELSE.
        gr_pdate-high = lc_high.
      ENDIF.
      IF NOT s_spmon-low IS INITIAL OR NOT s_spmon-high IS INITIAL.
        gr_pdate-option = 'BT'.
        gr_pdate-sign = 'I'.
        APPEND gr_pdate.
      ENDIF.
    " SELECT RECORDS
    " >>> SELECT field1 field2 FROM TAB1 WHERE erdat IN gr_pdate. <<<

  • F4 ( Search Help ) for date field  on the selection screen

    Hi Freinds,
    i have used WDR_SELECT_OPTIONS In my component, i have one date field on selection screen(BUDAT), for this date field i want seach help 
    this is my code
    create a range table for Posting Date
    lt_range_table = wd_this->m_handler->create_range_table(
                                                              i_typename = 'BUDAT' ).
    add Posting Date  to the selection
    wd_this->m_handler->add_selection_field( i_id = 'BUDAT'
         i_value_help_type = if_wd_value_help_handler=>CO_PREFIX_SEARCHHELP
                                               I_VALUE_HELP_ID = '??????'
                                               I_DESCRIPTION = 'Posting Date'
                                               it_result = lt_range_table ).
    can any one help me
    Thanks
    Srini

    hi sarbjeet 
    i created search help in dictionary and i used that search help in my program, but still its now working , any other ideas
    Thnx
    srini

  • Need help on date field

    hai,
    in selection screen, i am having the date field as select-options.
    if i give low value, it should automatically display the high value, how to do this.
    thanks.

    Hi,
    U can use AT SELECTION-SCREEN event as follows :
    AT SELECTION-SCREEN on S_DATE
    if not S_DATE-LOW is initial.
    S_DATE-OPTION = 'BT'.
    S_DATE-HIGH = SY-DATUM.
    MODIFY S_DATE.
    Endif.
    This shud help u.
    Regards,
    Himanshu
    Message was edited by:
            Himanshu Aggarwal
    Message was edited by:
            Himanshu Aggarwal

  • Problem with the filter button doesn't give a proper O/P 4 the date field

    Hi all
    I have a custom report which gives a workflow status log with date sent as one of the columsn in the report, when we click the filter button after selecting this columnthe user is shown a window with a single character field, in the same report we have another field( date field) when the user selects thsi the user is shown a proper date field for selection in ranges.
    Thanks in advance
    Cheers
    Seshi
    Message was edited by: Seshi E

    Hi all
    I have a custom report which gives a workflow status log with date sent as one of the columsn in the report, when we click the filter button after selecting this columnthe user is shown a window with a single character field, in the same report we have another field( date field) when the user selects thsi the user is shown a proper date field for selection in ranges.
    Thanks in advance
    Cheers
    Seshi
    Message was edited by: Seshi E

  • Date as a select option in sales order report.....

    hello guys i want to add sales doc date from as a lower field and date to as a higher field on a selection screen.....so please help me out......i also want to add error message for it.....

    Simply add the date field as select-options error msg on choosing wrong date format will be automatically triggred.
    For example for order creation date.
      select-options:   audat for vbak-audat.
    anya

  • Delivery date field in PR to PO

    Hello,
    I am creating PO from ref PR. The delivery date field initially takes up delivery date as entered in PR.
    I want to make this field blank & then give error as "enter correct delivery date".
    Can you help me in achieving this?
    Regards,
    Krutika

    Hi,
    Similar kind of thread.....
    [Importing PR data into PO;
    Thanks,
    Shailaja Ainala.

  • Working of SELECT MIN when data field is blank

    Hi expert,
    I'd like use the SELECT MIN instruction to take the older data (yyyy/mm/dd).
    If by accident I have a Data value = blank, the SELECT MIN does will take it?
    I should be sure that the SELECT MIN does not take an initial value.
    Thanks for your support.
    Claudia

    Hello Claudia,
    As per my understanding, If a date field has an initial value then by default it will have a value '00/00/0000'. In order to avoid the initial values you can put in where clause 'field is not initial'
    Hope this helps.
    Regards,
    Himanshu

  • 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

  • My sound switches from internal speakers to apple Tv and i dont have an apple tv device

    I am having problems with sound. My speakers will switch from internal speakers to Apple TV for no reason when I am on a certain wifi network and ask for a password. I do not have an apple TV and in order for the sound to come out on the internal spe

  • Please help lightroom 5 won't launch with my mac 10.6.8 what

    ANY  Suggestions  It won't launch it say's I need 10.7 however, my other programs are working fine with 10.6.8

  • Compare Two Values in logic:equal issue !!!!!!!!!!!

    Hi Techie !!!! I have list object from DB inwhich i want compare a field in <logic:equal> Struts EL ....... I have written the following code..... <%          List list = (List)request.getAttribute("AppointmentDetailNavigationList");       pageContex

  • Year to Date Revenue

    Hi All, Could please give me idea of How to get Estimated Revenue, current YTD Realized Revenue, Prior YTD Realized Revenue and Prior Year total Actual? It would be great if you can provide me Table names and field names. Thanks for your help. Regard

  • Installing Premiere Elements 11

    I am installing Premiere Elements 11 but I always get this error: Error 1935:An error occured during the installation of assembly component.. Kindly help! Thanks