Field Selection in Query

Hi Experts,
I created a query with a join on 2 tables( Table A and B). B may not have records all the time so I joined them with left outer join. Now I get all records from A based on selection criteria showing blank in fields from B if no entries are found in B.
Now I have entires from B that repeat in output. I want to stop multiple entries from B (Eg: value field). I have 2 entries in table B, with value 0 and value $$. <b>I want all entries from A with entries from B ( but only those entries from B that have value $$) AND blank entries but NOT entries with value=0.</b> I cannot select value field in <i>selection</i> and do an exclusion as this will exclude my blank entries from table B.
Is there a way to select entries from 1 table based on a field entry eg: Select only those fields with value $$ but NOT Value 00, while joining tables in Query.
Thanks
ABAP, Query, Joins, Field selection, Exclusion

you can do a where condition as below example..
SELECT
    SALESREP.EMPID,
    ORDERNO,
    CUSTID,
    ORDDATE,
    BILLED,
    PAID
FROM
    SJD.SALESREP SALESREP
    LEFT OUTER JOIN SJD.SALESORD SALESORD
    ON
    SALESREP.EMPID = SALESORD.EMPID
WHERE
    SALESORD.PAID NE 00.

Similar Messages

  • Additional text field in Infoset deleted but not reflected in field selection in Query

    Hi,
    I have deleted an additional text field in infoset. It was used in one query.
    Even in the query it is deleted, but when in field selection screen i am not able to delete.
    If i try to execute the query, I get dump (syntax error) saying in field type(additional field) doesnot exist.
    Can anyone pleassseee help me in this.

    Hi San,
    I am trying to understand. How could you separately delete an additional text field associated with a main field?
    Jogeswara Rao K

  • Field selection in query not appropriate

    hi all,
           i have written following code.
             SELECT EBELN BUKRS BSART AEDAT LIFNR ERNAM EKGRP FROM EKKO
                     INTO CORRESPONDING FIELDS OF TABLE IT_EKKO
                     WHERE BUKRS IN S_BUKRS
                     AND BSART IN S_BSART
                     AND AEDAT IN S_AEDAT
                     AND FRGKE EQ 'R'.
    *SELECT * FROM EKKO INTO CORRESPONDING FIELDS OF TABLE IT_EKKO.
    IF NOT IT_EKKO[] IS INITIAL.
    SELECT EBELN EBELP VGABE MENGE BWART FROM EKBE INTO
    CORRESPONDING FIELDS OF TABLE IT_EKBE
      FOR ALL ENTRIES IN IT_EKKO
      WHERE EBELN EQ IT_EKKO-EBELN
         VGABE EQ '1'.
    endif.
    now in the above query in it_ekbe table i am getting two line item for doc. no say 75100.
    but if i am putting the same doc no in ekbe table in se16 i am getting three line items for same selection as in above query
    where doc no = 75100
    and vgabe = 1.
    plz help.
    regards,
    Ashmita

    SELECT EBELN EBELP VGABE MENGE BWART FROM EKBE INTO
    CORRESPONDING FIELDS OF TABLE IT_EKBE
    FOR ALL ENTRIES IN IT_EKKO
    WHERE EBELN EQ IT_EKKO-EBELN
    VGABE EQ '1'.
    Press F1 on for all entries and read it , you will come to know

  • Addition of checkbox and 2 fields in ABap query selection screen

    Hi
    I need to add chack boxes and 2 fields in ABAP query which is using LDB QMI. can u pls let me know how to do that.

    Hi Tarun,
    I am still not clear with the problem..I guess you require plant in your selection screen which you have.
    i guess if you go to sq01tcode there is a option infoset query from where you can give your selection options and value.
    have you selected all the fields in infoset and made a selection screen?
    When you have done with your infoset you just need to diplay the fields and there is a automatic program generated.
    Let me know...
    Regards,
    Nihkil.

  • I need use conditions in the select fields of a query.

    Hello,
    Is possible, that I can have conditions in the select fields of a query? In a invoice when the type is cancellation I want to put *-1 to price and if is other type the price is normally.
    If VBRK.FKART = 'S1' THEN KWERT*-1 else KWERT .
    Thank you very much.

    you can do two things:
    1. select the data into internal table and loop through the internal table and do the necessary changes
    SELECT fkart kwert
    FROM vbrk
    INTO TABLE itab
    WHERE ...
    LOOP AT itab.
    IF itab-fkart EQ 'S1'.
    itab-kwert = itab-kwert * -1 .
    MODIFY itab.
    ENDIF.
    ENDLOOP.
    2. use select-endselect and change the data acc. to your needs inbetween and append the internal table.
    SELECT fkart kwert
    FROM vbrk
    INTO wa
    WHERE ...
    IF wa-fkart EQ 'S1'.
    wa-kwert = wa-kwert * -1 .
    ENDIF.
    APPEND wa TO itab.
    ENDSELECT.
    (The first approach is probably faster.)

  • SAP query field selection order and text

    Hello All,
       Is there any way I can change the position of fields on the selection screen of query. Also can I change the text of the selection fields. Thanks
    Atul

    In SQ01 enter your query name and go into change mode, on the menu click "Goto" , "Field Selection" then "Field Selection"
    in there change the text of selection field, to change to ordering just enter the number sequence in the "No" the order in which you want them to appear. Like
    Production Order 02
    Order Type       03
    Plant            01
    after you execute the query selection screen will appear like below
    Plant
    Production Order
    Order Type

  • Order of the selection fields in SAP QUERY

    Hello All,
    How can we set the order of the selection fields in SAP QUERY!
    Regards!
    Ashish

    Hi,
    You can go into infoset and change the order.
    Or you can select 1 by 1 in the same order, you want to display.
    Below is the link which might help you:
    help.sap.com/printdocu/core/Print46c/EN/data/.../BCSRVQUE.pdf
    Please revert, if needed more clarifications
    Regards,
    Yashwin

  • RSDMWB - Create Model  - BW Query Model Field Selection - Problem

    I am trying to create a Data Mining model.
    In RSDMWB I select "Create Model" in the right click context menu after selecting a Data Mining model.
    In the "Create Model" window I try to select a BW Query I have previously created as source for Model Field Selection.
    To find the query I press F4 and get a list of available objects sorted by InfoAreas. However, the InfoArea containing my InfoProviders and the BW Queries is not visible.
    If I try selecting a BW Query that is visible this BW query does not appear in the BW Query field in the Create Model window.
    However as I press 'enter' I get a field selection list!
    Last but not least, I cannot type manually a BW Query name in the abovementioned BW Query field.
    I am not sure it is related, but I found a note about some UI problem at model creation
    "Data Mining: UI adjustment SAP Note Number: 851886". It says that BW35 SP14 should be needed. I am currently on SP12.
    Does anyone have the same problem. What is the solution to it?
    Claudio Ciardelli
    SAP BI Consultant at Unisys.

    Hi,
    - do you see the variables from the BW query in Crystal Reports ?
    - where in the BW query are the variables defined ?
    Ingo

  • Creation of local field in ABAP Query

    Hi
    Please let me know how to create a local field in ABAP query. I am finding the option inactive in SQ01.
    Regards
    Priyadarshini

    hi priya,
         *__Adding u201CLocal Fieldu201D (user defined field) in SAP Query_ :
    There is also facility to add the user defined fields in SAP query output. Also we can provide calculation formula for calculating values for this user defined field.
    Calculation formula consists of standard fields from standard SAP tables. So the values fetched for particular standard SAP fields from standard SAP tables get calculated as per the calculation formula defined for the user defined field and displays the value accordingly.
    To do this first go to change mode for Query which automatically takes you to screen shown below and click on icon   , as below :
    Then further screen will appears. So select the Field group and again click on the same icon button   .
    Then switch on the Short names for the fields and give the short names to fields which we need to use in Calculation formula.
    Give the short names and then created u201CLocal Fieldu201D, as shown in below screen shot. Also Short names are given to fields, which can be used further for calculation.
    Defining Local Field u201CREM_QTYu201D along with its field type and Calculation formula.
      In this case we have 
      defined field type for new  
      field as similar to
      ORD_QTY and
      Calculation formula is  
      defined.
    Also its possible to have Conditional logic for Local field by putting Condition in u201CConditionu201D line.
    Now activate this newly added Local field for coming it in output screen. To do the same again go to u201CBasic Listu201D and activate the Local Field as shown below :
    i think this will help u
    regards,
    sindhu.

  • Alignment and restriction of Custom field in SAP query report

    Hi Experts,
    I have one custom field in query report(SQ01) called Amount in local currency which is calculated based on Amount in document currecy * exchange rate.
    But this field values are coming in left alignment instead of right alignment so how i should get in right alignment and second issue is how i can restrict field value to only 2 decimals.
    I tried the below link "http://media.techtarget.com/searchSAP/downloads/SAP_Query_C7.pdf" but the steps they mentioned are not appearing in SQ01 for example in that link they mentioned to click Basic List option for advanced steps but when i click i goes directly to field list with field groups on left pane
    Please provide solution for this.
    Thanks&Regards,
    narasimha

    Hello narasimha,
    In the Infoset when you create the additional field, enter an existing SAP table field that has type CURR in the parameter labeled LIKE Reference.  For example you can enter BSAK-DMBTR as a value. When you select the additional field in the query, the currency will also show.
    Kind Regards,
    Rae Ellen Woytowiez
    Edited by: Rae Ellen Woytowiez on Apr 25, 2011 11:27 PM

  • Select List (query based LOV) in a wizard created report form

    I have created an updatable report form with 3 columns:
    app_id
    user_id
    group_id
    Each app_id has multiple group_id's associated with it, and I want to show the group_id field as a Select List (query based LOV) that contains the groups associated with the app_id.
    My query for the select list needs to be similar to the following:
    SELECT DISPLAY_NAME, GROUP_ID
    FROM APPLICATION_GROUPS
    WHERE APP_ID = ?????
    ORDER BY 1
    The problem is, I don't know how to reference the app_id from the main report to replace the ?????.
    In other words, if my report returns 2 rows of data like this:
    app_id----------user_id----------group_id
    1-----------------24------------------3
    2-----------------24------------------15
    Then how do I get the group_id column to be a select list of possible groups for each application? If app_id 1 has 3 groups associated with it, 3, 4, & 5 and app_id 2 has 2 groups associated with it, 15 & 16, then those each of the select lists should be based on the app_id.
    Hopefully I explained this clearly.
    Thanks,
    Kris

    Leo,
    Thanks for the response, but I don't think you quite understand my problem. If I go to the Column Attributes screen for the group_id field, I have the "Display As" drop down set to "Select List (query based LOV)", not "Select List (named LOV)". This requires that the sql query be written in the "List of values definition" text area below. Within that text area I have the following query:
    SELECT DISPLAY_NAME, GROUP_ID
    FROM APPLICATION_GROUPS
    WHERE APP_ID = ?????
    ORDER BY 1
    The APP_ID that I need to reference is for the current row of data that is being processed. Therefore, I can't use a :PNNN_APP_ID variable, because that field does not exist on the page.
    Hopefully this explains it a little better.
    Thanks,
    Kris

  • Calculated field in a query

    Hi,
    To begin with I am just learning EJB and JAVA so please bear with me. I want to create a calculated field in a query from two fields in the table being queried, using SQL I would write the query like this:
    SELECT ledgerdate, description, quantity, unitprice, [quantity*unitprice] FROM ledger
    I have created a class called ViewLedger to contain my results, it has the following elements:
    DATE ledgerdate,
    STRING description,
    INTEGER quantity,
    BIGDECIMAL unitprice,
    BIGDECIMAL amount
    The query that I have been attempting that fails is:
    SELECT NEW ViewLedger(l.ledgerdate, l.description, l.quantity, l.unitprice, l.quantity*l.unitprice) FROM Ledger l
    The error says that there is an unexpected * in the query
    The following do not work either:
    SELECT NEW ViewLedger(l.ledgerdate, l.description, l.quantity, l.unitprice, (l.quantity*l.unitprice)) FROM Ledger l
    The error says there is an unexpected ( in the query.
    SELECT NEW ViewLedger(l.ledgerdate, l.description, l.quantity, l.unitprice, [l.quantity*l.unitprice]) FROM Ledger l
    The error says there is an unexpected [ in the query.
    Any help would be greatly appreciated.
    Thanks.

    I don't think JPQL allows functions (*) in the SELECT clause.
    You can use a native SQL query as a workaround. If you are using EclipseLink or TopLink Essentials, you can also use a ReportQuery.
    You may also want to vote for the bug,
    [https://bugs.eclipse.org/bugs/show_bug.cgi?id=219814|https://bugs.eclipse.org/bugs/show_bug.cgi?id=219814]
    James : [http://www.eclipselink.org|http://www.eclipselink.org]

  • Populating Additional Field in InfoSet Query

    Hello,
    My team and I are working on generating a relatively simple report from the VBAK (Sales Header), VBAP (Sales Items) and VEDA (Date data) tables.  We would prefer to be able to build an InfoSet (SQ02) and Query (SQ01) instead of writing a custom report.
    The problem is the VEDA table contains data that may link to the VBAK and sometimes the VBAP table.  The usage is that the header has begin and end dates for a contract, which is denoted by a blank value in POSNR field in the VEDA table.  If a particular line on a contract has different dates than the header, there will be an additional record in the VEDA table where the POSNR value matches the POSNR value from the VBAP (Item) record.
    The link to the VBAP table is straight forward being keyed off of the VBELN (doc number) and the POSNR (item number) fields in both tables.  However, there's isn't a POSNR field in the VBAK (header) table and the VEDA table shows this as a blank value in the POSNR field.
    The simplest thing I can think of doing is link the VEDA table to the VBAP and let it retrieve all the exact matches on Sales Doc & Item Number but add two "Additional Fields" to the Query that would represent the Sales Header begin and end dates.
    I know how to add an additional field but how would you "re-query" the VEDA table and under which option under the Code tab.
    Thanks

    Hi Alex
    Please see if below example helps you to understand:
    Supposing, we are displaying material description within our query.
    1. So we define the join with MARA & MAKT while creating infoset in transaction SQ02.
    2. We create feild groups to identify the fiels we use for selection and display.
    3. Here after selecting language key from MAKT, by default this will take SY-LANGU always for the case.
    4. To make it applicable for different languages we can code in INITIALIZATION Event.
    5. To do so we can do it by two options: Use menupath: Goto->Code->Initialization
    i) First option using variable: <b>MAKT-SPRAS = SY-LANGU.</b>.
    ii) Second option using Parameter-Id: <b>SET PARAMETER ID 'SPR' FIELD SY-LANGU</b>.
    6. Save & Generate.
    Now when we execute the query, we are defaulting the language as System Language.
    Hope the above info helps you for better understanding.
    Kind Regards
    Eswar

  • Multiple Value in additional fields using SAP Query

    HI All,
    I have a question related additional field in SAP Query. I tried to create report about PR and PO using SAP Query. Since one PR can be converted to multiple PO, I decided to create additional field
    po_1
    to display the value of PO that related to the PR. But I meet problem when I want to show several PO number in additional field
    po_1
    , I couldn't look the way to solve this problem. Can anybody help me? Just for info, I assign value to additional field
    po_1
    in record processing part.
    Thanks....

    HI,
    IN SQ02, IF table is already in JOIN, just click on the PLUS sign to expand the strcture.
    All the field showing Plus sign in the strcture are selected in your query and with MINUS sing are no selected.
    So you have to just click on the MINUS sign for the field you want to use through table field.
    Generate the query and execute thriugh SQ01.
    If you want to add some other field which is not a part of JOIN,
    then click on EXTRAS Button shown in the MENU option.
    Click on Create button and system will ask abt the additional field.
    Regds,
    Anil

  • How to make fields in field group as text fields in ABAP query

    Hi friends,
    I a have a ABAP query 85 corresponding to infoset A205,
    there is a field group in the infoset A205 and it contains some fields
    but some of the fields are made as text fields ................i want to know how to make these fields in
    the field group as text fields.
    there is a small icon  " T " on the field when it is made as a text field .
    Please help me
    Thanks & Regards

    Hi,
    IF you can specify which Field Catalog then it will be useful for us to provide appropriate answer.
    1. For Customer Master
    IMG> Financial Accounting New> Acs Recev and Acs Payable --> Customer Accounts --> Master Data --> Preperation of creating customer master Data --> Define Account Groups with screen layout (customers)
    In that you can create your own account group, and click Details Screen.
    There will Field Status header within that are listed three main areas
    General data
    Company code data
    Sales data
    When you double click these lines it will take you into "Status Group" Overview. Wherein under "Select Group" are listed fields Address, communiucation.... Double click on one group , you will bet aken into the group field wherein you will find 4 colums with indicators assigned to it. ( Suppress, Req. Entry, Opt Entry, Display) you can choose the required option. "Req. Entry" against the field. Click save after you complete your selections.
    2. Similarly you can do for Material Master in
    IMG --> Logistics General --> Material Master --> Field Selection --> Maintain Field Selection for Data Screens
    But be careful when you do it for material master as it is cuts across all the modules...
    Regards
    Sathya

Maybe you are looking for

  • How to update Elements value inside existing xml file

    Hi Gurus, Am somehow new to java and working on xml with java, i have a scenario where i want to update the elements of my existing xml file, i know its possible as i have posted one code on this forum which updates the values of the arrtibutes of ex

  • N97 Mini - How do I delete all my message history ...

    On my old 6300 phone I could select messages and clear all the messages in All Folders in one step. With the N97 - I have to go into the Inbox - delete each message individually, then into the Sent box and delete all individually and then into Drafts

  • I can't get my ipod to synch with my conmuter or itunes.  But my kids are able to synch their ipods.

    I can't get my ipod to synch with my computer or itunes.  I've checked the USB ports, my ipod is charged and my kids are able to get their ipods to synch.

  • Subdivision of library

    Hello, I am new in this and as I have a lot of books in the PDF format, I was wondering if there is any way to subdivide and categorize different categories of books in the library to find them easier? Thank you for your help.

  • Generate and rasterize Flex3 Charts on J2EE server

    Hi, I'm fairly new to Flex. I have an application I'm working on that has need to schedule chart creation on the server-side and send them out via email attachments. The application also needs to have full featured charts that the user accesses via a