SAP Query that is configured

Hi,
I'm doing some configuration for a report. Actually, I was told that there may be a Customised T-Code associated with this configuration but this configuration is purely retrieving data from the standard Infotype and 1 field from a Custom field based on function module to derive, so I'm not sure if configuring this query will it be done in SQ01 if a Customised T-Code will be used to represent this query and if it will be done in SQ01 then can it incorporate the custom field as how we choose for standard field in standard infotype? If it is the same, then am I able to add in some more fields which will have hard-coded value (which means these hard-coded fields will not get any value from any infotype)? Thanks.

First of all, most questions have version-dependent answers. You need to post your Oracle version always to get accurate help.
Secondly, if you can identify the session, you can identify the query. V$session has attributes pointing to the query.
In attempt to learn you to fish yourself, you should use the view dict_columns to see which they are, or look v$session up in the Oracle reference manual for your version.
If you have those columns, you'll need to join them to v$sql_text_with_newlines and you have your query.
Sybrand Bakker
Senior Oracle DBA

Similar Messages

  • SAP Query - Additional field that collects information from table RESB

    Hello gurus. I have a question.
    I want to create a SAP Query that shows me the stock level of a list of materials, and also show me the total quantity of order reservations in an additional field.
    I created an InfoSet with table MARD, which is the one that holds the Stock information in a plant. Then I created an additional field which would read information from table RESB, the table that holds order reservations per material.
    So I wrote this piece of code:
    SELECT * FROM RESB
    WHERE MATNR EQ MARD-MATNR and
           WERKS EQ MARD-WERKS.
    ENDSELECT.
    if ( sy-dbcnt NE '0').
          MOVE RESB-BDMNG to ZQTY.
    ELSE.
          MOVE '' to ZQTY.
    ENDIF.
    This works fine. However, this is currently just catching the first record in table RESB that matches my condition.
    What I would like is to collect every instance of RESB-BDMNG and add them to field "ZQTY", have it loop in RESB until it finishes finding every record that match the MATNR and WERKS. With this I could get the total number of order reservations that this material has in that table.
    Could someone share some coding that would help me achieve this?

    Yes! That did it. That's what I needed to do. Thank you so much.
    While I'm at it, let me ask you a related question.
    When I execute the query, in the first records of the query where there's no value from RESB to transfer, the value of field ZQTY appears empty. Once it finds the first record in RESB and it populates ZQTY with a value, then the rest of the records with no hit get the proper value of 0.
    Do you know why the first records in the query appear empty and not with a 0? Is there anything I should add to the coding to fix this?

  • SAP Query-to be saved on Easy access menu

    Dear All,
    This is regarding the SAP Query that I have created on Production. Pls help me out with the way to save it on sap easy access menu. At the moment, i have saved the t-code SQ01 in Favorites but it is not serving the purpose because everytime an end user logs in, he has to go through the T-codes SQ03, SQ02 and SQ01 in order to get the usergroups, infosets and the Query in sink inorder to execute the report.
    Points would be awarded.
    Thanks
    Deepali

    Hi Deepali,
    Go to SE93.
    Create a transaction & select the last option of radiobutton -> Transaction with parameters.
    Transaction : START_REPORT
    Skip Initial Screen : Clicked
    SAP GUI for Windows : Clicked
    Default values:
    D_SREPOVARI-REPORTTYPE = AQ
    D_SREPOVARI-REPORT = /SAPQUERY/HR -- HR is the user group name
    D_SREPOVARI-EXTDREPORT = Report name
    D_SREPOVARI-VARIANT = Variant name
    D_SREPOVARI-NOSELSCRN -- if no sel sc asked for.
    After creating the transaction you can easily attach it to Easy Access Menu.
    Best Regards,
    Dilek

  • SAP QUERY using ASSHR and ASSOB tables

    We currently have SAP query that reports on additional payments (Info type 0015).  The user wants to report the cost center held on the cost assignment (Tables ASSOB and ASSHR).
    The existing query uses infoset created using PNP logical database. 
    How do I add or join the ASSOB and ASSHR tables to Info type 0015 to report the cost center?
    Thanks in advance
    Shamshudin

    Hi Sham
    You may need to create custom fields in the infoset and create some code to pull out and display details from ASSHR and ASSOB corresponding to the ifnotype record.

  • SAP Query: MSEG - MATNR

    hello friends,
    i'm trying to create an SAP query that should output the Material Number of some purchase orders.
    i'm choosing Direct Read of Table (MSEG) as my data source for my infoset.
    however, inspite of choosing MSEG-MATNR (selection and output) as one of my data field, i could only output the Material Description, and not the Material Number itself.
    i believe i am missing out on something. could someone help me?
    thanks in advance.
    best regards,
    albert

    Dear,
    Did you try MB51 report with Movement restriction 101.
    1. You are preparing query to get PO number and Material document number. That means Purchase orders which have material documents - usually means goods receipts.
    If it is true, then try MB51. In this report you will get PO. Nu. / Mat. Nu /  Mat. Desc / Batch / Mat. Doc. Nu. / Amount in LC and Currency.
    All display you required you will get.. Try this. I hope this will solve your requirement.
    Regards,
    Syed Hussain.
    Edited by: Syed Hussain on Aug 31, 2009 12:32 PM

  • SAP Query- Reporting on SOD

    Hello everyone,
    I need some help in creating a report in SAP Query based on user's processing Vendor Invoices and also Vendor Payments?
    I would like to have the following columns to report on:
    USNAM u2013 User Name (from BKPF)
    BLDAT u2013 Document Date (from BKPF)
    BELNR u2013 Document Number (from BKPF)
    BUKRS u2013 Company Code (from BKPF)
    BLART u2013 Document Type (from BKPF)
    LIFNR u2013 Vendor Number (from BSEG)
    NAME1 u2013 Vendor Name (from LFA1)
    WRBTR u2013 Amount (from BSEG)
    Vendor Invoice- I would like to restrict to only document type fields that are KA,KR,RC,RE,RN and ZE
    Vendor Payment- I would like to restrict to only document type fields that are ZV,ZS,ZP,ZH and KZ
    I have a few questions:
    First is i am using a logical database (BRM as BSEG cannot be joined) to select my columns however i do not know how to pull the 'Vendor Name' from LFA1. I understand that this table is not in BRM but is there a way to add any extra tables to work along side the logical database?
    Secondly, i have managed to report on all columns except the vendor name (from LFA1) and although i can restrict my output data based on document type fields, i need the report to only show the user's that have process vendor invoices & vendor payments only?
    At the moment i have a list of restricted document type but cannot seem to jsut show only those users who have processed both in both processes. For example User A has processed a vendor invoice (which is shown) and the same user may have processed vendor payment (after searching through the long output list!)
    I want all users who have doen one of the other process and only interested in those that have done both?
    Any feedback is much appreciated and pelase let me know if i have not explained this problem properly (as i am a newbie in this area)
    Many thanks
    Amar

    Hi Pascal,
    Since the IT2501 is a "Simulated Time Infotype" you cannot look at the data in it, but you can confirm the data from the ZL cluster and the data from the employee.  Since it is only this employee or a few employees, it is probably not the configuration of the time buckets for the IT2501, but you may want to make sure all time times are captured as you want.  Then look at the time entries for this individual or individuals.  Did they enter a time type that was not expected or configured?  Is all their time approved and passed through Time Evaluation?  Finally check the Master Data for the employee - is the Planned Working Time (IT0007) infotype correct or has it been recently changed?  Is he in a special Cost Center (IT0027) or Project that is captured differently for time purposes? 
    Since it just one or a few individuals, I would suspect the Master Data and some inconsistant entry that affects the time cummulation for the IT2501.
    Paul

  • Adding Fields to Custom Infotype Using Custom Infoset in SAP QUERY

    Hi All,
    We have a requirement to add fileds to a custom infotype for querying Custom Infoset in SAP Query.
    We are facing problem as the added field is not getting displayed in the Query set so that we can select and display it in the Basic List along with the other filds.
    Kindly suggest a solution.
    Full points will be rewarded.
    Thanks in Advance
    Kumar

    Hi Salman,
    Thank you for your valuable information. I haven't Configured Dynamic Actions yet. Is it simple to write the Logic for Dynamic Actions. Is this the only way to solve this Issue?
    I tried by adding the standard fields, but they are not populating the values; but just appearing as Input Fields with Input help option.
    Please let me know if you have any suggestion in this direction?
    Regards,
    Hems.

  • SAP Query - Reporting on Simulation infotype 2501

    We defined reporting time types for the SAP delivered infotype 2501 to report from the ZL cluster.  However, when we report the data using SAP Query, for a few records, the following is observed:
    (1) Basic list output in Query report splits the record as only 50% (half) of the time is output when compared to the data in the cluster.
    (2) If you also use the same field in a Statistics output, it seems to report the full amount of time as recorded in the cluster.
    The discrepancy is noticed only in a very few records reported by SAP Query. We need to be absolutely sure as to why some records are not reported accurately by SAP query basic list output for the simulated infotype.
    I would appreciate your help
    Thanks
    Pascal

    Hi Pascal,
    Since the IT2501 is a "Simulated Time Infotype" you cannot look at the data in it, but you can confirm the data from the ZL cluster and the data from the employee.  Since it is only this employee or a few employees, it is probably not the configuration of the time buckets for the IT2501, but you may want to make sure all time times are captured as you want.  Then look at the time entries for this individual or individuals.  Did they enter a time type that was not expected or configured?  Is all their time approved and passed through Time Evaluation?  Finally check the Master Data for the employee - is the Planned Working Time (IT0007) infotype correct or has it been recently changed?  Is he in a special Cost Center (IT0027) or Project that is captured differently for time purposes? 
    Since it just one or a few individuals, I would suspect the Master Data and some inconsistant entry that affects the time cummulation for the IT2501.
    Paul

  • VC and SAP Query

    <u><b>System Landscape</b></u>
    NW Sneak Preview Java Edition with EP 6.0 (from SDN)
    VC 6.0, Patch 5
    R/3 Enterprise 4.7 extension set 200 (WAS 6.20)
    <u><b>Scenario</b></u>
    Utilize the BI Kit in VC and use SAP Query from a backend R/3 system to generate VC content.
    <i>(From what I have understood, the BI Kit does not necessarily need BW and can work with a R/3 source)</i>
    <u><b>Questions</b></u>
    (a) Is the assumption correct that the BI Kit can use the SAP Query as a backend to generate content in VC (without a BW system in the landscape)?
    (b) Do I need to install the BI UDI SP stack with the EP in NetWeaver Sneak Preview ?
    (c) What type of systems do I need in the EP ? If I try the "New System" wizard, I do not get an option to connect to a "BI" system. nevertheless, if i try "new from PAR", i have a an option to use "com.sap.portal.systems.BIUDI". Can you help me with the parameters for a PAR - "com.sap.portal.systems.BIUDI" ?
    any other tips / experiences of working with SAP Query and VC are most welcome.
    Regards, Parag.
    Note: I have tried a R/3 system connection and the RFCs are visible in VC

    Thanks a ton Mario, your hints helped me in arriving at the configuration.
    For the sake of completeness, I am listing the steps that led me to a successful config.
    1. Download the BW 3.5 SR1 installation guide from service marketplace
    2. Goto section 6 and perform the steps highlighted for BI Query Connector. Note that if you dont assign a value for the parameter "SERVERGROUP", the default is PUBLIC. So if you have a server with only SPACE (like I had), please do enter "SPACE" for this property.
    3. Edit the services file on the Windows Server and add an entry for your SAP server. For example, my server SID is DEV, hence I inserted the following entry in the service file: sapmsDEV 3600/tcp
    This step is necessary for JCo to work.
    4. Stop and Re-start the BI Query service (using the Visual Administrator)
    5. Test the connection with the following URL - http://<host>:<port>/TSapq/servlet/TestSapq
    This should list you the queries in the SAP system
    6. Open EP (I logged in as admin) and add the system as described in Step 4, section 2.2 of the VC installation guide.
    7. Add permission for "everyone" group to this system
    8. Login to EP with another userid, perform user mapping (personalize option)
    9. Start VC storyboard, login to EP with the other userid (not admin), use Data Service or BI Query Wizard to retreive the queries.
    Why did I have to use another userid ?
    Well, this was because the connection test did not work for me with the admin user, nor was I able to retrieve the queries in VC. Dont know why this didnt work.
    Message was edited by: Parag Jain

  • E-recruiting - reporting from SAP Query

    Hi all,
    We are using SAP Query to run reports for e-recruiting and have created our own infosets copied from the SAP standard delivered ones.
    We are also using the EEO entries based on the configuration tables in the IMG and making these available when creating questions in questionnaires for EEO data. This is all successful and the questionnaires can be completed. However, when trying to report on this data by testing it in SQ01, none of the ethnicity data appears on the output.
    Does anyone know if there are any jobs that need to be run to extract the information from questionnaire responses to be reportable through the SAP Query tool?
    Thanks in advance.
    Jim

    Hi Jim,
    I need a favour from you, Pls give me some sample SAP query reports that are generated for E-recruiting so as to get familiar with using SP Query for E-recruiting as one of my clients need the same.
    Thanks in advance,
    Kuamr.

  • SAP query load to Oracle

    Hi,
    I'm looking for the best way to automate the results of an SAP query (Quickviewer) to Oracle. The query would run nightly. I searched all SND forums but did not find much. I also looked at the SAP application help for Quickviewer.
    Regards,
    John

    David,
    Just an FYI the error message that you have found is not connected to your BLS transaction but rather the default IDoc listener trying to connect to something that doesn't exist.  This listener will automatically start each time xMII starts, as a result you can set it up to connect to an RFC destination or delete the default configuration and it will go away. 
    Now onto your issue; How many Production Orders are being returned from the BAPI?  How are you loading each of them into Oracle?  How much memory is allocated to ServletExec vs. How much is available on the machine?  By default xMII will limit all SQL/Tag queries to their <b>RowCount</b> with a max at 250k rows but this does not apply to the JCo call.
    My suggestion here is to look for the other error message that pertains to your transaction which may reside in the ServletExec logs and not xMII, they can be found on your xMII machine here: http://localhost/servletexec/admin/login.jsp
    Hope this helps.
    Sam

  • 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

  • Trying to create a query that shows Sales Order/Invoice Totals as well as Paid/Outstanding/Available Down Payments

    Currently working on SAP B1 v8.82
    I'm looking to generate a query that will give an overall report for a given customer that shows Sales Order No, Invoice No, Sales Order Total, Invoice Total, Amount Paid on Invoice, Amount Remaining on Invoice, Down Payments Available, Open on Sales Order.
    I'm not sure what the best way to select the columns in bold above.  Invoice Total should be self-explanatory.  Amount Paid should be any down payments or applied payments on the invoice.  The balance due on the invoice (which seems to be T0.DocTotal if I'm not mistaken) should = 'Invoice Total' - 'Amount Paid on Invoice'. In the Down Payments Available column I want the total amount of money on the account or on down payments that aren't tied to a Sales Order.  If a client overpaid in the past for instance and there's a credit on their account, then it should contribute to this sum.  Open on Sales Order should be pretty easy.  I guess it's just the sum of everything that is still open on the Sales Order.  I'm just not sure what the best way to sum all the un-delivered freight, tax, and line items is.  Here's what my query looks like so far.
    SELECT DISTINCT T4.[DocNum] [Sales Order No],
    T0.DocNum [Invoice No],
    T4.DocTotal [Sales Order Total]
    T0.DocTotal [Amount Outstanding],
    FROM OINV T0
    INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN DLN1 T2 ON T1.BaseEntry = T2.DocEntry AND T1.BaseLine = T2.LineNum
    INNER JOIN RDR1 T3 ON T2.BaseEntry = T3.DocEntry AND T2.BaseLine = T3.LineNum
    INNER JOIN ORDR T4 ON T3.DocEntry = T4.DocEntry
    INNER JOIN OSLP T5 ON T4.SlpCode = T5.SlpCode
    WHERE T0.CardName Like '%%[%0]%%'
    GROUP BY T4.DocNum, T0.DocNum, T0.DocTotal, T4.DocTotal
    I tried doing a little searching around for queries similar to what I need, but I could find exactly what I was looking for and I'm very unfamiliar with OJDT, JDT1, and ITR1 tables which I think might be important to finding unapplied payments...

    Thanks.  There's a few problems though.
    1)  It seems that OINV DocTotal != Balance Due.  I'm seeing a number of invoices where there was a balance due, but we applied additional money (either we took another incoming payment and applied it or applied money from the account balance, etc.) and yet it still shows a total.
    2)  It's pulling incoming payments from different customers.  I think this is because the table was joined based on "RCT2 T4 on T4.[DocEntry]  =  T3.[DocNum] and T4.[InvoiceId] = T2.[LineNum]"  In one example I have 2 incoming payments 446 and 614.  Both have the DocEntry 542, but one relates to A/R Invoice 542 (for a different client) while the other relates to Down Payment Invoice 542.  *I was able to fix this by adding WHERE T5.CardCode = [%0]*
    3)  I'm going to work with this a little bit and see if I can alter it to make it work for me.  Basically this query falls a little short on the following:
    -  Doesn't include incoming payments that aren't linked to a down payment invoice.
    -  Does not give the Invoice Total (I'd like to know how much of the SO was invoiced.  DocTotal seems to give me Amount Invoiced - Down Payments.  I'm not sure the best way to get this number.  Maybe I could do the sum of each line * tax + freight)
    -  Does not give the outstanding amount on an invoice.  The ARtotal [DocTotal] column gives me how much was owed when the invoice was created, but it doesn't tell me what is currently owed.
    -  Lastly it may complicate the query too much and could be left off, but it would be nice to see if they have any money from credits or incoming payments that has not been applied.  Perhaps this would be easily accomplished by simply pulling in their account balance.

  • SAP query

    Hello ABAP Guru
    I need a help here. trying to create SAP query joining three table VBAK VBAP KONV since KONV being cluster table I am not able to do that
    thpough I am suceesfully establishe dthe link
    VBAK-VBELN=VBAP-VBELN
    VBAK-KNUMV=KONV-KNUMV & VBAP-POSNR=KONV-KPOSN
    OSS msg says we have to write routine in sap query
    but I never used that option
    anyone has any clue on how to use cluster table in SAP query?
    Thx
    Praveen

    Hi,
         Inner Join can't be  used for cluster tables.
         Write a routine in SAP query as follows.
          do inner join on vbak,vbap into internal table  
          itab.
           select for konv for all entries itab .           
    Regards
    Amole

  • How to call SAP query in a program

    Hi experts
      I have created a query in SQVI its gives a result. Now i want this query to be used in my program. Is there any FM which gets the quary name and populates the result in iternal table. So that i can use that result.
       I know without query you can write using the tables you can fetch the records but i just want to explore a new way to do things. If any body done such type let me know and also give some sample code or process how to achieve it.
    Regards
    Vijay

    Hi Siva
      My final option is that only. That you can do any how. But my intension is to learn something new way. How to do copy the query and where to inject the code is there any example in wiki or artical for that. I want to something new. Old way of creating a report program is possible i want to do this way. If some body could help me out.
    @ karthik
       I have generated the SAP query and i got the program but when i view the code i dont find any select statment or where storing my input data. How to identity that i did in debug mode but am not sure where it pulls the data and where it put in internal table. Can you throw some light with example code or an article.
    Regards
    Vijay

Maybe you are looking for