Hide Logical Db Selection Filed

Hi guys!!
Is it possible to hide a selection field provided by the logical database? For instance:
I use the LDB PSJ.
In my ABAP code I have:
                                    GET prps_r.
                                    Get proj.
When I run the program the selection fileds of my LDB appear. How can i hide the filed: PSP-Element?
Thanks!
Manuel

Hi Manuel!
Try this to hide the first input field:
AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF screen-name = 'CN_PSPNR-LOW'.
      screen-active = 0.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
For all the other Fields you have to use CN_PSPNR-HIGH, ...
If you can't get all the field-names using F1 and tecnical Info, try to set a break-Point in this section and debugg the loop.

Similar Messages

  • Add new field infotype "z" in logical database selection screen pnp

    Can add new field infotype "z" in logical database selection screen pnp
    I could explain how to realize
    Thanks

    In case to somebody it interests to him: TO EXTEND SCREEN OF SELECTION WITH OPTIONAL DELIMITERS The case that can be given in a screen of selection of a logical data base it does not appear a certain field that we need in the filter, the steps that will be due to follow are the following:
    u2022 To create a view of selection in agreement with the fields that we want to show To review the following Link http://help.sap.com/saphelp_46c/helpdata/es/6e/6ed638e70ef679e10000000a114084/content.htm u2022 To assign the view of selection to a class of report
    u2022 In the code of report to create select option in the selection screen that allows to introduce imput to leak and after start-of-selection to put the following code,
    "Allocation operative area to optional delimiter
      IF NOT p_aroper IS INITIAL.
        DATA: lt_texpr TYPE rsds_expr OCCURS 0 WITH HEADER LINE,
              wa_texpr TYPE rsds_expr,
              lt_rsds_expr_tab LIKE rsdsexpr OCCURS 10 WITH HEADER LINE,
              wa_rsds_expr_tab LIKE rsdsexpr.
        REFRESH lt_rsds_expr_tab.
        wa_rsds_expr_tab-arity = '0'.
        wa_rsds_expr_tab-fieldname = 'OBJID'.
        wa_rsds_expr_tab-option = 'EQ'.
        wa_rsds_expr_tab-low = p_aroper.
        wa_rsds_expr_tab-high = '00000000'.
        MOVE-CORRESPONDING wa_rsds_expr_tab TO lt_rsds_expr_tab.
        APPEND lt_rsds_expr_tab.
        REFRESH lt_texpr.
        wa_texpr-tablename = 'PA9004'.
        wa_texpr-expr_tab[] = lt_rsds_expr_tab[].
        MOVE-CORRESPONDING wa_texpr TO lt_texpr.
        APPEND lt_texpr.
      pnpdynse[] = lt_texpr[].
      ENDIF.
    English is the forum language.
    Edited by: Rob Burbank on May 18, 2011 11:41 AM

  • How to hide block on selection screen?

    Hi All,
    I want to hide a block on the selection screen. I implemented the following logic to hide the block the fields are getting hided but the block is displayed. is there any way to hide block also.
    SELECTION-SCREEN BEGIN OF BLOCK processing WITH FRAME TITLE text-030.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 1.
    PARAMETERS pa_xmanu LIKE rm08mrbr-manu DEFAULT 'X'
                       RADIOBUTTON GROUP val MODIF ID ID1.
    SELECTION-SCREEN COMMENT 3(30) text-040 FOR FIELD pa_xmanu.
    SELECTION-SCREEN POSITION 40.
    PARAMETERS pa_xauto LIKE rm08mrbr-auto
                       RADIOBUTTON GROUP val MODIF ID ID1.
    SELECTION-SCREEN COMMENT 43(30) text-050 FOR FIELD pa_xauto.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: pa_xskto LIKE rm08mrbr-skto AS CHECKBOX MODIF ID ID1.
    SELECTION-SCREEN COMMENT 3(30) text-055
                                   FOR FIELD pa_xskto.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK processing.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF SCREEN-GROUP1 = 'ID1'.
          SCREEN-ACTIVE = 0.
          modify screen.
        ENDIF.
      ENDLOOP.
    Thanks,
    Anil.

    Make sure you hide your comment lines with the MODIF ID as well.  
    selection-screen begin of block processing with frame title text-030.
    selection-screen begin of line.
    selection-screen position 1.
    parameters pa_xmanu like rm08mrbr-manu default 'X'
    radiobutton group val modif id id1.
    selection-screen comment 3(30) text-040 for field pa_xmanu modif id id1.  "<---  Here
    selection-screen position 40.
    parameters pa_xauto like rm08mrbr-auto
    radiobutton group val modif id id1.
    selection-screen comment 43(30) text-050
                                   for field pa_xauto modif id id1.  "<---  Here
    selection-screen end of line.
    selection-screen begin of line.
    parameters: pa_xskto like rm08mrbr-skto as checkbox modif id id1.
    selection-screen comment 3(30) text-055
    for field pa_xskto modif id id1.          "<---  Here
    selection-screen end of line.
    selection-screen end of block processing.
    at selection-screen output.
      loop at screen.
        if screen-group1 = 'ID1'.
          screen-active = 0.
          modify screen.
        endif.
      endloop.
    Regards,
    Rich Heilman

  • Show/hide fields when selecting an option from a drop-down menu.

    Hello Gurus!
    I have a question about creating a Java Script withing Acrobat pro.  This is what i would like to do: I created a drop-down menu with several selection entries.  Upon the customer making one of the selection entries, i would like for the correct fields that i created to become visible and all other fields to hide.  Is this even possible to do?  The reasoning behind this is because we have a form that customers have to generate in order to request access to certain financial accounts; we have over 20 different types of accounts and for each instance the customer has to fill out the same form.  By creating a drop down menu, i can use the same form by just changing the drop-down selection and clicking on the designated fields for that selection.  At this time i have over 20 different forms that poing to 20 different account requests and i would hate to send the form 20 different times to one person.  The reason i can not add all fields desired for all accounts is due to the fact that the form would be filled with hundreds of checkmarks and instructions thus making the process too tideous for the customer.  Hope you guys can help out.
    ~Vader

    The good news is, it can be done (and it has been done).
    There are a few things to be aware of, however.
    The most important is that the form must be planned well, which means that you must think carefully about your logic and even more so about your field naming (hierarchical field names are your friend). One fundamental issue, you have to be aware of, is that this form no longer will be a "standard form". The consequence of this is that you may have to be aware that you might get into trouble when you have to prove that your user filled out that particular standard form (talk to your compliance and forms management people about that).
    You also may have to decide whether the form should be usable in Reader. And, if so, how much you want to spend on the right to do so. You will see below why…
    There are actually two approaches for dynamically showing/hiding parts of a form. If your form can be separated between a fixed first page (where you also have the account type selection), and a variable part (depending on the selection), you could use Templates, which you spawn according to the selection, and delete pages when you change the selection. This approach is very easy to implement, but requires Reader Extensions Server to allow it to work in Reader; Acrobat Pro's extended rights are not sufficient for that.
    The other approach is showing/hiding fields. If you did your homework well, it would be very easy to first hide all subsequent fields, and then show the ones you need in two lines of code. This approach does not require extended rights for Reader at all, as long as your forms will always have the same number of pages, for each of your account types. This approach also works for the cases where the differences between the individual forms are very small. It does also work for showing/hiding bigger chunks of the form. In that case, you might create the "background" separately, and then put it as an icon into a button field which you will show/hide together with the carefully placed on top of it active fill-out fields.
    There is a third possibility, which Adobe Propaganda probably would suggest, and that woudl be subforms in LiveCycle Designer. The consequence is, however, that you won't have PDF forms, but proprietary XFA forms instead. And you may have more developing and maintenance work than with the other approaches.
    Back to your original question: you could use a Keystroke script evaluating event.changeEx of the combo box field. Depending on that, you would run your action to set up the according form part. The other way to do it would be evaluating event.value in the onBlur event. The latter would have the advantage that the selection has been made, and you get a bit more time to set up the form (this may in fact be an issue, particularly with Acrobat 9 and 10, which may take their time to show/hide fields).
    Another possibility instead of a drop down (combo box field) would be a popup, where you would have a button to press, and the list of selections pops up. This second method uses app.popUpMenuEx().
    Hope this can help.
    Max Wyss.

  • If else logic in select statement

    Hi,
    Can someone kindly explain me how can i use if-else logic in the place of case statement in the below query.
    SELECT deptno, empno, ename, sal,
                 CASE
                    WHEN deptno = 10
                       THEN sal * 0.05
                    WHEN deptno = 20
                       THEN sal * 0.10
                 END AS new_sal
            FROM emp;Thanks in advance!!

    CREATE OR REPLACE PROCEDURE calsal
    IS
       new_sal number;
       CURSOR sal_cursor
       IS
          SELECT deptno, empno, ename, sal
            FROM emp;
    BEGIN
       FOR i IN sal_cursor
       LOOP
              if i.deptno = 10 then
                   new_sal := i.sal *0.05 ;
               DBMS_OUTPUT.put_line (   ' Salary plus bonus of '
                                || i.empno
                                || ' is '
                                || (new_sal)
           elsif i.deptno = 20 then
                   new_sal := i.sal *0.1 ;
               DBMS_OUTPUT.put_line (   ' Salary plus bonus of '
                                || i.empno
                                || ' is '
                                || (new_sal)
           else
                     new_sal := 0 ;
               DBMS_OUTPUT.put_line (   ' Salary plus bonus of '
                                || i.empno
                                || ' is '
                                || (new_sal)
           end if;
       END LOOP;
    END;
    / Are you learning Oracle or sql or pl/sql ?
    The syntax and example of if in oracle is easily awailable in bunch of documents provided in google search results..
    Regards,
    Dipali..

  • Logic to select Report name based on User's input.

    Hi Guru's
    Good Morning!
    I have a requirement to create a XMLPUBLISHER Report Whihc is Called as ITEM COUNT SUMMARY + ITEM COUNT DETAIL REPORT Following below
    are my ParameterS
    0.REPORT NAME
    1.ORG
    2.ORG COUNTRY
    3.ITEM SELECTION
    4.ORDER TYPE
    5.STATUS
    6.RECEIPT DATE FROM
    7.RECEIPT DATE TO
    8.TRANSIT DAYS
    REPORT NAME: PARAMETER WILL LET THE USER to select the requrired Reports to be run.
    ORG: is the Names of the SHIP FROM ORG
    ORG COUNTRY: is a Dependent Parameter based on the ORG (i.e When a SHIP FROM ORG is Selected the ORG CHOICE Should have the CHoices for the selected ORG and when Nothing Selected from that ORG it should run for every ORG COUNTRY in that SHIP FROM ORG Currently we have two ORG COUNTRY PER SHIP FROM ORG say(USA, CANADA)
    ITEM SELECTION: We need to Run this Report based on Item Selection ( The Logic should handle a total item selection whihc are comma seperated for upto 29
    items)
    ORDER TYPE : Types of Order Again this can be a List of Comma Seperated Values for order Types
    STATUS: STatus should be Comma Seperated (ENTERED,WAVED,NOTWAVED,SHIPPED)
    TRANSIT DAYS: Transit Days
    RECEIPT DATE FROM: This is the Starting DATe range for the REport to be run
    RECEIPT DATE TO: This is the END DATe range for the REport to be run.
    The ITEM COUNT SUMMARY Report should allow the users to run the report 3 ways
    1.ITEM COUNT RUN BY ORDER TYPE ( for all the STATUS)
    2.ITME COUNT RUN BY STATUS ( FOR all the ORDER TYPES)
    3.ITEM COUNT RUN BY TRANSIT DAYS
    And My approach is I have three Queries Created for the above and in the DATA DEFINITION File
    I have them Listed my DATA DEFININTION ( Sorry as my Query's GO More than 70+ LINES for Each Query I thought I will just paste the Order How i have arranged my queries in the Tempalte)
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <dataTemplate name="TPC_ITEM_COUNT_SUMMARY" description = "TPC_ITEM_COUNT_SUMMARY" version="1.0">
    <properties>
         <property name="xml_tag_case" value="upper"/>
    </properties>
    <!-- parameters for the Report -->
         <parameters>
         <parameter name="report_name" dataType="varchar2"/>
         <parameter name="item_selection"          dataType="varchar2"/>
         <parameter name="order_type"               dataType="varchar2"/>
         <parameter name="pstatus"               dataType="varchar2"/>
         <parameter name="org_name"               dataType="varchar2"/>
         <parameter name="org_choice"               dataType="number"/>
         <parameter name="first_receipt_date"     dataType="date"/>
         <parameter name="last_receipt_date"     dataType="date"/>
         <parameter name="from_date"               dataType="date"/>
         <parameter name="to_date"                    dataType="date"/>
         <parameter name="transit_days"          dataType="number"/>
         </parameters>
    <dataQuery>
    <sqlStatement name= "HDR">
    <![CDATA[
    SELECT UPPER('The ABC Corporation, Ltd.')     AS "COMPANY"
                   ,'Item Count Summary - '||INITCAP(:report_selection)||' for Company '||:org_name AS "REPORT"
                   ,'Order Types - '||UPPER(:order_type) AS "ORDER_TYPE"
                   , SYSDATE AS "RUN_DATE"
         ,'Receipt Date'||' '||TO_CHAR(NVL(TO_DATE(:first_receipt_date,'DD-MON-YYYY'),SYSDATE),'YYYYMMDD')                     ||' '||'thru'||' '||TO_CHAR(NVL(TO_DATE(:last_receipt_date,'DD-MON-YYYY'),SYSDATE),'YYYYMMDD') AS "RANGE"
    FROM DUAL;
    ]]>               
    </sqlStatement>
    <sqlStatement name= "BY_STATUS">
         <![CDATA[
    Query for ITEM COUNT SUMMARY by STATUS
    ]]>
    </sqlStatement>
    <sqlStatement name= "BY_ORDERTYPE">
         <![CDATA[
    Query for ITEM COUNT SUMMARY by ORDERTYPE
    ]]>
    </sqlStatement>
    <sqlStatement name= "BY_TRANSITDAYS">
         <![CDATA[
    Query for ITEM COUNT SUMMARY by TRANSITDAYS
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="G_HDR" source="HDR">
              <element name="COMPANY" value="COMPANY" />
              <element name="REPORT" value="REPORT" />
              <element name="ORDER_TYPE" value="ORDER_TYPE" />
              <element name="RANGE" value="RANGE" />
    </group>
    <group name="G_BY_STATUS" source="BY_STATUS">                
              <element name="RCPT_DT" value="RCPT_DT"/>
    <element name="ITEM"     value="ITEM" />
              <element name="ITEM_DESCRIPTION" value="ITEM_DESCRIPTION" />
              <element name="ENTERED"     value="ENTERED" />
    <element name="WAVED"     value="WAVED" />
    <element name="NOTWAVED"     value="NOTWAVED" />
    <element name="SHIPPED"     value="SHIPPED"/>
    </group>
              <group name="G_BY_ORDERTYPE" source="BY_ORDERTYPE">                                         
    <element name="ITEM"          value="ITEM" />
              <element name="ITEM_DESCRIPTION" value="ITEM_DESCRIPTION" />
              <element name="RCPT_DT"     value="RCPT_DT"/>
              <element name="ORDER_TYPE"     value="ORDER_TYPE" />
    <element name="QUANTITY" value="QUANTITY" />
              </group>
    </dataStructure>
    </dataTemplate>
    Now My Problem is How Do i Get a Logic to Let the Report Name Selection To be REferenced in the Data Definition file..
    I would like to request you to Please help me out in arriving at a Solution for Implementing the Logic
    When the USer selects ITEM COUNT SUMMARY BY ORDER TYPE I want "BY_ORDERTYPE" to be Executed and so on..
    Is there a Way That I can Write in my Data definition file as
    DECODE(:REPORT_NAME ,'ITEM COUNT SUMMARY BY ORDERTYPE', Run query for BY_ORDERTYPE,
    ,'ITEM COUNT SUMMARY BY STATUS', Run query for BY_STATUS,
    ,'ITEM COUNT SUMMARY BY TRANSIT DAYS', Run query for BY_TRANSITDAYS,run query for DETAIL REPORT);
    Also My Item Description Contains Special Characters like Registered Symbol, Copyright Symbol How would I force my XML Parser to Still consider them as TEXT's
    May I Directly Specify <?xdofx:DECODE :REPORT_NAME = 'ITEM COUNT SUMMARY BY ORDERTYPE' THEN BY_ORDERTYPE ?> in the DATA DEFINITION file , I think this is only allowed in RTF please Help,
    Thanks
    vasanthanand

    Thanks for the Reply sir,
    When you say Write the Code, you are referring to the Package is that correct,unfortunately I am not implementing this via PL/SQL Package.
    you mentioned that I can Implement the Logic in the Data definition file( which is a XML file), how and Where I have print use that IF construct (or) Can you Please Print the Code snippet in the Model XML template that i have pasted in my Post.
    May i know what is this
    ln_req_id := fnd_request.submit_request -- for XML1 For...
    Sorry about my ignorance...

  • Logical Database Selection Text?

    We have a report (run from the report tree) that above the selection-screen window a field with a range, SAUFNR  is displayed. Someone tried to go into the Logical Database POH (SE36), selection texts were there was a '?' and changed it to 'Order Number'  and were able to save it. However, SAUFNR still displays and not the text.
    The main goal is to disply 'Order Number' for this field and not 'SAUFN'. It is an SAP prog with a name about a footbal field long.  It executed 'Orders by finished Schedule date'.
      Any suggestions?
                                    Thank-you.

    Hi Tom,
    Have you activated the selection text and also please check in translation part of the text elements .
    Hope this may help you.
    Regards,
    Kiran I

  • Logical Database- Selection screen

    Hi
    I am using a logical database SDF . The logical DB has two blocks in selection screen. But I don't want to display these two blocks. I need only one . please suggest how would i do that

    Hello
    You may want to look at fm SELECT_OPTIONS_RESTRICT.
    This FM can be used to modify the selection screen of a LDB.
    It is documented by SAP so check the documentation for an example.
    Regards
    Greg Kern
    Edited by: Greg Kern on Oct 28, 2008 8:32 AM

  • Possible to modify Logical Database Selection Screen?

    We have added a custom field to an HR database and need for it to appear in the selection screen for logical database PNP. The program DBPNPSEL is this selection screen -- has anyone modified this or is there a better way to get this result?

    Hi,
    Check this link.It contains code sample.
    http://help.sap.com/saphelp_46c/helpdata/en/9f/db9c2e35c111d1829f0000e829fbfe/content.htm
    Regards,
    J.Jayanthi

  • How to modify Logical database Selection screen

    I am using PNP logical database , it is giving one selection screen ,
    after executioni can able to change the selection screen but i want to change default selection screen so that when i execute i want specific fields in selection.
    How to modify it?

    Hi,
    You need to use report category.In the attributes,click HR report category and select or create the selection screen you need.
    Check this link.
    http://www.sapdevelopment.co.uk/hr/hr_repcat.htm
    Kindly reward points by clicking the star on the left of reply,if it helps.

  • Logical Database selection screen pushbutton

    Hello All,
    I need to create a pushbutton on a selection screen of a logical database.  Basically this pushbutton when clicked will either display or suppress some fields on the screen.  I have tried to use the SSCRFIELDS option to create a pushbutton, however that never displays for me.  Logical Database DDF has an example of a pushbutton that I am looking to create, however the functionality will be different.  I am not sure what I am missing, can anyone help?  Thanks.
    John

    Hello All,
    Thanks for your replies. However, there is something that is causing these options not to work.  For some reason when using SSCRFIELDS nothing displays.  For the SELECTION-SCREEN PUSHBUTTON command, we see the push button however our code for some reason is not working.  I have another developer working this with me and we are both stumped.  We are mirroring that DDF Logical Database and are not having any luck so far.  Does anyone have any further suggestions?
    John

  • DB Adapter for Logical Delete - selecting multiple StatusesAND

    Hi,
    I am using SOA 11.1.1.3 and my requirement is to use a DB Adapter to poll both ERROR & NEW Records. Once Polled, I want the status to be changed to "PICKED" (Logical Delete)
    The DB Adapter only allows for a single Unread Value to be selected. I tried to edit the SQL to use a "OR" condition but the code always replaces it with an "AND":
    Polling SQL:
    SELECT QUEUE_ID, BATCH_ID, STATUS, DEL_ID, ORDER_NUMBER, HEADER_ID, LINE_ID, ORD_TYPE, OPERATION, ERR_MESG, CREATE_DT, INV_ORG_ID, PROCESS_DATE FROM DEV.DEV_Q WHERE ((STATUS = 'ERROR') AND (STATUS = 'NEW')) ORDER BY QUEUE_ID ASC
    After Read SQL:
    UPDATE DEV.DEV_Q SET STATUS = 'PICKED' WHERE (QUEUE_ID = #QUEUE_ID)
    I tried to edit the SQL in the <PartnerLink>-or-mappings.xml but it isn't working.
    I did read some posts http://blogs.oracle.com/soa_how_to/2009/11/a_db_adapter_sample_for_pure_sql_and_logicaldeletepollingstrategy_scenario.html that mention that sql edits can be made in DB Adapter only if a Delete is used.
    Question is - Where can I get the sequel generated (it is not there in the TOPLINK mapping) in order to edit it? Can someone please provide the steps?
    Thx a ton!
    Suhas.
    Edited by: user13616720 on Apr 28, 2011 3:42 AM

    Did you tried modifying SQL to
    WHERE STATUS in ('ERROR','NEW')or
    where regexp_like(status,'ERROR|NEW')Thanks
    AJ

  • DB Adapter for Logical Delete - selecting multiple Statuses

    Hi,
    I am using SOA 11.1.1.3 and I am using a DB Adapter to poll ERROR/NEW Records. Once Polled, I want the status to be changed to "PICKED" (Logical Delete)
    The DB Adapter only allows for a single Unread Value to be selected. I tried to edit the SQL to use a "OR" condition but the code always replaces it with an "ADD":
    Polling SQL:
    SELECT QUEUE_ID, BATCH_ID, STATUS, DEL_ID, ORDER_NUMBER, HEADER_ID, LINE_ID, ORD_TYPE, OPERATION, ERR_MESG, CREATE_DT, INV_ORG_ID, PROCESS_DATE FROM DEV.DEV_Q WHERE ((STATUS = 'ERROR') AND (STATUS = 'NEW')) ORDER BY QUEUE_ID ASC
    After Read SQL:
    UPDATE DEV.DEV_Q SET STATUS = 'PICKED' WHERE (QUEUE_ID = #QUEUE_ID)
    I tried to edit the SQL in the +<PartnerLink>-or-mappings.xml+ but it isn't working.
    I did read some posts http://blogs.oracle.com/soa_how_to/2009/11/a_db_adapter_sample_for_pure_sql_and_logicaldeletepollingstrategy_scenario.html that mention that sql edits can be made in DB Adapter only if a Delete is used.
    Question is - Where can I get the sequel generated (it is not there in the TOPLINK mapping) in order to edit it? Can someone please provide the steps?
    Thx a ton!
    Suhas.
    Edited by: user13616720 on Apr 28, 2011 3:37 AM

    Hi,
    wrong form. Use the SOA forum here: SOA Suite
    Frank

  • Logical Component Selection

    Hi Friends
    I have default Solman Ehp1 system , now i want add my satellite system (ECC EHp4 ) system into solman , Can any one give me suggestion in which Logical component i have add my satellite system
    Thanks In advance
    Kumar

    Hi,
    Go to smsy in solman and there select the groups and logical components and under SAP ECC or SAP ERP ..you can add your system...
    before that you need to create the entries in logical components...
    HTH
    Rajesh

  • Avoid repeating same logic in 'select' and 'where' clauses?

    I'll preface by saying I'm self-taught and have only been fiddling with SQL for a couple of months, so forgive me if this is a dumb question. I have a query written to pull out customers who are configured to have their products stored at the wrong warehouse, according to the first 3 digits of the zip code. Here is an extremely simplified version of a query I'm trying to run:
    select custno, custbuy_zip_cd, custbuy_prim_ship_loc_cd as Warehouse,
    case when substr(custbuy_zip_cd,1,3) in ('839','848') then '20'
    when substr(custbuy_zip_cd,1,3) in ('590','591') then '33'
    end as StdWhse
    from customers
    where case when substr(custbuy_zip_cd,1,3) in ('839','848') then '20'
    when substr(custbuy_zip_cd,1,3) in ('590','591') then '33'
    end <> custbuy_prim_ship_loc_cd
    or (case when substr(custbuy_zip_cd,1,3) in ('839','848') then '20'
    when substr(custbuy_zip_cd,1,3) in ('590','591') then '33'
    end is not null and custbuy_prim_ship_loc_cd is null)
    Now, the query works, but it seems overly convoluted and feels like there must be a way to make it simpler and faster. I'm using the same 'case when' 3 times. Originally, I had thought I could use the aliases from the 'select' clause in the 'where' clause, which would simplify things:
    select custno, custbuy_prim_ship_loc_cd as Warehouse,
    case when substr(custbuy_zip_cd,1,3) in ('839','848') then '20'
    when substr(custbuy_zip_cd,1,3) in ('590','591') then '33'
    end as StdWhse
    from customers
    where StdWhse <> custbuy_prim_ship_loc_cd
    or (StdWhse is not null and custbuy_prim_ship_loc_cd is null)
    I then found out that that caused 'invalid identifier' errors. My first attempt at a solution was to use a subquery in the 'from' clause, but that ran the 'case when' on every single customer instead of the small subset, so it wound up taking much longer even though it looked neater. Any tips on how to clean up that first query to make it run faster?
    this is Oracle 11i, I believe. As a side note, I don't have write access to the database.

    Thanks for all the tips so far - still going through them. You all respond fast! Sorry about using double angle brackets for != and not using code tags, I'll make sure to format my posts properly going forward. I think the double angle brackets messed up the appearance of my original queries a little. Here's how I probably should have pasted my first query in my first post:
    select custno, custbuy_zip_cd, custbuy_prim_ship_loc_cd as Warehouse,
        case when substr(custbuy_zip_cd,1,3) in ('839','848') then '20'
            when substr(custbuy_zip_cd,1,3) in ('590','591') then '33'
        end as StdWhse
    from customers
    where case when substr(custbuy_zip_cd,1,3) in ('839','848') then '20'
            when substr(custbuy_zip_cd,1,3) in ('590','591') then '33'
        end != custbuy_prim_ship_loc_cd
        or (case when substr(custbuy_zip_cd,1,3) in ('839','848') then '20'
            when substr(custbuy_zip_cd,1,3) in ('590','591') then '33'
        end is not null and custbuy_prim_ship_loc_cd is null)The almost unanimous opinion seems to be that I should use a subquery in one way or another, but the problem remains that the only significant logic to narrow down the results is the logic that matches the 'case when' results (which are what the warehouse number should be, based on the zip code) to the current warehouse number. Therefore, it seems like any subquery is going to return my entire list of 600k customers, and take a much longer time than my original (messy) query. At least it has in the test runs I created based on
    Satyaki's and Peter's examples. The query based on my original example takes about 2.5 minutes, and the subquery examples take about 5+ even though they look cleaner.
    to clarify what the query is trying to accomplish, I want it to pull any records where the warehouse number does not equal the correct warehouse number based on zip code (or if the warehouse number is null when it shouldn't be).
    I'll try to create some sample data and sample results. Customers table:
    custno   custbuy_zip_cd  custbuy_prim_ship_loc_cd
    1        59024           20
    2        59024           33desired results:
    custno   custbuy_zip_cd   warehouse   StdWhse
    1        59024            20          33If I could create a table to hold the standard warehouses to join on, the whole thing would be much easier. The full version of the query really has hundreds of zip code prefixes and 5 different warehouses and each account has 4 alternate warehouses as well. However, I'm stuck with read only access so everything has to go right in the query. It wouldn't be the end of the world to just stick with my original query since it's not like it takes hours, and I'll only be running it weekly. I just wanted to make sure there wasn't some other solution that wasn't just cleaner but was also faster.

Maybe you are looking for

  • SSRS- Hide Empty Rows

    Hi, I am having a difficult time deleting empty rows in a table. I used HideDuplicates under properties to hide any of the duplicated data but now it is leaving me an empty row in the table. I tried to use the following codes but none of them seemed

  • BI Admin Cockpit Queries - BI 7.0

    Hi All, I have a requirement to build a BW Statistics quesries on BI 7.0. We already activated the BW 7.0 Statistics. Now i am in the process of creating BW queries on BI 7.0 BI Stats multiproviders. My question is whaich business contenct Queries /

  • Samsung Galaxy Tab 4 Front Camara Auto Zoom Error

    So the title says it all, skype will auto zoom-in on my face. And the video (on the other side of the coversation) appears with a resolution like 200 x 600 px which looks like a vertical strip on the middle of the screen, this issue only happens when

  • Creative cloud adobe media encoder

    Chelsea vs Southampton Live StreamManchester United vs Tottenham Hotspur Live StreamSouthampton vs Chelsea Live StreamTottenham Hotspur vs Manchester United Live Stream

  • 1080P / 59.94

    Hello, I see very few presets fpr this frame size/rate. Id this not a popular encoding / delivery format? I see alot of  720p 59.94 but not many 1080p/59.94. Why is that?