Need to include Structures in SAP Query

Hi,
I need to extract data of material master from a 3.1 System, where there is a Structure which contains my required information.
How can i include the fields of the Strucutre into my query?
thanks,
Chintan

Hi,
As Christopher mentioned, structures do not contain saved information. You must read the tables for getting the information.
I assume that you´re working with SAP Query (SQ00). If this is so, you need to create or modify an InfoSet (Environment --> Infosets), where you´re gonna declare the necessary table or view.
When that part is done, go back to your query and assign the infoset, so that you can use the fields that you need.

Similar Messages

  • Use data in structure in SAP Query

    I am creating a SAP query using a logical database but will like to include data from a Structure can anyone help me.

    Do not worry about this topic, I have obtained the result by myself, it can be done with global variables. The error was in the initialization of some of the variables involved.
    Thank you any way and forgive me for the disturbance.
    Sinceresly,
    Miguel.

  • SAP Query Documentation - Defining additional fields

    Hi,
    I need to create a new SAP Query defining a new Functional Area. My problem is that I have created the area and defined the tables I want to use and how to join them, but I want to add additional fields with ABAP coding. I have looked up for documentation on how to do it, and all I find is that I shoud access the menu GOTO/Additional Field, but in my screen I find no such option (I'm using 46B).
    Could anyone explain how to add additional fields and coding, or send me any documentation please??
    Also, is it possible that I can create functional areas and queries, but not edit ABAP coding from functional areas in my productive system? Do I have to create the query in my test system and transport it, or how does that work? I's my first time creating queries.
    Thanks so much in advance!

    Try
    http://www.sappoint.com/abap/ab4query.pdf
    http://www.sap-img.com/basis/transport-of-abap-query.htm
    Pl. award the points if it helps you ...
    Thanks
    Message was edited by: Saquib Khan

  • SAP Query - how to retrieve data within another program / FM

    Hi,
    I need to retrieve data from SAP Query, but when I used SUBMIT ..., the program results dump, because it is called within open custor loop.
    Is there any another way, some FM or sth else?
    thanks
    Juraj

    I already tried it, but I always get dump with CX_SY_OPEN_SQL_DB exception.
    The problem is, that I tried to execute the query within open custor loop and this exception is caused by calling commit work somewhere in query report.
    therefore I try to find another way
    thanks
    Juraj

  • Help needed on creating a SAP query

    Hi All,
    Can somebody give me the step by step procedures of creating a SAP query and Infoset.
    My requirement is to display asset master details with Asset number or Asset class as input.
    Any pointers or links to create an infoset and query will br highly helpful.
    Thanks,
    Arun

    Here are couple of fields you might be needed :
    AGKO     Cleared Accounts
    ANAR     Asset Types
    ANAT     Asset type text
    ANEK     Document Header Asset Posting
    ANEP     Asset Line Items
    ANEV     Asset downpymt settlement
    ANKT     Asset classes- Description
    ANLA     Asset Master Record Segment
    ANLB     Depreciation terms
    ANLC     Asset Value Fields
    ANLH     Main asset number
    AT02T     Transaction Activity Category- Description
    AT02A     Transaction Code for Menu TIMN
    AT10     Transaction type
    AT10T     Name of Transaction Type
    BKDF     Document Header Supplement for Recurring Entry
    BKORM     Accounting Correspondence Requests
    BKPF     Accounting Document Header
    BLPK     Document log header
    BLPP     Document log item
    BLPR     Document Log Index and Planned Order (Backflush)
    BNKA     Bank master record
    BP000     Business Partner Master (General Data)
    BPBK     Doc.Header Controlling Obj.
    BPEG     Line Item Total Values Controlling Obj.
    BPEJ     Line Item Annual Values Controlling Obj.
    BPEP     Line Item Period Values Controlling Obj.
    BPGE     Totals Record for Total Value Controlling obj.
    BPJA     Totals Record for Annual Total Controlling Obj.
    BSAD     Accounting- Secondary Index for Customers (Cleared Items)
    BSAK     Accounting- Secondary Index for Vendors (Cleared Items)
    BSAS     Accounting- Secondary Index for G/L Accounts (Cleared Items)
    BSEC     One-Time Account Data Document Segment
    BSEG     Accounting Document Segment
    BSID     Accounting- Secondary Index for Customers
    BSIK     Accounting- Secondary Index for Vendors
    BSIM     Secondary Index, Documents for Material
    BSIS     Accounting- Secondary Index for G/L Accounts
    CEPC     Profit Center Master Data Table
    CEPCT     Texts for Profit Center Master Data
    COBRA     Settlement Rule for Order Settlement
    COBRB     Distribution Rules Settlement Rule Order Settlement
    COKA     CO Object- Control Data for Cost Elements
    COSP     CO Object- Cost Totals for External Postings
    COSS     CO Object- Cost Totals for Internal Postings
    CRCO     Assignment of Work Center to Cost Center
    CSKA     Cost Elements (Data Dependent on Chart of Accounts)
    CSKB     Cost Elements (Data Dependent on Controlling Area)
    CSLA     Activity master
    FEBEP     Electronic Bank Statement Line Items
    FPLA     Billing Plan
    FPLT     Billing Plan- Dates
    GLPCT     EC-PCA- Totals Table
    KNA1     General Data in Customer Master
    KOMK     Pricing Communication Header
    MAHNV     Management Records for the Dunning Program
    REGUT     TemSe - Administration Data
    SKA1     G/L Account Master (Chart of Accounts)
    SKAT     G/L Account Master Record (Chart of Accounts- Description)
    SKB1     G/L account master (company code)
    T003T     Document Type Texts
    T007S     Tax Code Names
    T087J     Text
    TAPRFT     Text tab. for investment profile
    TKA01     Controlling Areas
    TKA09     Basic Settings for Versions
    TKVS     CO Versions
    TZB0T     Flow types text table
    TZPAT     Financial Assets Management product type texts
    VBSEGS     Document Segment for G/L Accounts Document Parking
    VTBFHA     Transaction
    VTBFHAPO     Transaction Flow
    VTBFHAZU     Transaction Activity
    VTBFINKO     Transaction Condition
    VTIDERI     Master Data Listed Options and Futures
    VTIFHA     Underlying transaction
    VTIFHAPO     Underlying transaction flows
    VTIFHAZU     Underlying transaction status table
    VTIOF     Options Additional Data
    VWPANLA     Asset master for securities

  • Need to add new column in SAP Query - Please guide me in this regard

    Dear All,
    In SAP Query, I need to put a new coulmn of each record for the difference of Billing date and PGI date as a work days.
    eg: Billing Date = 02.05.2008
         PGI Date = 08.05.2008
    Take a Variable i.e. Days = Billing Date - PGI Date that will display as 5 days by excluding Saturday and Sunday.
    After doing calculation of these work days for each record, we need a to add a new coulmn in that record as field lable as "Work Days" and display.
    Please Guide me in this regard
    Regards,
    Sateesh.

    Hi Rama,
    In SQ01 when you are in the fields (first would be attributes, when you click next it takes you to field groups, and again when you click next if takes you to fields tab) check the following menu path
    EDIT -> LOCAL FIELD -> CREATE
    You can define the formula as per your requirement and populate the field.
    Hope this is helpful.
    Thanks,
    Pavan

  • SAP Query - Need to join 3 Tables via outer join

    Hi,
    I need to join 3 Tables using SAP Query. I wish an OUTER JOIN to be performed for the table join.
    For Example:
    Table 1 has 1000 Entries           Field A             Field B          
    Table 2 has 300 Entries             Field A            Field C
    Table 3 has 100 Entries             Field A           Field D
    The normal Join (INNER JOIN) gives me only the records that exists in all the 3 Tables.
    But what i need is:
    In the above example, If one entry in Table 1 has no matching records in Table 2 / Table 3, there should be an output entry in the SAP Query like
    Field A            Field B              Field C            Field  D
    xxxx              yyyy                  Blank             Blank
    If there is a common record that exists in the tables, that record should appear in the same entry in the Query output.
    Field A            Field B              Field C            Field  D
    xxxx              yyyy                  zzzz              aaaa
    In this way, there should be a minimum of 1000 entries (Largest no of records in the Tables joined). More than 1000 records in the Query output depends on the number of common records.
    Kindly help if you have come across such a scenario.
    thanks & regds
    sriram

    Hi
    Please join the outer join as below
    Table1 with Field A  to Table 2 Field A-----outer join
    Table1 with Field A  to Table 3 Field A------outer join
    then you get the out put as per your requirement
    Regards
    Damu

  • SAP Query(SQ01) need to be transported

    Hi All,
    I want to transport a tcode which is using SAP query. Now I am able to send the tcode to other system but when I go to SAP query under queries and standard query area I am not able to see the version management details. I also tried going to the SAP query report through double clicking on the report name under SE93, and when I am into the report it also does not show any version details. It says "No version found".
    What I am thinking is just get the active request number from the version management and transport it to the other system.
    Can anyone of you tell me how to transport a SAP query.
    Thanks,
    Mahen

    Hello everyone,
    I am having problem in fixing this up. Let me tell you all what I have done.
    I first transported the tcode from souce system to target system.
    Because I transported the tcode so in the target system. Tcode has the report/program name as it is existing in the source system.
    Now when I transported the everything like user group, infoset and the query, I was able to see them in the target client. I tried to run the tcode.
    Tcode does not run, It says there are inconsistensies in the tcode.
    I tried to trouble shoot the problem. I found that when I was trying to run the tcode it was not able to find the report/program.
    What I did was, I generated the program for SAP query existing in the target client.
    When program was generated, I observed that It is different with the one that is currently existing for the tcode in the target client.
    This is the main problem report name are different. When I see in the se93 report name is the old one which I transported from the source system for the tcode, but when I see the report name for the SAP query by going into SQ02 it is coming different. I want to know when you create the program name for the SAP query, On what basis is the namespace of the program generated.
    SAP query program name existing for the tcode and in the source system and also in the target system(When you see it in se93) is :
    AQ01FI==========ZBSAK_LFB1====
    SAP query program name when I generated it in the target client is :
    AQFKFI==========ZBSAK_LFB1====
    Bythe way the query name is ZBSAK_LFB1
    Kindly throw some light on this.
    Thanks,
    Mahen

  • Need knowledge on sap upgrade 4.7 to ecc 6.0 in abap reports and sap query

    please give me some ideas and useful links on sap upgrade 4.7 to ecc 6.0 in abap reports and sap query

    Hi Jaya,
    Not very clear with your question.
    Are you looking for changes in areas od ABAP reports & SAP query when we upgrade SAP from 4.7 to ECC 6.0 ??
    If the response is YES, then please refer to SAP solution browser www.sapsolutionbrowser.com
    Define source release and target release .
    You will get module wise details on new features for target release.
    Hope this helps.
    Regards,
    Deepak Kori

  • Need to find SAP query for corresponding ABAP program.

    Hello SAP Experts,
    I have an ABAP program "AQDESYSTQV000001ORDERDETAILS==" in ECC 4.7. We had a client copy recently from ECC 4.7 to ECC 6.0. Now in ECC 6.0 I am unable to find this program in SE38.
    Can you please tell me how to create this program in ECC 6.0 ? Also, by the name of this program it is clearly seen that this program is automatically created by using SAP query.
    I tried to generate the program using SQ01, but system asks me for the SAP query.
    Can you please tell me how to find the SAP Query for the corresponding abap program ? Also, the steps as in how to generate the program in ECC 6.0.
    Thanks.

    Hi Danish,
    In the program name, the query name is always attached.
    For example : The program name is , AQ10SD==========Z10SD_INVPRODL=
                           Here the query name is Z10SD_INVPRODL and if you go to transaction SQ01 and enter the query name
    then you can find the infoset.
    And also you can gernate the program with the help of query name.
    Please try the same and let me know if any details are required.
    Regards,
    Darshana

  • SAP query transport error - need help

    hello,
      The system is throwing the following error when importing the query from development to QA client.
    We already have the query imported the first time without errors. This is happening with subsequent transports if there is a change or any modification to the query.
    Below is the error log from SAP regarding the failed transport :
    R3TRAQQUFI was repaired in this system
    Message no. TW104
    Diagnosis
    Object R3TRAQQUFI is in repair status. Therefore, it cannot be imported.
    System Response
    The object is not imported.
    Procedure
    If you still want to import the object, release the relevant repair and repeat the import.
    Please help
    Thanks in advance.

    Hi
    Here I am sending the step by step procedure for the SAP Query. Hope this helps you, if so please issue points.
    1. Go to SQ02 .
    Select Environment -> Query Areas
    Select Standard Area (Client specific) as show below
    2. Select Environment -> Transports
    Select Import radio button
    Check Overwriting allowed (only with import/upload/copy)
    Remove Check for Test Run
    Select Transport InfoSets and queries radio button
    Fill Infoset and Query with corresponding names
    Fill Import option with transport request number.
    3.  Click on Execute button
    With this it will be done.
    Thanks for your patience

  • Delivery Header Text in SAP Query SQ01

    Hi Friends,
    My requirement is that I need to display the Header Text contents in Outbound delivery in a Query report using SQ01.
    As far as I know, we can pull only table fields in SQ01.
    Is it possible to include Text contents in SAP Query? Can we develop or enhance it?
    Regards,
    AK

    You can add structure and code in a dataset using SQ02, then it will be available to use in SQ01, but a long text can consist of many lines, and so you may require to truncate the text - read [SAP Query|http://help.sap.com/saphelp_NW70EHP1core/helpdata/en/d2/cb3efb455611d189710000e8322d00/frameset.htm] documentation
    - [Creating Additional Structures|http://help.sap.com/saphelp_NW70EHP1core/helpdata/en/d9/9958d4c50a11d396f80000e82de14a/frameset.htm]
    - [Further Code|http://help.sap.com/saphelp_NW70EHP1core/helpdata/en/d2/cb4504455611d189710000e8322d00/frameset.htm] (I suggest record processing or after the query get the table with the text id)
    So create a structure with some text fields, and fill it for every record read in futher code part.
    Regards,
    Raymond

  • Difference between sap query and sap ad hoc query

    Hello Experts-
    Is there any difference between sap query and sap ad hoc query. If yes, I will appreciate if you can provide some input.
    Thanks,

    Hi,
    SAP Query
    Purpose
    The SAP Query application is used to create reports not already contained in the default. 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 reports and create different types of reports such as basic lists, statistics, and ranked lists.
    Features
    The SAP Query comprises five components: Queries, InfoSet Query, InfoSets, User Groups and Translation/Query.
    Classic reporting- the creation of lists, statistics and ranked lists- are covered by the InfoSet Query and Queries components. Other components’ range of functions cover the maintenance of InfoSets, the administration of user groups and also the translation of texts created in the SAP Query.
    All data required by a user for a report can be read from various tables.
    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. In the WYSIWYG mode, you can edit the lists using Drag & Drop and various toolbars.
    AD Hoc Query
    Definition
    A Web item that enables you to create and change queries in a Web application on an ad-hoc basis.
    Use
    You can use the  Ad-hoc Query Designer Web item in the Web Application Designer to structure Web applications in which you create or change queries. The Web item is as a tool for designing ad-hoc queries in a Web environment.
    In particular it enables you to:
    ·        Create queries by assigning characteristics from an InfoProvider to rows, columns, filters, and free characteristics, and including key figures from the InfoProvider in the key figure structure of the query.
    ·        Restrict or filter key figures and characteristics
    ·        Use predefined key figure structures and restricted or calculated key figures in the query
    ·        Set or change query properties and key figure/characteristic properties in the query
    ·        Create or change conditions and exceptions
    When compared with the BEx Query Designer, the Ad-hoc Query Designer Web item has the following restrictions when creating or changing queries:
    ·        You cannot integrate variables into the query directly.
    However, you can use variables in reusable structures, or restricted or calculate key figures, which are used in the Ad-hoc Query Designer
    ·        The query can contain only one structure. This structure has to be the key figure structure and be in the rows or columns of the query.
    -        You cannot use key figures or key figure structures in the filter.
    -        You cannot define exception cells, since this requires two structures.
    You cannot create the following objects using the Ad-hoc Query Designer Web item:
    -         Reusable structures
    -         Reusable restricted key figures
    -         Reusable calculated key figures
    -        Local calculated key figures
    You can create local, restricted key figures using the Ad-hoc Query Designer Web item.
    You can edit existing queries in the Ad-hoc Query Designer Web item, if the queries adhere to the restrictions laid out above The Ad-hoc Query Designer checks these requirements when loading a query. If the query is too complex, the query can be loaded into the Ad-hoc Query Designer but you cannot change it there. You then receive the appropriate message. You can still check and execute the query.
    "Ad Hoc" is a Latin phrase which means "for this purpose" and in today's parlance generally means "on the fly," or "spontaneously."
    An ad hoc query is a query that is run at the spur of the moment, and generally is never saved to run again. These queries are run using a SQL statement created by a tool or an administrator. So therefore, such a query is one that might suit a situation which is only there for the moment and later on will become irrelevant.
    As queries become more complex, it can be difficult to write them correctly ad-hoc. To help with this, one can instead write the knowledge needed for queries as business rules in English, and then use a system called "Internet Business Logic" to automatically generate and run the SQL queries. One can then get explanations of the results, in English, at the business level.
    Check these links....
    http://help.sap.com/saphelp_nw04/helpdata/en/1f/03223c5f00612be10000000a11402f/content.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/80bf2f79-021d-2a10-5082-dadc79aaa92c
    http://www50.sap.com/businessmaps/27FEEF3A12444F89A8524CCACAF4F5BF.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/15/00a042b443c56ae10000000a155106/content.htm
    Reward points if useful....
    Regards
    AK

  • Sales Order Text Lines in SAP Query

    I have a requirement to output several text lines into a SAP query based around sales orders.
    I have included some code to read the details into my query and get no syntax errors, however the report gives a blank output for each of the text fields included, despite there definitely being some text with the specified attribute ID and text object in the table STXL.
    Where am I going wrong?
    Please find the coding below for one of the text field I'm trying to extract:
    TABLES:STXL.
    DATA:
        VBELN LIKE VBAP-VBELN,
        POSNR LIKE VBAP-POSNR,
        TDNAME LIKE STXL-TDNAME,
        MYLINE LIKE TLINE-TDLINE,
        ZE18_LINE(1200) TYPE C.
    DATA:BEGIN OF LINES OCCURS 0.
            INCLUDE STRUCTURE TLINE.
    DATA:END OF LINES.
    DATA:BEGIN OF MYHEADER.
            INCLUDE STRUCTURE THEAD.
    DATA:END OF MYHEADER.
    CLEAR TDNAME.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      INPUT = VBAP-VBELN
    IMPORTING
      OUTPUT = VBELN.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      INPUT = VBAP-POSNR
    IMPORTING
      OUTPUT = POSNR.
      CONCATENATE VBELN POSNR INTO TDNAME.
    CALL FUNCTION 'READ_TEXT'
        EXPORTING
            ID = 'ZAT2'
            LANGUAGE = SY-LANGU
            NAME = TDNAME
            OBJECT = 'VBBP'
         IMPORTING
            HEADER = MYHEADER
         TABLES
            LINES  = LINES
    EXCEPTIONS
            ID = 1
            LANGUAGE = 2
            NAME = 3
            NOT FOUND = 4
            OBJECT= 5
            REFERENCE_CHECK = 6
            WRONG_ACCESS_TO_ARCHIVE = 7
            OTHERS = 8.
    IF SY-SUBRC = 0.
      LOOP AT LINES.
        MOVE LINES-TDLINE TO TEXT.
        ENDLOOP.
    ENDIF.

    Hi -
    Please check in debuging.
    check the value of TDNAME correctly populated with sales order no and sales order item.
    You can cross check with the table STXH with TDNAME and see if any entries is available for TDID 'ZAT2' as your case.
    Here are sample code.
    DATA :    lv_tdname TYPE tdobname,
                     lw_line TYPE tline,
                    li_line TYPE STANDARD TABLE OF tline.
    CLEAR : lv_tdname , li_line[],
    cocatenate w_vbak-vbeln w_vbap-posnr into lv_tdname.
    CALL FUNCTION 'READ_TEXT'
      EXPORTING
        id                      = 'ZAT2'
        language                = 'E'
        name                    = lv_tdname
        object                  = 'VBBP'
      TABLES
        lines                   = li_line
      EXCEPTIONS
        id                      = 1
        language                = 2
        name                    = 3
        not_found               = 4
        object                  = 5
        reference_check         = 6
        wrong_access_to_archive = 7
        OTHERS                  = 8.
    IF sy-subrc = 0.
      CLEAR lw_line.
      loop at li_line INTO lw_line .
    * Put your logic
      endloop.
    ENDIF.

  • Sap query and additional fields.

    Hello guys.
    ABAP it's not my strong skill, but i need to develop some report.
    What i need:
    input: material, SLED, plant
    output: material, SLED, plant, values from characteristic field.
    I have created sap query with additional field type c.
    Below my code:
    TYPES: BEGIN OF charast,
            ATNAM(50)    TYPE c,
            ATWTB(8)     TYPE n,
            X(50)        TYPE n,
            C(50)        TYPE n,
            ATINN(50)    TYPE n,
            END OF charast.
    DATA: char TYPE TABLE OF charast WITH HEADER LINE.
    CALL FUNCTION 'VB_BATCH_GET_DETAIL'
       EXPORTING
         MATNR              = MCH1-MATNR
         CHARG              = MCH1-CHARG
         GET_CLASSIFICATION = 'X'
       TABLES
         CHAR_OF_BATCH      = char.
    LOOP AT char into TEST (This is an additional field type C.
       ENDLOOP.
    Questions:
    1. How i can return internal table into standard abap type, because i can create additional field only with standart types.
    2. Need i fetch exporting parameters before calling FM? Or sap query do it automatically, based on given values on selection screen of the report?
    3. How i can return only needed field from FM output? Now, when i'm executing FM via SE37 it's show desired result, but when i'm getting it from code i see strange values.
    4. If i don't know exactly return by an FM values, how i can fill structure dynamically?
    5. How i can return result of a program not only to additional field but to layout?
    Sorry for noob questions and thank you in advance guys!

    Well, seems like it work fine for me.
    Below my crappy, but working code:
    DATA: material TYPE MCHB-MATNR,
           batch    TYPE MCHB-CHARG,
           plant    TYPE MCHB-WERKS,
           sloc     TYPE MCHB-LGORT,
           gtdt     TYPE STANDARD TABLE OF clbatch,
           gtdit    TYPE clbatch.
    SELECT MATNR INTO material FROM MCHB
       WHERE MATNR = MCHB-MATNR.
    ENDSELECT.
    SELECT CHARG INTO batch FROM MCHB
       WHERE CHARG = MCHB-CHARG.
    ENDSELECT.
    SELECT WERKS INTO plant FROM MCHB
       WHERE WERKS = MCHB-WERKS.
    ENDSELECT.
    SELECT LGORT INTO sloc FROM MCHB
       WHERE LGORT = MCHB-LGORT.
    ENDSELECT.
    CALL FUNCTION 'VB_BATCH_GET_DETAIL'
       EXPORTING
         MATNR = material
         CHARG = batch
         WERKS = plant
         GET_CLASSIFICATION = 'X'
        TABLES
          CHAR_OF_BATCH = gtdt.
    READ TABLE gtdt INTO gtdit
       WITH KEY atnam = 'BATCH_SHELF_LIFE_EXPIRY_DATE'.
    GTD = gtdit-ATWTB.

Maybe you are looking for