SAP Query Creation

Hi All,
I am creating a SAP query in the system using the tables KONP,MBEW & A018 i could join tables KONP & MBEW but i am not able to add the table A018 and a error message is displayed
Error Message:
Table A018 cannot be used in a join
Message no. AQ501
Diagnosis
1. You cannot read the selected table with SELECT statements (because, for example, it is a structure without a database table). Therefore, this table cannot be read within a table join either.
2. The chosen table is a pool or cluster table. These tables may not be used in a table join.
Can anyone tell me a alternative to join this table to MBEW & KONP.
I want this Join Conditions:
MBEW-MATNR = A018-MATNR
A018-KAPPL = KONP-KAPPL     
A018-KSCHL = KONP-KSCHL     
A018-KNUMH = KONP-KNUMH
Thanks & Regards
Andrew
Edited by: Andrew J on Dec 18, 2008 2:49 PM

hi,
use  FOR ALL ENTRIES
EXAMPLE:
Exporting all flight data for a specified departure city. The relevant airlines and flight numbers are first put in an internal table entry_tab, which is evaluated in the WHERE condition of the subsquent SELECT statement.
PARAMETERS p_city TYPE spfli-cityfrom.
TYPES: BEGIN OF entry_tab_type,
         carrid TYPE spfli-carrid,
         connid TYPE spfli-connid,
       END OF entry_tab_type.
DATA: entry_tab   TYPE TABLE OF entry_tab_type,
      sflight_tab TYPE SORTED TABLE OF sflight
                       WITH UNIQUE KEY carrid connid fldate.
SELECT carrid connid
       FROM spfli
       INTO CORRESPONDING FIELDS OF TABLE entry_tab
       WHERE cityfrom = p_city.
SELECT carrid connid fldate
       FROM sflight
       INTO CORRESPONDING FIELDS OF TABLE sflight_tab
       FOR ALL ENTRIES IN entry_tab
       WHERE carrid = entry_tab-carrid AND
             connid = entry_tab-connid.
REGARDS
RAHUL

Similar Messages

  • Could anyone provide the complete manual of SAP Query Creation

    Hi,
    Now I am learning to create SAP Query.
    I viewed many questions and answers about SAP Query.
    Some mentioned this,and some did that...
    Could anyone provide a complete manual of SAP Query Creation for developers.
    I can create SAP Queries step by step with it.

    http://help.sap.com/saphelp_46c/helpdata/en/35/26b413afab52b9e10000009b38f974/content.htm
    http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_Introduction.asp
    Step-by-step guide for creating ABAP query
    http://www.sappoint.com/abap/ab4query.pdf
    ABAP query is mostly used by functional consultants.
    SAP Query
    Purpose
    The SAP Query application is used to create lists not already contained in the SAP standard system. It has been designed for users with little or no knowledge of the SAP programming language ABAP. SAP Query offers users a broad range of ways to define reporting programs and create different types of reports such as basic lists, statistics, and ranked lists.
    Features
    SAP Query's range of functions corresponds to the classical reporting functions available in the system. Requirements in this area such as list, statistic, or ranked list creation can be met using queries.
    All the data required by users for their lists can be selected from any SAP table created by the customer.
    To define a report, you first have to enter individual texts, such as titles, and select the fields and options which determine the report layout. Then you can edit list display in WYSIWYG mode whenever you want using drag and drop and the other toolbox functions available.
    ABAP Query, as far as I Believe, is the use of select statements in the ABAP Programming. This needs a knowledge of Open SQL commands like Select,UPdtae, Modify etc. This has to be done only by someone who has a little bit of ABAP experience.
    To sum up, SAP queries are readymade programs given by SAP, which the user can use making slight modification like the slection texts, the tables from which the data is to be retrieved and the format in which the data is to be displayed.ABAP queries become imperative when there is no such SAP query existing and also when there is a lot of customizing involved to use a SAP Query directly
    use either SQ02 ans SQ01
    or SQVI tr code
    for more information please go thru this url:
    http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_Create_The_Query.asp
    http://goldenink.com/abap/sap_query.html
    Please check this PDF document (starting page 352) perhaps it will help u.
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVQUE/BCSRVQUE.pdf
    check the below link will be helpful for u
    Tutorial on SQVI
    once you create query system generates a report starting with AQZZ/SAPQUERY/ABAGENCY2======= assing this report to tr code for the same
    useful
    http://www.erpgenie.com/abap/code/abap47.htm
    regards,
    Prabhu
    reward if it is helpful

  • SAP Query Creation - Where to do? Dev or Prd

    HI,
    We have a two system landscape as DEV and PRD.
    We want some query to be generated in PRD. So whether we have to create in DEV and then transport the report to PRD or Can i directly create query in PRD and then assign one transaction code for that?
    Is there any drawback in creating Queries in PRD directly?
    Please give a idea about queries.
    Regards,
    Lijo Joseph
    Message was edited by: Linda Bortolus (just to mark the post as a question)

    Hi Lijo,
    That is precisely what I had in mind when I said that <i>"....the SAP Query, in general, is only used to SELECT the data..."</i> !!
    Though the purpose of the coding section is only to enhance / customize the display, there's nothing to prevent a DELETE / MODIFY statement in there.
    If you think that there is a chance that someone might access the query in the production system in change mode, then you have a major risk. But I think it is not a problem to prevent access to SQ02 in the production system. But then, the developer who writes the query (I guess that's you in this case ) should also exercise extreme caution in handling this part. NEVER use any DML statements here (DELETE / MODIFY / UPDATE).
    Hope this information has been useful.
    Regards,
    Anand Mandalika.

  • SAP Query creation procedure

    Hi,
    Can any one send me complete procedure for creation of query in SQ03. Please give me step by step procedure
    Thanks,
    Regards,
    Mukul

    hi,
    in sq02 define the infoset. here u define the tables and the join relation between them. generate the infoset. in sq03 create user grps (if not already existing) and then assign the infosets to them. assign user ids to the the user grps.   in sq01 create the query in the infoset and define the list and selection fields. make sure u check the query area in which the infodset and the query is created (global or client sprcific).
    saurabh

  • Issue in transaction code creation for sap query report .

    Hi  Gurus,
    I have a requirement to create transaction codes for sap query reports. I found two ways to create transaction code for sap query report
    1) By Generating program for sap query report and creation of transaction code for that generated Program. in tcode.
    2) By using parameter transaction options in start object of se93
    What are the difference between creation of these two ways. Please specify  the advantages and disadvantages of both methods.
    Regards,
    Suneel Kumar Uggina.

    Hi Jogeswara Rao,
    But I am getting problem while transporting form development system to  the production system. After transporting to Production system  I have used the code created in development system, but it is giving Error ' No Program Found for that Transaction Code. And  I would like to know  on what conditions should I have to  use the First one  and as well as a second one in sap query reports.
    Thank You,
    Suneel Kumar Uggina.

  • Creation of SAP Query in SQ02 with Single Table With Condition

    Hi All,
    I want to Create SAP Query in SQ02 using single Table MCHA.
    ii) I dont want all entries of MCHA Table I mean , I have to apply some Condition on this Table.
    i.e  Suppose I am having actual data in MCHA table is like this for Material M1.
    Plant    Material   Batch   BatchCreationdate
    P1          M1         B1       20.06.2007
    P2          M1         B1       04.05.2009
    P3          M1         B1       04.05.2009
    But I want the Output of SAP Query is like this:
       Material   Batch   BatchCreationdate
          M1         B1       20.06.2007
    That is irrespective of Plant if Material & Batch are equal ---> 1st record with Lowest date shoud get at the output.
    Please help me How write the code on single table in the SAP Query.
    Thanks,
    Kiran Manyam

    Hi,
    Your query should be like this:
    Select MATNR CHARG HSDAT
    from MCHA
    into table t_mcha
    where matnr = Materlal number from selection screen.
    The structure of t_mcha should contain the fields that you select.
    Then sort the table by date ascending
    Sort t_mcha by HSDAT.
    Hope this solves your problem.
    Thanks,
    Sowmya

  • Question on creation of t-code for SAP query

    Hello,
    I posted a thread in here back on 06/20/2007 asking for help on creating a t-code for a SAP query. one of the responses that I recieved was
    <i>"Sure, all you need to do is get the report name which is generated by the query. You can find this in SQ01, select the query and from the menu, Query, More Functions, Display Report name. Then go to Se93 and create the tcode with this report name."</i>
    the report name was AQFKZFINANCE====GL_FRANCE=====.
    I created the t-code using this name. I had it transported to my QAS system an now we are getting a error stating that the the program is not found.
    When I check in SE38, I can see this program AQA0ZFINANCE====BP_RECON====== in both my development system and my QAS system.
    Should I have created in the t-code using the AQA0ZFINANCE====BP_RECON====== instead of the AQFKZFINANCE====GL_FRANCE===== program? 
    Is there any reason why the program AQFKZFINANCE====GL_FRANCE===== would not be in QAS?
    I do not have access to SQ01 in our QAS system so I cannot perfrom the process stated above.
    thanks in advance for the help.

    Hi,
    Please check this thread perhaps it may help.
    Re: How to create TCode for Sapquery
    Regards,
    Ferry Lianto

  • Assigning a SAP Query to Transport Request

    Hi Friends
    I have a SAP Query, now I want it to transport to the other system, while saving the query it is not prompting for transport request. Is there any possibility to assign that SAP Query to a transport request, if yes, please let me know the process.
    Regards
    Praveen

    Dear All,
    This regarding creation of SAP Query .
    Situation:
    Infosets and User Groups were created in a DEV SERVER CLIENT 200 and saved in a request ie.REQ01
    Now i wanted to create a Query QU01 in the Same User Group  in DEV SERVER CLIENT 210  so i tried creating a Infoset but i get this error message
    Note: I am not able to create & save an Infoset.
    Message no. TK414
    Diagnosis
    You cannot edit request D01K901880 of user X00012, since this request is reserved for changes in client 200. You are logged on to client 210.
    Can anyone clear this error? what is the solution?
    Thanking You
    Andrew

  • SAP Query statements

    Hi guys
    Can any one give me some notes on SAP-Query STATEMENTS.
    I know T.CODES and creation of Info sets, groups etc.
    but  I am finding difficult when i wanted to Join the tables.
    Thanks in Advance.
    Rgds
    BJ

    Hi
    By using T-Code SQVI
    Give query name in QUICK VIEW
    Select the button “Create”
    Select “Table Join” in the field Data source
    Thanks& Regards,
    Subbu.

  • SAP Query-for  Reporting   how to create and use it

    Hi SAP Gurus,
    i need your help. in my project, client is asking to create queries to generate reports, i am not familiar with queries, so would appreciate it if any one can guide me and tell me the procedure for writing and creating queries soon.
    also if you have any study material on steps on How to write and create queries for PP module
    thank you very much

    Hi
    Please refer below document
    http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_Introduction.asp
    Also refer below
    How to Create Infoset Query (SAP Query)
    Steps on how to proceed to create a Query:
    ADHOC QUERY
    A query can be created to extract information from master records  i.e  Infotypes.  For example, by creating a query , the data relating to an employee contained in various Infotypes can be extracted.
    Proceedure :  
    Decide on  the various Infotypes we  want to make the query.  Decide on the area where we  want to query  i.e  Global area or Standard area.  Standard area is client specific and globel area will include all clients.
    Menu : HR – PM – Admn -  Information System -  Adhoc Query
    Select area standard and select the  user group already created
    Creation of new query  :  
    TC SQ03  -  Select Environment – Select Standard Area -  Enter  --  If new user group is to be created, enter name of the user group, click on create and enter necessary information and  exit after saving
    TC SQ02  -  Enter name of the Infoset – Create – enter name of Infoset -  Data source -- >  Table join by basis table – give name of table e.g  pa0000 -  Enter -  Click on insert table if we  want to include more tables – give name of table one by one and after finishing,  place cursor on the joining lines and right click to delete unwanted relationships  - check  - and go back  - field groups  -  include all table fields  - click on generate button   -  go out
    TC SQ03  -  Select user group  -   eg.  Payroll
    Infoset  - Enter name of newly created Infoset 
    Assign users and Infosets  -  Assign infosets  -  put tick on payroll  - save and go back
    TC  PAAH  -  Expand the nodes and put tick on relevant fields depending upon necessity
    Save the query  by giving the same name as infoset for easyness..
    For executing a query which is already created
    1. Go to SQ01 transaction
    2. Go to Environment menu->query areas->std areas
    3. Then choose the user group where the query is created
    4. It will display all the queries created for the group.choose the query you want to executeand click execute.
    5. will take to the initial screen
    6. Enter the required parameters and execute
    Regards
    Ranga
    Message was edited by:
            Ranganathan Srinivasamurthy

  • Sap query & reporting

    Hi,
    Any book that can be suggested for report writer/report painter & query reporting.. that contains almost all for reporting without programming..
    Thanks in advance...
    Vipin Arora..

    Hello Vipin,
    Sap Query
    The SAP Query application is used to create reports not already contained in the default.
    The SAP Query comprises five components: Queries, InfoSet Query, InfoSets, User Groups and Translation/Query.
    Please refer:
    http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_Introduction.asp
    A query can be created to extract information from master records i.e Infotypes.
    <u>Creation of new query:</u>
    1. T.Code SQ03 - Select Environment – Select Standard Area - Enter -- If new user group is to be created, enter name of the user group, click on create and enter necessary information and exit after saving
    2. T.Code SQ02 - Enter name of the Infoset – Create – enter name of Infoset
    3. T.Code SQ03 - Select user group
    Infoset - Enter name of newly created Infoset
    Assign users and Infosets - Assign infosets
    After creating a query use SQ01 & run.
    <u></u>

  • Problem in transporting generated program of SAP Query

    <h5> Hi all,
    I created a SAP query in development server and generated the program for the same, I transported the infoset and the user group etc. to the next server but couldnot transfer the program, since the program is not a Z Program, so coudlnot save it and capture it in request so that the same can be transported.
    What could be the possible solution for the same????
    Regards, </h5>

    Yep, this gets a bit tricky. Remember that SAP Query is designed as an end-user tool. To this end, the creation of queries could be done in a productive environment. The maintenance of infosets could be restricted to Development systems only. I know that some sites do not allow this.
    Through the use of authorisations, you could appoint an administrator to generate the queries in PRD for the users.
    The name of the ABAP is a combination of the query name, infoset and the client number (I think - going from memory). You could possibly change the package name of the generated program and then attach it to a transport, but it becomes very messy and I wouldn't recommend it.

  • Reg. SAP Query

    Hi
    I have written an SAP Query for Selection Criteria.
    Example Scenario:
    I want to download list of sales orders in my BAPI.
    The download criteria is maintained as a SAP Query, like, Order Type, Creation Date, Plant etc.
    Can i invoke this query in my report program to fetch the values the user has maintained in the Query Variant?
    Regards
    Meera

    Hi
    I have written an SAP Query for Selection Criteria.
    Example Scenario:
    I want to download list of sales orders in my BAPI.
    The download criteria is maintained as a SAP Query, like, Order Type, Creation Date, Plant etc.
    Can i invoke this query in my report program to fetch the values the user has maintained in the Query Variant?
    Regards
    Meera

  • Executable Report VS Sap Query

    Hi  Experts,
    Let me know the Difference between Executable report and SAP Query.
    Thanks in Advance,
    Victor

    SAP Query is a tool supplied by SAP for report creation.
    Reports are programs that fetch data from database tables and display data.
    Search SDN to know more.
    Hope this helps you.

  • Sap query iview error

    Hi there!
    I have a sap query iview in the portal that should display a query in CRM (build with SQ01). The query in the backend is fine, but I get this error message in the portal.
    "Error in Source. Message not available"
    I have double-checked that the connection parameters of the sap query iview are OK, also I have run a DQE connection test on the system that was(see below) also OK.
    Any thoughts on this?
    Thanks in advance
    -fab
    p.s. I reward points generously
    Test Connection through the DQE
      Test Details:
    The test consists of the following steps:
    1. Checks the existence of a backend admin user ID/password in the system properties.
    2. Checks the existence of a default alias for the system.
    3. Checks the DQE connection.
      Results
    1. Backend admin user ID and password exist in the system properties.
    2. Default alias of the system exists.
    3. DQE connection successful. If you continue to experience problems, verify the DQE admin user ID and password properties for this system object.

    Thanks for the help Michael. Here is the xml file, I have also sent it to your email address.
    Cheers,
    faB
    - <GenericCreator author="XML Creator" version="XML Automatic Creation" mode="clean,execute" report.level="success" createMode="1" default.locale="en" ignore="false">
      <Property name="parent1" value="pcd:portal_content/XXX/XXXXXX/IVIEWS" />
    - <Context name="qtf" objectClass="com.sapportals.portal.iview" create_as="0" template="par:/applications/com.sap.pct.srv.portaldataviewer/components/SAPQueryTemplate" parent="$">
    - <Attributes>
    - <Attribute name="com.sap.portal.private.iview.PropertiesUrl" type="string">
      <AttributeValue value="pcd:com.sap.portal.system/applications/com.sap.pct.srv.portaldataviewer/components/SAPQueryTemplate" />
      </Attribute>
    - <Attribute name="PDVParameterQUERY_WORKSPACE" type="string">
      <AttributeValue value="G" />
      </Attribute>
    - <Attribute name="PDVParameterQUERY_VARIANT" type="string">
      <AttributeValue value="TEST" />
    - <Attribute name="personalization" type="string">
      <AttributeValue value="NO_DIALOG" />
      </Attribute>
      </Attribute>
    - <Attribute name="PDVParameterQUERY_NAME" type="string">
      <AttributeValue value="ZQ_ECCSPO_01" />
      </Attribute>
    - <Attribute name="PDVParameterQUERY_USERGROUP" type="string">
      <AttributeValue value="ECCSPO" />
      </Attribute>
    - <Attribute name="PDVParameterQUERY_CREATE_SELTAB_FM" type="string">
      <AttributeValue value="" />
    - <Attribute name="personalization" type="string">
      <AttributeValue value="NO_DIALOG" />
      </Attribute>
      </Attribute>
    - <Attribute name="com.sap.portal.iview.MainObject" type="string">
      <AttributeValue value="" />
      </Attribute>
    - <Attribute name="SystemIdentifier" type="string">
      <AttributeValue value="SAP_CRM" />
      </Attribute>
      </Attributes>
      </Context>
      </GenericCreator>

Maybe you are looking for