Clarification in Select syntax

Hi Friends,
I have a requirement to write a selection query based on vendor name(LFA1-NAME1). In this select statement i need to use range of values to fetch records  like below
But if i use selection statement as below the selection is not accurate it miss out some records which starts with A* or B* or C*.
select * from lfa1 into table it_lfa1 where name1 in LFA1-NAME1.
If you have any solutions pls let me know.
Thanks!
Regards,
Manojkumar Nagarajan

Hi Manoj .
Here is the code... its working fine ..
TABLES : LFA1 .
DATA   :  IT_LFA1 TYPE TABLE OF LFA1,
           WA_LFA1  TYPE LFA1 .
DATA   : PA_STRING TYPE STRING .
SELECTION-SCREEN: BEGIN OF BLOCK B1.
  SELECT-OPTIONS : SO_NAME   FOR LFA1-NAME1 .
SELECTION-SCREEN : END OF BLOCK B1 .
LOOP AT SO_NAME .
REPLACE ALL OCCURRENCES OF '*'  IN SO_NAME-LOW  WITH '%'.
CONCATENATE '''' SO_NAME-LOW '''' INTO SO_NAME-LOW .
MODIFY SO_NAME .
ENDLOOP .
LOOP AT SO_NAME  .
  IF PA_STRING IS INITIAL .
  CONCATENATE   'NAME1 LIKE' SO_NAME-LOW  PA_STRING INTO PA_STRING SEPARATED BY ' '.
  ELSE .
  CONCATENATE   PA_STRING 'OR NAME1 LIKE'  SO_NAME-LOW  INTO PA_STRING SEPARATED BY ' '.
  ENDIF .
ENDLOOP .
SELECT * FROM LFA1 INTO TABLE IT_LFA1 WHERE (PA_STRING) .
LOOP AT IT_LFA1 INTO WA_LFA1.
WRITE : / WA_LFA1-LIFNR , WA_LFA1-NAME1 .
ENDLOOP .
follow the above code and do ur selection accordingly .cheers..
input
Output
Regards
DJ

Similar Messages

  • Can i use id on html:select syntax...

    Hi,
    i am using the following code to take data from the database directly to a dropdown box.
    <html:select property="lddate" style = "width:160">
    <html:option value="--SELECT--">SELECT</html:option>
    <html:options collection="loadDateList" name="almRecordsNotProcessedBO" property="lddate"
    labelProperty="lddate"/>
    </html:select>
    then after selecting the load-date from the drop-down box & clkng on submit button page is wrkng fine but in the dropdown it not showing the selected date.it is showing the default 1st entry in the drop-down box.
    Now i using a javascript for showing the selected date::::
    <script type="text/javascript">
    function getText(){
    var x=document.getElementById("aSelectControl")
    alert(x.options[x.selectedIndex].text)
    </script>
    But here i needed an id . In my Drop-down select code where i shuld use this id..i dont understand..i have checked for syntax of html:select but there is no id tag attribute of html:select.can anyone suggest me any other idea how to show that.
    can any one help me ..its very very urngent. i got stuck..plzzzz
    I have checked in the internet there is a select syntax where i can make use that id..
    Select the load date:
    <select id="aSelectControl">
    <option>25-12-2011</option>
    <option>26-11-2011</option>
    <option>27-11-2011</option>
    </select>
    But here the problem is i have to write the dates in a jsp page..but its not poss for my case...i have to take the date from databse. can any one tell me if i using the above query how to take data from the database.
    plzzzz help me..

    can anyone say where i am wrong in follwing syntax..
    function changeText2(val){
         var index = document.getElementById('prodlvl0').selectedIndex;
         alert("value="+document.getElementById('prodlvl0').value);
    alert("text="+document.getElementById('prodlvl0').options[index].text);
    <td class = "almtdheight" width="37%">
    <html:select property="lddate" style = "width:160" styleId="prodlvl0" onclick="changeText2(this.value)">
    <html:option value="--SELECT--">SELECT</html:option>
    <html:options collection="loadDateList" name="almRecordsNotProcessedBO" property="lddate" labelProperty="lddate"/>
    </html:select>
    </td>
    its not wrkng...

  • Need clarification regarding select query

    Hi,
    I need a little clarification regrding a Select senario
    I want to select data from table which have been minupulated between a certian date like between 1-DEC-10 to 31-DEC-10 and note that table does not have any time/date column. I've applied the following query to do this.
    select * from TABLE_NAME where sysdate between to_date('01-DEC-10') AND to_date('31-DEC-10');
    Would it work fine because I've tried it against a table and it returned me nothing however DML occur between time period.
    Regards,
    Abbasi

    Abbasi wrote:
    Hi,
    I need a little clarification regrding a Select senario
    I want to select data from table which have been minupulated between a certian date like between 1-DEC-10 to 31-DEC-10 and note that table does not have any time/date column. I've applied the following query to do this.
    select * from TABLE_NAME where sysdate between to_date('01-DEC-10') AND to_date('31-DEC-10');
    Would it work fine because I've tried it against a table and it returned me nothing however DML occur between time period.
    Regards,
    AbbasiAFAIK without log mining and auditing this is not possible.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/logminer.htm

  • How to optimize the ABAP select syntax

    Dear all:
        Anyone can help me to optimize the ABAP syntax like this:
    select objid stext from hrp1000
        into (itab-plans,itab-plstx)
              where plvar = '01'
                and istat = '1'
                and begda <= pn-begda
                and endda >= pn-begda
                and langu = sy-langu
                and otype = 'S'.
          if sy-subrc = 0.
            select single * from hrp1001
              where objid = itab-plans
                and rsign = 'A'
                and relat = '008'
                and plvar = '01'
                and begda <= pn-begda
                and endda >= pn-begda
                and sclas = 'P'
                and otype = 'S'.
            if sy-subrc <> 0.
              append itab.
              clear itab.
            endif.
          endif.
        endselect.
    In the table hrp1000 has almost 50000 records ,the table hrp1001 200000 records. I found that if i run the ABAP above ,my performance is so bad .
    Andone can help me ?

    Try using this FM and check how is the performance.
    RH_READ_OBJECT_SET
    A

  • Need clarification on select query Urgent!!!!!

    Hi ,
    i want clarification about this query , because i want improve performence to report in ST05 it is showing 1,40,250 time so i need to do some thing on this please any body help me out.
    SELECT  matnr  werks  dispo
                 FROM   marc
                 INTO   TABLE  it_marc
                        WHERE  matnr  IN  s_matnr  AND
                               werks  IN  s_werks  AND
                               dispo  EQ  p_dispo.
        DESCRIBE TABLE it_marc  LINES w_lines.
        IF  w_lines  IS INITIAL.
          MESSAGE e518(zv) WITH p_dispo.
        ENDIF.
      ENDIF.
    thanks,
    murali.

    SELECT matnr
      FROM mara
      INTO TABLE it_mara
      WHERE matnr IN s_matnr.
    IF sy-subrc eq 0.
      SELECT matnr werks dispo
        FROM marc
        INTO TABLE it_marc
        FOR ALL ENTRIES IN it_mara
        WHERE matnr = it_mara-matnr
          AND werks IN s_werks
          AND dispo EQ p_dispo.
      DESCRIBE TABLE it_marc LINES w_lines.
      IF w_lines IS INITIAL.
        MESSAGE e518(zv) WITH p_dispo.
      ENDIF.
    ENDIF.
    I am sorry, but I comment also bad recommendations, if I find any. And the above example such
    a bad recommendation.
    SELECT matnr
      FROM mara
      INTO TABLE it_mara
      WHERE matnr IN s_matnr.
    The first select selects much more than you really need, while there is only a select single necessary.
      DESCRIBE TABLE it_marc LINES w_lines.
      IF w_lines IS INITIAL.
    It is also not necessary to count 1000 of lines, if you want to know whether there was at least one records, a check
    of a sy-subrc is much better. This should also be done in the original coding.
    As said above, check what is in s_matnr and s_werks and what is suppossed to come back.
    Siegfried

  • Database SELECT SYNTAX

    hello
    I have a VI made with DB connectivity toolkit.  On it, I am using a DB tool select data.  I am trying to read a specific data from a table using a SQL query (in condition).  Well, when a using the sentence
    SELECT id FROM SensoresIR1 WHERE id=36151
    labview give me a error:
    Possible reason(s):
    ADO Error: 0x80040E14
    Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [MySQL][ODBC 3.51 Driver][mysqld-5.1.36-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT id FROM SensoresIR1 WHERE id=36151' at line 1 in NI_Database_API.lvlib:Conn Execute.vi->NI_Database_API.lvlibB Tools Select Data.vi->interfaz1.vi
    Possible reason(s):ADO Error: 0x80040E14Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [MySQL][ODBC 3.51 Driver][mysqld-5.1.36-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT id FROM SensoresIR1 WHERE id=36151' at line 1 in NI_Database_API.lvlib:Conn Execute.vi->NI_Database_API.lvlibB Tools Select Data.vi->interfaz1.vi
    can you help me?
    Carlos Bolvaran
    Vesat Ingenieria
    Solved!
    Go to Solution.

    Don't know what happened to my post, it should have had an additional sentence above 
    If you have just added the data to the table using LabVIEW and want to return the id number in order to create records in a linked table, there are various ways to query (as shown by nomade42k and Mareiusz).
    Assuming that your table is a simple one (not a stored procedure, no triggers or other customization), you can usually use a special query to retreive the IDENTITY 
    SELECT @@IDENTITY
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • Help on Select Syntax

    In MS-SQL Server you can write something like:
    select top 20 from Authors
    What is the equivalent of this in Oracle?
    Is there any link available describing oracle syntax for pl/sql?
    Thanks and Regards,
    Rumpa

    select *
    from authors
    where rownum <= 20
    Note: This is not a random selection, just the first 20. If you wish to have the top 20 then try:
    select *
    from authors
    where rownum <= 20
    order by name asc
    also, PL/SQL

  • Clarification on Select statement

    Hello all,
    can u please any one tell me the solution.
    In one condition.
    i am getting the data from marc mkpf and mseg
    my requirement is
    get the material number from marc based on plant on selection screen
    get some data from mkpf table based on posting date(budat) on selection screen entered .
    then
    get the material data from mseg table based on matnr = equal to point1
                                                   mblnr = equal to point2
                                                   mjahr = equal to point2.
                                here some fields is there that equal to selection screen fields.
    for that i have written the code like this
    one way:
    select matnr
           werks
      from marc
      into table out_it_marc
    where werks in s_werks.
    sort out_it_marc by matnr werks.
    delete adjacent duplicates from out_it_marc
                        comparing matnr werks.
    loop at out_it_marc into lfl_marc.
    vr_matnr-low = lfl_marc-matnr.
    vr_matnr-sign = c_in.
    vr_matnr-option = c_eq.
    append vr_matnr.
    clear : lfl_marc.
    endloop.
    FORM get_mseg_data
                   tables i_r_matnr  structure vr_matnr
                    USING  in_it_mkpf  type t_it_mkpf
                  changing out_it_mseg type t_it_mseg.
    if not in_it_mkpf[] is initial.
    select
            MBLNR    "Number of Material Document
            MJAHR   "Material Document Year
            BWART    "Movement Type (Inventory Management)
            MATNR    "Material Number
            WERKS    "Plant
            LGORT   "Storage location
            SOBKZ    "Special Stock Indicator
            LIFNR   "Vendor's account number
            KUNNR    "Account number of customer
            DMBTR    "Amount in local currency
            MENGE    "Quantity
            MEINS    "Base Unit of Measure
            EBELN    "Purchase order number
            KOSTL    "Cost Center
            AUFNR    "Order Number
            BUKRS    "company code
            PS_PSP_PNR  "Work Breakdown Structure Element (WBS Element)
            SAKTO  "G/L account number
         from mseg
          into table out_it_mseg
        for all entries in in_it_mkpf
      where mblnr eq in_it_mkpf-mblnr
        and mjahr eq in_it_mkpf-mjahr
        and bwart in s_bwart
        and matnr in vr_matnr
        and werks in s_werks
        and kostl in s_kostl
        and ps_psp_pnr in s_pspnr.
    endif.
    but its getting dump because of so many records
    so that i have written again like this.
    FORM get_mkpf_mseg_data  USING  in_it_marc type t_it_marc
                             changing out_it_mkpf_mseg type t_it_mkpf_mseg.
    if not in_it_marc[] is not initial.
    select A~mblnr
           A~mjahr
           A~budat
           A~cpudt
           A~cputm
           A~usnam
           A~xblnr
           B~BWART    "Movement Type (Inventory Management)
           B~MATNR    "Material Number
           B~WERKS    "Plant
           B~LGORT   "Storage location
           B~SOBKZ    "Special Stock Indicator
           B~LIFNR   "Vendor's account number
           B~KUNNR    "Account number of customer
           B~DMBTR    "Amount in local currency
           B~MENGE    "Quantity
           B~MEINS    "Base Unit of Measure
           B~EBELN    "Purchase order number
           B~KOSTL    "Cost Center
           B~AUFNR    "Order Number
           B~BUKRS    "company code
           B~PS_PSP_PNR  "Work Breakdown Structure Element (WBS Element)
           B~SAKTO  "G/L account number
      INTO TABLE out_it_mkpf_mseg
      from mkpf AS A INNER JOIN MSEG AS B
      ON AMBLNR = BMBLNR
      AND AMJAHR = BMJAHR
      FOR ALL ENTRIES IN IN_IT_MARC
      WHERE B~MATNR  = IN_IT_MARC-MATNR
        AND B~WERKS  = IN_IT_MARC-WERKS
        AND A~BUDAT IN S_BUDAT
        AND B~BWART IN S_BWART
       AND MATNR  = IN_IT_MSEG-MATNR
       AND WERKS  = IN_IT_MSEG-WERKS
        AND B~KOSTL IN S_KOSTL
        AND B~PS_PSP_PNR IN S_PSPNR.
      ENDIF.
    BREAK-POINT.
    ENDFORM.                    " get_mkpf_mseg_data
    but this select statement is not working properly
    is there anyway to solve it.
    please give me the solution ASAP, its urgent.
    Thanks in advance....

    Hi bs,
    you dont\'t have to build a range table vr_matnr for the selection, you just can use for all entries. See help on WHERE-clause:
    Suppose FTAB is filled as follows:
    CARRID  CONNID
    LH      2415
    SQ      0026
    LH      0400
    SELECT * FROM sflight INTO wa_sflight
        FOR ALL ENTRIES IN ftab
        WHERE CARRID = ftab-carrid AND
              CONNID = ftab-connid AND
              fldate = '20010228'.
      free = wa_sflight-seatsocc - wa_sflight-seatsmax.
      WRITE: / wa_sflight-carrid, wa_sflight-connid, free.
    ENDSELECT.
    Cheers,
    Stefan

  • Select syntax error

    select addrnumber name1 street str_suppl1 city1 region post_code1 country countrycode tel_number
    from adrc join t005t on adrc-country = t005t-land1 into table itab3 for all entries in itab1 where addrnumber = itab1-adrnr
    and t005t-spras = sy-langu.
    Error is Field "ADRC-COUNTRY" unknown.          
    I know the field exists so not sure how to resolve this

    select addrnumber name1 street str_suppl1 city1 region
             post_code1 country countrycode tel_number
                    from adrc
                         inner join t005t
                              on adrc~country = t005t~land1      "<- Use ~
                                     into table itab3
                                             for all entries in itab1
                                                 where adrc~addrnumber = itab1-adrnr   "<- Use ~
                                                     and t005t~spras = sy-langu.     "<- Use ~
    Assuming all of your field names are correct,  you need to use the ~  when defining the join and referencing the fields in the WHERE clause,  you only need to do this when working with joins.
    Regards,
    Rich Heilman

  • OPEN lcur_trade_cursor FOR select Syntax

    HI I am new to cursors .i am seeing this code in my package .any help what the code in block will do?what for this is defined ?
    or can u please explain the behaviour of this cursor meaning the data how populated?
    I would like to understand especially this block in square brackets
    [rec
                        WHERE      rec.par_amt <> rec.fa_trade_quantity OR
              rec.original_face_amt <> rec.fa_original_face_amt OR
              ( rec.current_trade_status_cd = 'EX' AND rec.fa_trade_status_cd <> '12' OR
              (rec.current_trade_status_cd = 'SAVED' AND (rec.sent_to_downstream = 'N' or rec.sent_to_downstream IS NULL)
                        AND rec.fa_trade_status_cd <> '11') OR
              ((rec.current_trade_status_cd = 'PN' AND rec.sent_to_downstream = 'Y') AND rec.fa_trade_status_cd <> '11') OR
              rec.current_trade_status_cd = 'TR' AND rec.fa_trade_status_cd <> '12');]
    OPEN lcur_trade_cursor FOR
                        SELECT pv_cycle_date_i,
                        FI_S2O_TRD_DIFF_SEQ.NEXTVAL,
                        rec.trade_effective_dt AS fide_trd_eff_dt,
                        rec.pot_trade_id AS pot_trade_id,
                        rec.fa_trade_id AS fide_trade_id,
                        rec.transaction_alternate_id AS transaction_alternate_id,
                        rec.fi_instrument_id AS fi_instrument_id,
                        rec.portfolio_id AS portfolio_id,
                        'Trades in FIDE and UDE but difference in Par Amount or Original Face Value or Trade Status',
                        rec.par_amt AS ude_par_amt,
                        rec.original_face_amt AS ude_original_face_amt,
                        rec.fa_trade_quantity AS fide_par_amt,
    rec.fa_original_face_amt AS fide_original_face_amt,
                        rec.txn_source_system_cd AS fide_source_system,
                        rec.trade_src_cd AS ude_source_system,
                        rec.settlement_dt AS settlement_dt,
                        pv_recon_type_i,
                        SYSTIMESTAMP,
                   USER,
                   SYSTIMESTAMP,
                   USER,
                        SYSTIMESTAMP
                        FROM (
                             SELECT
                             trd.trade_effective_dt ,
                             trd.transaction_alternate_id ,
              ude.pot_trade_id ,
              trd.fa_trade_id ,
              trd.fi_instrument_id ,
              trd.portfolio_id ,
                             trd.fa_trade_quantity          ,
                             trd.fa_original_face_amt          ,
                             ude.par_amt ,
                             ude.original_face_amt ,
                             trd.txn_source_system_cd ,
                             ude.trade_src_cd ,
                             trd.settlement_dt ,
                             ude.current_trade_status_cd ,
                             trd.fa_trade_status_cd ,
                             trd.sent_to_downstream
                        FROM FUND_TRADE_V trd,
                                  STG_SYB_TRADES ude,
                                  FI_FUND_SUBPORTFOLIO sub,
                                  INSTRUMENT_ALTERNATE_ID ia
                        WHERE trd.trade_effective_dt >= pv_cycle_date_i
                        AND ude.trade_effective_dt >= pv_cycle_date_i
                        AND trd.transaction_alternate_id = ude.trade_sequence_nbr
                        AND ude.trade_effective_dt = trd.trade_effective_dt
                        AND ude.recon_type = pv_recon_type_i
                        AND trd.portfolio_id = sub.portfolio_id
                        AND ude.fund_nbr = sub.fund_nbr
                        AND ude.subportfolio_nbr = sub.subportfolio_nbr
                        AND trd.fi_instrument_id = ia.fi_instrument_id
                        AND ia.alternate_id_type_code ='FMR_CUSIP'
                        AND ude.fmr_cusip = ia.alternate_id
                        AND EXISTS
              ( SELECT 1
              FROM HLDGS_RECON_TAXBD_GRP_FUND_MV mm,
                                            FUND fnd
              WHERE mm.parent_grp = 'OMS_FUND'
              AND mm.member_grp = 'MM_FUND'
              AND mm.fund_nbr = ude.fund_nbr
                                  AND mm.fund_nbr     = fnd.fund_nbr
                                  AND fnd.fund_ending_dt IS NULL
                   ) rec
                        WHERE      rec.par_amt <> rec.fa_trade_quantity OR
              rec.original_face_amt <> rec.fa_original_face_amt OR
              ( rec.current_trade_status_cd = 'EX' AND rec.fa_trade_status_cd <> '12' OR
              (rec.current_trade_status_cd = 'SAVED' AND (rec.sent_to_downstream = 'N' or rec.sent_to_downstream IS NULL)
                        AND rec.fa_trade_status_cd <> '11') OR
              ((rec.current_trade_status_cd = 'PN' AND rec.sent_to_downstream = 'Y') AND rec.fa_trade_status_cd <> '11') OR
              rec.current_trade_status_cd = 'TR' AND rec.fa_trade_status_cd <> '12');
    Edited by: 945400 on Aug 23, 2012 3:24 AM

    This is one of those situations where if you formatted the code for readability the answer falls right out.
    OPEN lcur_trade_cursor FOR
    SELECT pv_cycle_date_i,
           FI_S2O_TRD_DIFF_SEQ.NEXTVAL,
           rec.trade_effective_dt AS fide_trd_eff_dt,
           rec.pot_trade_id AS pot_trade_id,
           rec.fa_trade_id AS fide_trade_id,
           rec.transaction_alternate_id AS transaction_alternate_id,
           rec.fi_instrument_id AS fi_instrument_id,
           rec.portfolio_id AS portfolio_id,
           'Trades in FIDE and UDE but difference in Par Amount or Original Face Value or Trade Status',
           rec.par_amt AS ude_par_amt,
           rec.original_face_amt AS ude_original_face_amt,
           rec.fa_trade_quantity AS fide_par_amt,
           rec.fa_original_face_amt AS fide_original_face_amt,
           rec.txn_source_system_cd AS fide_source_system,
           rec.trade_src_cd AS ude_source_system,
           rec.settlement_dt AS settlement_dt,
           pv_recon_type_i,
           SYSTIMESTAMP,
           USER,
           SYSTIMESTAMP,
           USER,
           SYSTIMESTAMP
      FROM (SELECT trd.trade_effective_dt,
                   trd.transaction_alternate_id,
                   ude.pot_trade_id,
                   trd.fa_trade_id,
                   trd.fi_instrument_id,
                   trd.portfolio_id,
                   trd.fa_trade_quantity,
                   trd.fa_original_face_amt,
                   ude.par_amt,
                   ude.original_face_amt,
                   trd.txn_source_system_cd,
                   ude.trade_src_cd,
                   trd.settlement_dt,
                   ude.current_trade_status_cd,
                   trd.fa_trade_status_cd,
                   trd.sent_to_downstream
              FROM FUND_TRADE_V trd,
                   STG_SYB_TRADES ude,
                   FI_FUND_SUBPORTFOLIO sub,
                   INSTRUMENT_ALTERNATE_ID ia
             WHERE     trd.trade_effective_dt >= pv_cycle_date_i
                   AND ude.trade_effective_dt >= pv_cycle_date_i
                   AND trd.transaction_alternate_id = ude.trade_sequence_nbr
                   AND ude.trade_effective_dt = trd.trade_effective_dt
                   AND ude.recon_type = pv_recon_type_i
                   AND trd.portfolio_id = sub.portfolio_id
                   AND ude.fund_nbr = sub.fund_nbr
                   AND ude.subportfolio_nbr = sub.subportfolio_nbr
                   AND trd.fi_instrument_id = ia.fi_instrument_id
                   AND ia.alternate_id_type_code = 'FMR_CUSIP'
                   AND ude.fmr_cusip = ia.alternate_id
                   AND EXISTS
                          (SELECT 1
                             FROM HLDGS_RECON_TAXBD_GRP_FUND_MV mm, FUND fnd
                            WHERE     mm.parent_grp = 'OMS_FUND'
                                  AND mm.member_grp = 'MM_FUND'
                                  AND mm.fund_nbr = ude.fund_nbr
                                  AND mm.fund_nbr = fnd.fund_nbr
                                  AND fnd.fund_ending_dt IS NULL)) rec
    WHERE    rec.par_amt != rec.fa_trade_quantity
           OR rec.original_face_amt != rec.fa_original_face_amt
           OR (       rec.current_trade_status_cd = 'EX'
                  AND rec.fa_trade_status_cd != '12'
               OR (    rec.current_trade_status_cd = 'SAVED'
                   AND (   rec.sent_to_downstream = 'N'
                        OR rec.sent_to_downstream IS NULL)
                   AND rec.fa_trade_status_cd != '11')
               OR (    (    rec.current_trade_status_cd = 'PN'
                        AND rec.sent_to_downstream = 'Y')
                   AND rec.fa_trade_status_cd != '11')
               OR     rec.current_trade_status_cd = 'TR'
                  AND rec.fa_trade_status_cd != '12');'rec' is an alias for a query defined in the FROM clause.

  • Diff "full outer join" va. "(+)" SELECT syntax ?

    As far as I know there are two ways of defining an outer join:
    Select ... from tab1 t1 full outer join tab2 t2 on t1.id =t2.id;
    or:
    Select ... from tab1 t1, tab2 t2 where t1.id = t2.id(+)
    Are they absolutely equivialent?
    Which are the most common one?
    Which are used on other databases (DB2, MySQL) as well?
    Can I put an additional WHERE clause at the end in the first statement:
    Select ... from tab1 t1 full outer join tab2 t2 on t1.id =t2.id WHERE .....;

    Select ... from tab1 t1 full outer join tab2 t2 on t1.id =t2.id;This is FULL OUTER JOIN
    Select ... from tab1 t1, tab2 t2 where t1.id = t2.id(+)This is LEFT OUTER JOIN.
    They are entirely different.
    FULL OUTER JOIN - Gets all the rows from tab1 and tab2
    LEFT OUTER JOIN - Gets all the rows from tab1 and only the row that matches with join condition from tab2.
    Here is a simple test.
    create table tab1(id integer)
    create table tab2(id integer)
    begin
      insert into tab1 values(1);
      insert into tab1 values(2);
      insert into tab1 values(3);
    end;
    begin
      insert into tab2 values(3);
      insert into tab2 values(4);
      insert into tab2 values(5);
    end;
    Select t1.id, t2.id
      from tab1 t1 full outer join tab2 t2
        on t1.id =t2.id
    Select t1.id, t2.id
      from tab1 t1, tab2 t2
    where t1.id = t2.id(+)
    /Run it and see the result.

  • Select syntax

    select zterm vtext
    from tvzbt into table itab8
    for all entries in itab4
    where zterm = vbkd-zterm and vbkd-vbeln = itab4-vbeln and spras = sy-langu.
    Error is Field "VBKD-VBELN" unknown.

    Hello,
    In the below select u r selecting data from the table TVZBT.
    select zterm vtext
    from tvzbt into table itab8
    for all entries in itab4
    where zterm = vbkd-zterm
       and vbkd-vbeln = itab4-vbeln   "  Check here
       and spras = sy-langu
    Instead give like this
    "Check Here   and vbeln = itab4-vbeln   "  Check here
    Regards,
    Vasanth

  • Clarification on SELECT for UPDATE

    HI All,
    I am doing a SELECT FOR UPDATE using NOWAIT as well as SKIPLOCKED option. I have question regarding the general behavior.
    Suppose let say , I have two tables (table1 and table 2 ).
    TABLE 1
    header_id NUMBER,
    service_id NUMBER
    TABLE 2
    header_id NUMBER,
    line_id NUMBER,
    status VARCHAR2
    And I run the following query
    SELECT t2.header_id, t2.line_id
    FROM table1 t1, table2 t2
    WHERE t1.header_id = t2.header_id
    AND t1.service_id = 1
    AND t2.status = 'SUCCESS'
    FOR UPDATE OF t2.status NOWAIT SKIP LOCKED;
    Questions
    1) Does adding both the NOWAIT and SKIP LOCKED in the sql help or just SKIP LOCKED would do fine.
    2) Lets say this SQL is executed when there are no rows with status as 'SUCCESS' in table2. Would this cause any performance impact. Like for example since its joining with table1 with table 2 based on the header id .Would it lock any rows on table1?
    ( My understanding was that it would not lock any row until it finds out any row with status as 'SUCCESS' but getting some conflicting answers)
    Thanks,
    Vj

    AKVK wrote:
    ( My understanding was that it would not lock any row until it finds out any row with status as 'SUCCESS' but getting some conflicting answers)THis would be my understanding too.
    To be sure make a test.
    Do the select for update so that it does not lock any rows.
    Then check the data dictionary select * from v$lock; to see for your session if there are any locks.

  • Select query in Advanced SQL Filter

    Hi All
    I am creating a shared filter and I need to write an sql statement for a column. Can I use
    string functions in the Advanced SQL Filter. My sql query is :
    select distinct "Exchange Rate"."Type" from "Credit"
    where substr(rtrim("Exchange Rate"."Type"),-1,2) in (select distinct substr(rtrim( "-Year"."Year Name"),-1,2)
    from "Credit" where CURRENT_DATE between "-Year"."Year Start Date" and "-Year"."Year End Date" )
    where, "Credit" = Name of the subject area
    "Exchange Rate" and "-Year"= presentation tables
    I'm getting the error:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27002] Near <select>: Syntax error [nQSError: 26012] . (HY000)
    I then tried a simple query in the Advanced SQL Filter: "Exchange Rate"."Type" = SELECT "Exchange Rate"."Type" FROM "Credit"
    which does not work either.
    Can't seem to debug the problem.
    Thanks

    Hi user770000,
    How did you resolve the issue. I am trying to use the sql query in the filter and getting same error as yours.
    Here is the advanced SQL of the filter condition
    CAST("ARRA Financial Weekly Report"."DW Updated" AS DATE) = SELECT MAX(CAST("ARRA Financial Weekly Report"."DW Updated" AS DATE)) from "ARRA Recovery Act Status"
    When I issue following sql in direct sql, it returns required value
    SELECT MAX(CAST("ARRA Financial Weekly Report"."DW Updated" AS DATE)) from "ARRA Recovery Act Status"

  • Selection in data load from infoprovider

    Hi Guys,
    In BPC NW 7.5 we have to load data from infoprovider allowing users to select data (like for dimension TIME) by BPC prompt.  We found two solutions solving partially our problem. In fact, users have to modify manually the selections.
    SOLUTION 1:
    To load data we want use the process chain /CPMB/INFOPROVIDER, but we know that it is not possible insert selections in the /CPMB/INFOPROVIDER prompt (as describe in this post Re: Package LOAD INFOPROVIDER, Select input ENTITY).
    To select data we can use an intermediate infocube as a BW workaround (as describe in this post Re: BPC 7.5: Delta Load when loading from BI InfoProvider ) to have a source with only the selected data.This could be done by a selection in the DTP between the source infocube and the intermediate infocube. This solution is not dynamic, in fact, in this case users have to modify manually the DTP selection.
    How can we allow users to insert this selection in the DTP by a BPC prompt?
    SOLUTION 2:
    To select data we can use a transformation file inserting a selection like
    SELECTION = <Dimension1_techname>,<Dimension1_value>.
    It is not dynamic, in fact, also in this case users have to modify manually the file selection.
    Do you know how to allow these selection by a BPC prompt to avoid these manual changes?
    Do you know other solutions?
    Thank you for your support.

    Hi D-Mark,
    This is definitely a place where it would be nice to see some additional functionality added to BPC. Variable replacement in the transformation file based on the data manager prompt would probably be the best thing to have in the software.
    In any case, getting back to your question, manually modifying the transformation file selection is the most common practice on BPC projects. The blog linked by Naresh is a fairly elegant way to do this, though it doesn't completely get around the fact that it's easy to forget to do and easy to get confused about what is going on in the transformation file.
    A third option that no one has mentioned is to do a SELECTION statement in the transformation file based on navigational attributes in the source InfoProvider. This approach can make the selection statement dynamic based on the contents of BW InfoObjects. Still not very user-friendly, but if you can put an automatic process in place to update the BW navigational attributes this might meet your need without having to set up an extra BW staging InfoProvider.
    The SELECTION syntax is documented here, though it doesn't mention that you can select on navigational attributes: [http://help.sap.com/saphelp_bpc75_nw/helpdata/en/5d/9a3fba600e4de29e2d165644d67bd1/frameset.htm]
    With navigational attributes (the profit center attribute of cost center, for example) it would be something like:
    SELECTION=0COST_CENTER___0PROFIT_CENTER,PC01
    Ethan

Maybe you are looking for

  • How can I repair jpeg files that seem to be damaged in my iPad?

    Hello everyone. I have an iPad 1 where I put some pictures using a PC and that were not sync by iTunes. Hope that makes sense, I did't use the iTunes rather just drop the folder with the pics in the iPad using a PC (like pretty much an external drive

  • Challenging network disruption problem

    Hi folks, In our network we have multiple Cat5500 with RSM running multiple vlans, connected to each other via Gigabit Ethernet. One of our RSM recently keeps on displaying this error message after rebooting: Aug 2 16:33:25 GMT: %ALIGN-3-SPURIOUS: Sp

  • When I'm in iTunes, after a few minutes it sends me to my homepage

    When I'm in iTunes listening to music after a few minutes it sends me to my homepage. Please help!!!!

  • Too many open cursors

    Could someone help me understand this problem, and how to remedy it? We're getting warnings as the number of open cursors nears 1200. I've located the V$OPEN_CURSOR view, and after investigating it, this is what I think: Currently: SQL> select count(

  • Broadcaster Distribution Types

    Hi All, I want to precalculate the 7.0 web template so that it won't hit the queries improving performance. I am looking for functionality similar to 3.5 reporting agent settings for web templates (precalculating only data and accessing via DATA_MODE