No same values in same field

I want to build table with constraint prevent specific field from duplicate his values .... I don't want that constraint be primary key , I want any constraint else to make what i want.

Hi,
Why do not you create a UNIQUE constraint?
UNIQUE constraint would not allow you to insert duplicates.
Regards,
Sailaja

Similar Messages

  • Max two same value in one field

    Hi,
    I have a project in hand. I can't figure out how to deal with
    it. I am not
    very good at manual script. I can handle on my own, though.
    My problem is I need check in the insert page if a certain
    value is in that
    field two time. If so, I do not want the visitor to insert,
    and system to
    warn the visitor to insert another value for the selected
    field.
    For example, below, for the file code, if the
    visitor/operator inserts 314,
    it should give error because there are two records whose
    file_code field
    containing 314.
    file_id filename file_code
    1 dummyname 225
    2 dummyname 314
    3 dummyname 225
    4 dummyname 314
    5 dummyname 532
    6 dummyname 756
    7 dummyname 225
    8 dummyname 987
    Thank you indeed
    Hakan

    OK, just noticed that you want to allow two of the same
    value, but no more than two.
    In that case, before inserting , just perform a select count
    using the attempted insert value in the where clause. If less than
    2 allow the insert, otherwise display the error.

  • Query to insert a row in a table with same values except 1 field.

    Suppose I have a table with 100 columns(fields).
    I want to insert a row with 99 fileds being the same as previous ones except one fileld being different.
    The table doesn't have any constraints.
    Kindly suggest a query to solve the above purpose..

    And for much more lazy people, a desc of table is shorter to write. :-)
    Then copy & paste into any editor, then mode column to add a comma after every column name in one shot.Or have the system do it for you. Be lazy.
    SELECT Column_Name || ',' FROM User_Tab_Columns where Table_Name = '';
    Indeed, it can be converted to a script called desc(.sql)
    SELECT Column_Name || ',' FROM User_Tab_Columns where Table_Name = '&1' ORDER BY Column_Id;
    Then desc or @desc.

  • Counting one of multiple rows with same value for same ID

    Hello,
    I have this query:
    SELECT
    count( case when EXISTS (
                SELECT *
                FROM  business_log bl, subject su
                WHERE  su.ID_SUBJECT = s.ID_SUBJECT
                and bl.id_subject = su.id_subject
                AND    bl.value = 'Solved'
    then 1 else null end) num_solved
    FROM subject s
    It is posible that one subject is more than once 'Solved' in table BUSINESS_LOG
    I want to count only one row solved for one subject.
    I must to use only SUBJECT table in the main query because of other counts.
    Thank You very much.
    Regards
    Milos
    Message was edited by: 2796614

    so in case you have no solved entry...you get NULL back instead of 0.....
    and....there is no need for the group by ....as you are only looking for one subject
    SELECT COALESCE((SELECT max(1)
                      FROM  business_log bl
                     WHERE bl.id_subject = s.id_subject
                       AND bl.value = 'Solved'),0) num_solved
      FROM subject s
    but....I would like to have a proof, that this one is faster than the outer-join solution.
    So...perhaps we'll see an execution plan for both of them.
    corrected....missing bracket

  • How to restrict user to not enter same value in tabular form

    Greetings !
    i m asking second time the questiion because i was not answered preivously, so please dont mind if it is a duplicate one,
    question was: i created tabular form as shown in example.
    i want to validate username as you see in my example to restrict user to enter the same value in username field before submit page.
    e.g when user is entering data as u see test in username in first row, when he/she goes to second row and type the same username like test " message will appear or restrict user that already typed or in use"..
    http://apex.oracle.com/pls/apex/f?p=45296:1:22797340776918:::::
    this all be done on typing before submit record.
    please gudie

    Hi,
    i m asking second time the questiion because i was not answered preivously, so please dont mind if it is a duplicate one,question was: i created tabular form as shown in example.
    i want to validate username as you see in my example to restrict user to enter the same value in username field before submit page.
    e.g when user is entering data as u see test in username in first row, when he/she goes to second row and type the same username like test " message will appear or restrict user that already typed or in use"..
    http://apex.oracle.com/pls/apex/f?p=45296:1:22797340776918:::::
    this all be done on typing before submit record.>
    Stick the below code in the Page Header > Javascript > Execute when Page Loads field.
    $('[input[name="f03"]').blur(function(){
      if ($('input[name="f03"][id!="'+$(this).attr('id')+'"]').val() == $(this).val()) {
         alert('Duplicate Entry.');
         var x = $(this).attr('id');
         setTimeout("(function(p){$('#'+p).focus();})('"+x+"')",100);
    })Note :
    a.f03 is the "name" of your username column in the Tabular form.
    b. This validates only the displayed values . If your Tabular Form has multiple pages then all the rows not currently displayed will be ignored.
    Cheers,

  • System generated value for a field and incrementing (using module pool pro)

    Hi,
    I'm getting system generated value for a field and incrementing (i.e done by coding) when i'm saving the screen or transaction (which is created using module pool programming) while modifying, saving its working fine, but when i'm going out of the screen or exit n again i start the screen (with some ztransco) the value for the field again starting from 0 so i want to start from the same value for a field where we exit or got out from the screen n incremented respectively while saving the screen,
    Thanks & Regards,
    MS
    Edited by: Rob Burbank on May 4, 2010 10:40 AM

    Search the forum for number range objects.
    Rob

  • ME21N - new field added and same value posted to it for all line items

    hi all
    i have added new field under item  level in me21n screen.
    data for new filed fetched from tables with values entered in header level material number.
    For one record, it is ok
    but for multiple records, same value is fetched for all line items
    i have written coding in screen exit for 0111
    and function exits EXIT_SAPMM06E_016 and EXIT_SAPMM06E_018
    how to solve
    pl help
    regards
    senthil

    MODULE STATUS_0111 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
      if sy-tcode eq 'ME23N' or sy-tcode eq 'ME23'.
        LOOP at SCREEN.
          if screen-group1 ne 'PCS'.
            screen-input = 0.
            MODIFY SCREEN.
          endif.
        ENDLOOP.
      ENDIF.
      TYPES : BEGIN OF ty_cabn1,
             atnam TYPE cabn-atnam,
           end of ty_cabn1.
      DATA : itab_cabn1 TYPE STANDARD TABLE OF ty_cabn1 INITIAL SIZE 0,
             wa_cabn1 TYPE ty_cabn1.
      TYPES : BEGIN OF ty_cawn1,
        atinn TYPE cawn-atinn,
        atzhl TYPE cawn-atzhl,
        atwrt TYPE cawn-atwrt,
        end of ty_cawn1.
      DATA : itab_cawn1 TYPE STANDARD TABLE OF ty_cawn1 INITIAL SIZE 0,
             wa_cawn1 TYPE ty_cawn1.
      TYPES : BEGIN OF ty_cawnt1,
       pcs TYPE cawnt-atwtb,
        atinn TYPE cawnt-atinn,
        atzhl TYPE cawnt-atzhl,
        atwtb TYPE cawnt-atwtb,
          end of ty_cawnt1.
      DATA : itab_cawnt1 TYPE TABLE OF ty_cawnt1,
             wa_cawnt1 TYPE ty_cawnt1.
      TYPES : BEGIN OF ty_pcs1,
    pcs TYPE cawnt-atwtb,
      atwrt TYPE cawn-atwrt,
      atwtb TYPE cawnt-atwtb,
        end of ty_pcs1.
      DATA : itab_pcs3 TYPE TABLE OF ty_pcs1,
             itab_pcs4 TYPE TABLE OF ty_pcs1,
             wa_pcs1 TYPE ty_pcs1.
      TYPES : BEGIN OF ty_pcsn,
      matnr TYPE ausp-objek,
      ebelp TYPE dynpread-stepl,
      atwrt TYPE cawn-atwrt,
      atwtb TYPE cawnt-atwtb,
      END OF ty_pcsn.
      DATA : itab_pcsn TYPE TABLE OF ty_pcsn,
             wa_pcsn TYPE ty_pcsn.
      TYPES : BEGIN OF ty_ausp1,
         objek TYPE ausp-objek,
         atinn TYPE ausp-atinn,
         atwrt TYPE ausp-atwrt,
       END OF ty_ausp1.
      DATA : itab_ausp1 TYPE STANDARD TABLE OF ty_ausp1 INITIAL SIZE 0,
             wa_ausp1   TYPE ty_ausp1.
      DATA : param_name1(35) TYPE  c.
      DATA: progname1      TYPE sy-repid,
            dynnum1        TYPE sy-dynnr,
            dynpro_values1 TYPE TABLE OF dynpread,
            dynpro_values2 TYPE TABLE OF dynpread,
            field_value1   LIKE LINE OF dynpro_values1,
            ematn1         TYPE mara-matnr.
      if sy-tcode ne 'ME23N' and sy-tcode ne 'ME23'.  "psk
        clear : itab_cabn1,itab_cawn1,itab_cawnt1,itab_pcs3,itab_pcs4,itab_pcsn,itab_ausp1.
        clear : wa_cawn1,wa_cawnt1,wa_pcs1,wa_ausp1.
        if sy-uname eq 'IBM_ABAP'.
          param_name1 = '000000001'.
        else.
          param_name1 = '000000013'.
        endif.
        SELECT atnam
        FROM cabn
        INTO CORRESPONDING FIELDS OF TABLE itab_cabn1
        WHERE atinn  = param_name1.
        select *
        FROM cawn
        into CORRESPONDING FIELDS OF TABLE itab_cawn1
        WHERE atinn = param_name1.
        if itab_cawn1[] is NOT INITIAL.
          SELECT atinn atzhl atwtb
          FROM cawnt
          INTo CORRESPONDING FIELDS OF TABLE itab_cawnt1
          FOR ALL ENTRIES IN itab_cawn1
          WHERE atinn = itab_cawn1-atinn
          AND atzhl = itab_cawn1-atzhl.
        endif.
        if itab_cawnt1[] is NOT INITIAL.
          sort itab_cawnt1 by atinn atzhl.
          loop at itab_cawnt1 INTO wa_cawnt1.
            READ TABLE itab_cawn1 INTO wa_cawn1 with key atinn = wa_cawnt1-atinn
                                                         atzhl = wa_cawnt1-atzhl BINARY SEARCH.
            if sy-subrc eq 0.
           CONCATENATE wa_cawn-atwrt '->' wa_cawnt-atwtb INTO wa_cawnt-pcs.
           MODIFY itab_cawnt FROM wa_cawnt TRANSPORTING pcs.
           wa_pcs-pcs = wa_cawnt-pcs.
              wa_pcs1-atwrt = wa_cawn1-atwrt.
              wa_pcs1-atwtb = wa_cawnt1-atwtb.
              append wa_pcs1 to itab_pcs3.
            ENDIF.
            CLEAR : wa_cawnt1,wa_cawn1, wa_pcs1.
          ENDLOOP.
        ENDIF.
        CLEAR: dynpro_values1, field_value1.
    dynpro_values-FIELDNAME = 'MEPO1211-EMATN'.
    APPEND dynpro_values.
        field_value1-fieldname = 'MEPO1211-ematn'.
        APPEND field_value1 TO dynpro_values1.
        progname1 = 'SAPLMEGUI'.
        dynnum1 = '1211'.
        CALL FUNCTION 'DYNP_VALUES_READ'
          EXPORTING
            DYNAME                               = progname1
            DYNUMB                               = dynnum1
      TRANSLATE_TO_UPPER                   = ' '
         REQUEST                                = 'A'
      PERFORM_CONVERSION_EXITS             = ' '
      PERFORM_INPUT_CONVERSION             = ' '
      DETERMINE_LOOP_INDEX                 = ' '
      START_SEARCH_IN_CURRENT_SCREEN       = ' '
      START_SEARCH_IN_MAIN_SCREEN          = ' '
      START_SEARCH_IN_STACKED_SCREEN       = ' '
      START_SEARCH_ON_SCR_STACKPOS         = ' '
      SEARCH_OWN_SUBSCREENS_FIRST          = ' '
      SEARCHPATH_OF_SUBSCREEN_AREAS        = ' '
          TABLES
            DYNPFIELDS                           = dynpro_values1
       EXCEPTIONS
         INVALID_ABAPWORKAREA                 = 1
         INVALID_DYNPROFIELD                  = 2
         INVALID_DYNPRONAME                   = 3
         INVALID_DYNPRONUMMER                 = 4
         INVALID_REQUEST                      = 5
         NO_FIELDDESCRIPTION                  = 6
         INVALID_PARAMETER                    = 7
         UNDEFIND_ERROR                       = 8
         DOUBLE_CONVERSION                    = 9
         STEPL_NOT_FOUND                      = 10
         OTHERS                               = 11
        IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    READ TABLE dynpro_values1 INTO field_value1 with KEY fieldname = 'MEPO1211-EMATN'.
        LOOP at dynpro_values1 INTO field_value1 WHERE fieldname = 'MEPO1211-EMATN'.
          clear ematn1.
          if sy-subrc eq 0.
            ematn1 = field_value1-fieldvalue.
          endif.
          if ematn1 is not INITIAL.
            clear : wa_cawn1,wa_cawnt1,wa_pcs1,wa_ausp1.
            CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
              EXPORTING
                INPUT  = ematn1
              IMPORTING
                OUTPUT = ematn1.
            select *
            FROM ausp
            INTO CORRESPONDING FIELDS OF TABLE itab_ausp1
            WHERE objek = ematn1
            and atinn = param_name1.
            CLEAR itab_pcs4.
            if itab_ausp1[] is not INITIAL.
              sort itab_ausp1 by atinn atwrt.
              sort itab_cawn1 by atinn.
              READ TABLE itab_ausp1 INTO wa_ausp1 INDEX 1.
              loop at itab_cawn1 INTO wa_cawn1 WHERE atinn = wa_ausp1-atinn AND atwrt = wa_ausp1-atwrt.
                READ TABLE itab_cawnt1 INTO wa_cawnt1 WITH KEY atinn = wa_cawn1-atinn
                                                                atzhl = wa_cawn1-atzhl.
                if sy-subrc eq 0.
                  wa_pcs1-atwrt = wa_cawn1-atwrt.
                  wa_pcs1-atwtb = wa_cawnt1-atwtb.
                  append wa_pcs1 to itab_pcs4.
                  wa_pcsn-matnr = wa_ausp1-objek.
                  wa_pcsn-ebelp = field_value1-stepl.
                  wa_pcsn-atwrt = wa_cawn1-atwrt.
                  wa_pcsn-atwtb = wa_cawnt1-atwtb.
                  APPEND wa_pcsn to itab_pcsn.
                ENDIF.
                clear : wa_ausp1,wa_cawn1,wa_cawnt1.
              ENDLOOP.
            ENDIF.
           clear wa_pcs1.
           read TABLE itab_pcs4 into wa_pcs1 index 1.
           if sy-subrc eq 0.
             EKPO_CI-ZPCS = wa_pcs1-atwrt.
           endif.
          ENDIF.
        ENDLOOP.
        CLEAR: field_value1.
        LOOP at dynpro_values1 INTO field_value1 WHERE fieldname = 'MEPO1211-EMATN'.
          clear wa_pcsn.
          if field_value1-fieldvalue is not INITIAL.
            read TABLE itab_pcsn INTO wa_pcsn with key  matnr = field_value1-fieldvalue
                                                        ebelp = field_value1-stepl.
            if sy-subrc eq 0.
              clear  EKPO_CI-ZPCS.
    *EKPO_CI-ZPCS = wa_pcs1-atwrt.
              EKPO_CI-ZPCS = wa_pcsn-atwrt.
            endif.
          endif.
        ENDLOOP.
       CLEAR: field_value1, dynpro_values1.
       progname1 = 'SAPLXM06'.
       dynnum1   = '0111'.
       field_value1-fieldname = 'EKPO_CI-ZPCS'.
       APPEND field_value1 TO dynpro_values1.
       if ematn1 is not INITIAL.
         clear wa_pcs1.
         read TABLE itab_pcs4 into wa_pcs1 index 1.
         if sy-subrc eq 0.
           EKPO_CI-ZPCS = wa_pcs1-atwrt.
         endif.
       ENDIF.
      endif.
    ENDMODULE.                 " STATUS_0111  OUTPUT
    Function exits:
    ^^^^^^^^^^^^^^^^^
    EXIT_SAPMM06E_016
    ^^^^^^^^^^^^^^^^^
    INCLUDE ZXM06U41 .
    DATA XFISTL LIKE EKPO-FISTL.
    TABLES: ADRC, T001W.
    DATA: PLANT LIKE T001W-WERKS.
    SELECT SINGLE * FROM T001W WHERE WERKS = I_EKPO-WERKS.
    SELECT SINGLE * FROM ADRC WHERE ADDRNUMBER = T001W-ADRNR.
    XFISTL = ADRC-SORT2.
    SET PARAMETER ID 'FIS' FIELD XFISTL.
    * Added For PCS 12.11.2010
    DATA : fs_ekpo type EKPO_CI.
    if sy-tcode = 'ME22N' or sy-tcode = 'ME23N'.
    *  if tekpo-zpcs is INITIAL.
    *    message e000(zmm) with 'PCS Type should be chosen'.
    *  endif.
      loop at tekpo.
        if ( tekpo-ebeln eq i_ekpo-ebeln and tekpo-ebelp eq i_ekpo-ebelp ).
          ekpo_ci-zpcs = tekpo-zpcs.
        endif.
      ENDLOOP.
    endif.
    ^^^^^^^^^^^^^^^^^
    EXIT_SAPMM06E_018
    ^^^^^^^^^^^^^^^^^
    INCLUDE ZXM06U40 .
    E_CI_EKPO-ZPCS = EKPO_CI-ZPCS.
    E_CI_UPDATE = 'X'.

  • How to give two values of same field in read Statment

    Hi,
    Please Tell me how to give the two values of same field in read statements Condition.
    i.e
      Read table it_tab with key matnr = '1' or matnr = '2'.
    With Regards
    Kesavaperumal

    Hi Kesavaperumal,
    <li>You can not use OR operator with READ TABLE statement.
    <li>You have to use different fields of the internal table in where condition.
    <li>If you want to compare with two values, you need to use LOOP statement.
    LOOP AT it_mara WHERE matnr = '1' or matnr = '2'.
    "Write code
    ENDLOOP.
    Thanks
    Venkat.O

  • YTD and accumul. depreciation have the same value when dpis is 2 years ago

    Hi all
    I am using FA and i have some problems. I have just setup this module and now i want to migrate assets in the system. The customer gave me an excel with the following fields that want to be in the system like: asset cost, accumulated depreciation, date placed in service, ytd accumulation and so on.
    the problems are:
    1) when i want to enter new asset manually the ytd depreciation and accumulated depreciation are required to be equal. ok so far, i register new asset on test environment and when i enter the date placed in service for example two years ago (because that is the real date placed in service of the asset) and run depreciation, the system has calculated correctly the accumulated depreciation, but has calculated the same value even for YTD depreciation which is not true, because in this case accumulated depreciation and ytd depreciation are completely different. how to solve this problem? How can i put correct values in this fields?
    2) when i enter these assets directly in the fa_mass_additions table according to the fixed assets user guide, i have the following errors: when i put "ON HOLD" on queue name, and open these assets on the system, the on hold field has no value (is empty)
    When i try to run post mass additions, the report is not finding the parameter (book) because the system is giving en error message telling me that there is no value in this list of values
    please help to solve this problems because i am not being able to migrate assets for the company.
    Thank you and best regards

    gaskins,
    You may have different Color Settings, and if you use Pantone you should be aware that the whole interpretation has changed (a number of times, most radically recently).
    If you say more, more can be said.

  • Will a sequence return same value for two different sessions?

    Is there a possibility that a sequence will return same value to two different sessions when it is referred exactly at the same instance of time?

    @Justin... Thanks for your insight; indeed, we too feel this shouldn't ever happen and never heard of it either, but there it is. (No, we haven't logged a TAR yet -- whatever that is -- partly because it didn't occur to us and partly because we only recently came across the issue and sensibly want to do some testing before we cry foul.)
    However, the code is pretty straight-forward, much like this (inside a FOR EACH ROW trigger body):
    SELECT <seqname>.NEXTVAL INTO <keyvar> FROM DUAL;
    INSERT INTO <tblname> (<keyfield>, <... some other fields>)
    VALUES(<keyvar>, <... some other values> );
    (where <tblname> is NOT the table on which the trigger is fired). This is the only place where the sequence is ever accessed. The sequence state is way below its limits (either MAXVALUE or <keyfield>/<keyvar> datatype size).
    In this setup, end users sometimes got an out-of-the-blue SQL error to the effect that uniqueness constraint has been violated -- as I said, we used to have a unique index on <keyfield> -- which leads us to assume that the sequence generated a duplicate key (only way for the constraint to be violated, AFAIK). We released the constraint and indeed, using a simple SELECT <keyfield>, COUNT(*) FROM <tblname> GROUP BY <keyfield> HAVING COUNT(*)>1 got us some results.
    Unfortunately, the <tblname> table gets regularly purged by a consumer process so it's hard to trace; now we created a logger trigger, on <tblname> this time, which tracks cases of duplicate <keyfield> inserts... We'll see how it goes.
    @Laurent... winks at the CYCLE thing Our sequence is (needless to say) declared as NOCYCLE and the datatype is large enough to hold MAXVALUE.

  • TableView - Filter more than one value in same column

    Hi folks,
    I faced a problem on <b>filtering a field more than one value</b>.
    Does it possible solution for us to bring out filtering function while user try to enter few values in the SAME filter field?
    Thank you.
    First, i need to clarify my exact problem.
    --> I have created one tableView with filter = "server". Then i want to allow my user to enter few filter values in same field column.
    Example 1:
    Before
    COL1 COL2 COL3 COL4
    l--II--
    l-filter1I--I--
    *filter1 = AAA, BBB
    AAA AAA AAA AAA
    BBB BBB BBB BBB
    CCC CCC CCC CCC
    DDD DDD DDD DDD
    EEE EEE EEE EEE
    After
    COL1 COL2 COL3 COL4
    l--II--
    l-filter1I--I--
    *filter1 = AAA, BBB
    AAA AAA AAA AAA
    BBB BBB BBB BBB
    Is that any good suggestions to solve my doubt?
    Message was edited by:
            GP Poh

    check out this work around. in this sample currency column supports multiple values and multiple values in the filter column should be enter with comma as separater.
    <u><b>page attribute:</b></u>
    filtertab     TYPE     RSELOPTION
    filter_wa     TYPE     RSDSSELOPT
    itab     TYPE     FLIGHTTAB
    <u><b>layout</b></u>
    <%@page language="abap" %>
    <%@extension name="htmlb" prefix="htmlb" %>
    <htmlb:content design="design2003" >
      <htmlb:page title=" " >
        <htmlb:form>
        <htmlb:textView id ="tex"
                        text = "Filter on Currency Column support multiple values, they can be entered with comma as separater like 'usd,DEM'"/>
          <htmlb:tableView id                  = "tv1"
                           design              = "ALTERNATING"
                           table               = "<%= itab %>"
                           filter              = "APPLICATION"
                           columnHeaderVisible = "true"
                           sort                = "SERVER" />
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    <u><b>oninitialization</b></u>
    select * from sflight into table itab where currency in filtertab .
    <u><b>oninputprocessing</b></u>
    * event handler for checking and processing user input and
    * for defining navigation
    DATA: table           TYPE REF TO cl_htmlb_tableview .
    DATA: tv_data TYPE REF TO cl_htmlb_event_tableview.
    DATA: filter_value TYPE string .
    DATA: fil_val TYPE STANDARD TABLE OF string ,
          fil_val_wa TYPE string .
    REFRESH filtertab .
    table ?= cl_htmlb_manager=>get_data( request = request
                                               name    = 'tableView'
                                               id      = 'tv1' ).
    IF table IS NOT INITIAL .
      tv_data = table->data .
      IF NOT tv_data IS INITIAL .
        CALL METHOD tv_data->get_row_filter_value
          EXPORTING
            column_index = 6
          RECEIVING
            value        = filter_value.
        IF NOT filter_value IS INITIAL .
          TRANSLATE filter_value TO UPPER CASE .
          REFRESH fil_val .
          SPLIT filter_value AT ',' INTO TABLE fil_val .
          CLEAR fil_val_wa .
          LOOP AT fil_val INTO fil_val_wa .
            filter_wa-sign = 'I' .
            filter_wa-option = 'EQ' .
            filter_wa-low = fil_val_wa .
            APPEND filter_wa TO filtertab .
          ENDLOOP .
        ELSE .
          REFRESH filtertab .
        ENDIF .
      ENDIF .
    ENDIF .
    Regards
    Raja

  • Max value is same in report

    Hi Sap Experts
    I am not getting same min value from max can anyone correct my program please
    I am getting max value but in place of min I am getting the same value of max.
    I am searching with equipment range , monthly date range and unit of measurment (km,L,H)
    REPORT Z_ESLP_FUEL LINE-SIZE 200 LINE-COUNT 75
    NO STANDARD PAGE HEADING.
    TABLES : equi,
    equz,
    imptt,
    imrg,
    eqkt,
    iloa.
    Type Declaration
    TYPES: BEGIN OF ty_data ,
            equnr type equnr, " Euipment no
            eqktx type eqkt-eqktx, " Equipment Text
            eqfnr type iloa-eqfnr, " Equipment Sort field
            idate type imrg-idate, " Measuring Date
            recdu type imrg-recdu, " Unit of measuring ='KM','L','H'
            recdv type imrg-recdv, " Counter reading data
          END OF ty_data.
    TYPES: BEGIN OF ty_final,
            equnr type equnr, " Equipment no
            eqktx type eqkt-eqktx, " Equipment Text
            eqfnr type iloa-eqfnr, " Equipment Sort field
            min_date type imrg-idate, " Min Date
            min_km type p decimals 2, " Max Km
            max_km type p decimals 2, " Min km
            t_max_min_km type i, " Total min_km-max_km
            max_date type imrg-idate, " Max Date
            min_hr type imrg-recdv, " Max hr
            max_hr type imrg-recdv, " Min hr
            t_max_min_hr type i, " Total min_hr-max_hr
            min_lit type imrg-recdv, " Max lit
            max_lit type imrg-recdv, " Min lit
            t_max_min_lit type i, " Total min_lit-max_lit
            fuel_con type p decimals 2, " Total_hrs / t_max_min_hr
            km_l type p decimals 2, " km / L
            lit_per_hr type i , " fuel comsumed / t_max_min_hr
          END OF ty_final.
    DATA: i_data TYPE TABLE OF ty_data, " internal table
          wa_data TYPE ty_data, " work area
          i_final TYPE TABLE OF ty_final, " internal table
          wa_final TYPE ty_final. " work area
    data: begin of itab occurs 0,
    num type i,
    end of itab.
    data: v_min_1 type i,
    v_max_1 type i,
    min like imrg-recdv,
    max like imrg-recdv,
    max_dt like imrg-idate,
    min_dt like imrg-idate,
    t_ma_mi type p decimals 2,
    V1 LIKE  IMRG-RECDV  ,
    V2 LIKE IMRG-RECDV  .
    SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: p_equnr FOR equi-equnr ,"no-extension no intervals,
    p_idate FOR imrg-idate, "NO-EXTENSION NO INTERVALS OBLIGATORY,
    p_recdu FOR imrg-recdu. "NO-EXTENSION NO INTERVALS default 'M3'" OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN END OF BLOCK blk2.
    SELECTION-SCREEN END OF BLOCK blk.
    TOP-OF-PAGE.
      FORMAT INTENSIFIED ON.
      WRITE:/1(40) ' INVESTMENT LIMITED '.
      WRITE:/50(40) ' FUEL CONSUMPTION REPORT ' CENTERED ,
      2 'Page', sy-pagno.
      FORMAT INTENSIFIED OFF.
      WRITE:/50(40) '----
    ' CENTERED .
      FORMAT INTENSIFIED ON.
      WRITE:/2 sy-datum COLOR 3, sy-uzeit .
      "WRITE:/1 S903-SPMON ."p_yearf.
      ULINE.
      "CENTERED.
      write: /2 'Date From :'.
      write: /2 'Equipment No :'.
      write: /2 'Unit :'.
      SKIP.
      ULINE.
      WRITE:/1 sy-vline,
      2 'EQUIP NO', 10 sy-vline,
      11 'NAME', 40 sy-vline,
      41 'min date', 50 sy-vline,
      51 'max date', 60 sy-vline,
      61 'min km', 70 sy-vline,
      71 'max km' , 80 sy-vline,
      81 't_max_min_km', 90 sy-vline,
      91 'min hr', 100 sy-vline,
      101 'max hr', 110 sy-vline,
      111 't_max_min_hr' , 120 sy-vline,
      121 'min lit', 130 sy-vline,
      131 'max lit', 140 sy-vline,
      141 't_max_min_lit', 150 sy-vline,
      151 'fuel con', 160 sy-vline,
      161 'km_l', 170 sy-vline,
      171 'lit_per_hr', 180 sy-vline.
      FORMAT COLOR 3 ON.
      ULINE.
    END-OF-PAGE.
    START-OF-SELECTION.
      select aequnr deqktx feqfnr eidate erecdu erecdv
      into table i_data
      from equi  AS a
      inner join equz as b
      on aequnr = bequnr
      inner join iloa as f
      on biloan = filoan
      inner join imptt as c
      on aobjnr = cmpobj
      inner join eqkt as d
      on aequnr = dequnr
      inner join imrg as e
      on epoint = cpoint
      where a~equnr in p_equnr
      and
      e~idate in p_idate
      and
      e~recdu in p_recdu.
        LOOP at i_data into wa_data.
             SORT i_data BY  equnr idate descending .
             "Read table i_data into wa_data index 1.
               move wa_data-recdv to max.
             SORT i_data BY  equnr idate ASCENDING .
            "Read table i_data into wa_data index 1.
               move wa_data-recdv to min.
         on change of wa_data-equnr.
         write:/ wa_data-equnr, wa_data-eqktx ,wa_data-eqfnr ,wa_data-idate ,wa_data-recdu ,
         'MIN',max EXPONENT 0 DECIMALS 2,
         'MAX',min EXPONENT 0 DECIMALS 2.  .
         endon.
        endloop.
        loop at i_data into wa_data.
        SORT i_data BY  equnr idate descending .
        move wa_data-recdv to max.
        endloop.
        loop at i_data into wa_data.
        SORT i_data BY  equnr idate ascending .
        move wa_data-recdv to min.
        endloop.
    regards
    Piroz

    Hi Experts
    I got the result but it is dividing in two lines one for max and another for min but I want the sub total subtraction after each max and min
    max   192300.00
    min    182139.00
    ========================
    max-min = 10161.00
    ========================
    max   649209.00
    min    642962.00
    ========================
    max-min = 6247.00
    ========================
         SORT i_data BY equnr idate descending .
    loop at i_data into wa_data.
            max = wa_data-recdv.
            min = wa_data-recdv.
    at new equnr.
            read table i_data into wa_data index sy-tabix.
            write:/ wa_data-equnr, wa_data-eqktx ,wa_data-eqfnr ,wa_data-idate ,'max',max EXPONENT 0 DECIMALS 2,wa_data-recdu .
            endat.
    at end of equnr.
            read table i_data into wa_data index sy-tabix.
            write:/ wa_data-equnr, wa_data-eqktx ,wa_data-eqfnr ,wa_data-idate ,'min', min EXPONENT 0 DECIMALS 2, wa_data-recdu .
    on change of wa_data-equnr.
    t_ma_mi = max - min.
    write:/ t_ma_mi.
    endon.
    endat.
    at end of equnr.
    SUM.
    write:/ '----
    endat.
    endloop.
    regards
    Piroz

  • Required UDF for comparing values within same context

    I have to compare values within the same context.I am getting boolean values for that field.If all the values in the same context are true,then the result should be true .Otherwise false  should be passed.
    If input is-
    <context>                                  
    true
    false
    true
    <context>
    true
    true
    <context>
    Output should be as-
    <context>
    false
    <context>
    true
    <context>
    Please suggest how to acheive this?..its urgent

    Hi,
    Check with this UDF
    Src>UDF>target
    public void context1(String[] a,ResultList result,Container container)
        int k = 0;
        int arrayLength = a.length;
        if (arrayLength > 0)
            String firstElement = a[0];
            for (int i = 1; i < arrayLength; ++i)
                   if(!(a<i>.equalsIgnoreCase(firstElement)))
                     k = 0;
                     break;
                   else
                     k = 1;
    if(k == 1)
        result.addValue("true");
    else
        result.addValue("false");

  • Qry return same value for a particular column for each row but not all time

    hi,
    We recently migrated to Oracle Database 10.2.0.3.0 from 9i. We were using a sql to populate a table and it had been running fine. After migration the same sql is fetching / population incorrect values, but not everytime. If we run the same sql again it gives a correct result.
    Ex:
    insert into a1 ( col1, col2, col3 )
    select a.field1, b.field2, c.field
    from tab1 a, tab2 b, tab3 c
    where a.field = b.field
    and b.field (+) = c.field
    something like this. Let us assume it fetches 200 rows
    But sometimes the col1 has the same value for all the 200 rows and col2, col3 has correct values. If we run the same sql next time, the col1 fetches the correct value and everything is correct.
    Could someone help on the above issue.

    I know it's difficult but can you put together a small test case for us to reproduce this behaviour? Did you contact Oracle Support?
    Any special constructs used behind the scenes? Virtual private database? Views?Materialized Views? Anything else?

  • Same text two different fields on one form

    HI.  I am trying to create button that allows me to copy text from one field to another on the same form.  In other words, at the top of my form i have a field for a "last name".  Under certain conditions i want to copy that "last name" into another field.  the button next to the latter field would ask "is the last name the same?"  if i hit that button then i want the text in the first field to import to the second field.  i think i need to use javascript but i can't write the asp.  help?

    George,
    These are the fields i want to copy.  Does the script look correct?
    // Get the value of the fields
    var v1 = getField("LENDER").valueAsString;
    var v2 = getField("TRUSTEE").valueAsString;
    var v3= getField("BORROWER").valueAsString;
    var v4 = getField("DATED_3").valueAsString;
    var v5 = getField("RECORDED_ 3").valueAsString;
    // Set the values of the other corresponding fields
    getField("LENDER_2").value = v1;
    getField("TRUSTEE_2").value = v2;
    getField("BORROWER_2").value = v3;
    getField("DATED_4").value = v4;
    getField("RECORDED_8").value = v5;

Maybe you are looking for

  • Forall in update statement

    Hi I have this procedure in may oracle 9.2. but it show me this error message in the forall statement.- Error: PLS-00382: wrong type in expression. why ??? ==============================0 PROCEDURE pr_com_upd_prim_carg -- MODIFICATION HISTORY -- Pers

  • Open documents

    Hi everyone, Is there a way to open any type of document and to display to the user ? How can I do it ? Thanks.

  • Problem in SAX XSD schema validator

    hi I've tried this code to validate XML using xsd file: public static void validate(String xmlFilePath, URL schemaFileUrl)         try             SAXParserFactory factory = SAXParserFactory.newInstance();             factory.setValidating(false);//

  • TS1424 Song Downloading error from iTunes Store to iPad

    While trying to download a song I bought from iTunes to my 4th gen iPad, it appear as it could not be downloaded even if I can play it. So I try to erase the song from the download window for the iTunes Store but doesn't let me, it remains there. Any

  • Will I have to enter my Facebook password every time I use their app, and how do I with Firefox?

    Password issues using FB.