Capture SAP Ad-Hoc query output in report

Hi All,
I have to run an Ad-hoc query from report (se38 program) and after execution of that Ad-hoc query I have to capture the output of that query and use in Report.
I am trying the follwing approach but getting Run time error (internal Error)
SUBMIT XXXXX EXPORTING LIST TO MEMORY
Data:
v_spool like pri_params-plist,
v_text like pri_params-prtxt,
v_print_parms type PRI_PARAMS,
V_valid       TYPE c LENGTH 1,
v_spool = sy-uzeit.
v_text = sy-uname.
call function 'GET_PRINT_PARAMETERS'
exporting
destination = 'locl'
list_name = v_spool
list_text = v_text
user = sy-uname
importing
out_parameters = v_print_parms
valid = v_valid
exceptions
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
others = 4.
IF V_valid = 'X' AND sy-subrc = 0.
  SUBMIT SAP_QUERY_AD_HOC
                    TO SAP-SPOOL
                    SPOOL PARAMETERS v_print_parms
                   ARCHIVE PARAMETERS archi_parameters
                    WITHOUT SPOOL DYNPRO
                    WITH p_wsid = 'X'
                    WITH p_bgname = 'ZHR_OM_PA'
                    WITH p_sgname = 'ZHR_PA_PERSONNELADMIN'
                    WITH  p_quname = 'Z_HRDATA' AND RETURN.
ENDIF.
Thanks in Advance

My friend. Runtime error is like saying "it doesn't work please help me". You need to give more details if you want someone give detailed anwser. It's technical forum so please try to explain technical nature of your problem. In other words, what is the dump saying?
Regards
Marcin

Similar Messages

  • 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

  • Ad-Hoc query output issue

    Hello Experts,
    Recently we have upgraded the system and we are facing issues with Ad-Hoc query output.
    Issue : After entering data in selection fields and click on "OUTPUT" button we  are getting output. now I changed the selection field  data and click on "OUTPUT" button then we are getting message "No Data selected".
    But when clicked on "HIT LIST" button for changed selection fields then we are getting HIT LIST count and after click of "OUTPUT" button we are getting output.
    So at this point this is unclear why it is working after HIT LIST? This is not consistent but appearing most of the time.
    Regards,
    Saurabh

    Thank you for reply. Yes I have checked SQ03, 02 and 01.
    It is not specific to particular query it is appears to be for all the queries.
    The important thing is to get the output we need to click first HIT LIST button and then OUTPUT. Is there any specific settings maintained for displaying output without clicking HIT LIST ?

  • Ad Hoc Query Output

    When I access Ad Hoc query (S_PH0_48000510) to run an existing report, instead of selecting the output button right away, I click on Hit List, get the number of records, then I click on display (eyeglasses).  The pop-up window shows me 24 records, all of which I am expecting to see as they fall within my selection criteria.  I select them all, then click on the output button.  Only 7 records show upu2026  And, there are no error messages or authorization messages.  I checked the layout and filter, and everything looks correct.  Does anyone have any ideas as to what I'm missing?  There are no calculated fields; this is just a simple query.
    Thanks in advance!!

    Hi Debbie,
    One thing we did in all of our custom Infosets was to include the start date and end date of every infotype as well as the date changed and who changed it.  Thus, when we run reports that are date specific we can say that the start date and/or end date must fall within that range and we can also output that info. 
    I do not know your data or selection criteria, but the problem may lie with data that is no longer current or "top of stack" that excludes hits from being included in the output.  One example is with IT0000-Actions.  You may be seeking those employees who had a Rehire action since January 1st.  But a later transfer or leave of absence action may now be "top of stack" and the current action, thus is no longer "Rehire",  Your output would only be those whose latest action is Rehire and the others with later actions would be left off.  Adding the start and end date fields will sometimes allow the output of the older Rehire record as would deleting the action type in the selection once the Hit List was maintained in the Reporting Set section.  You would now see the Rehire along with the other actions.
    Paul
    Paul

  • Ad hoc query - Infoset, after selection it is giving two different output

    Hi All,
    We are facing problem in ad hoc query, after PQAH Ad hoc query, when we go to one infoset, so after making some selection and putting some output field,
    When we click on refresh data button(in lower pane) so it gives only one record, which is incorrect, but when we click on u2018Start Outputu2019 button it gives 3 records those are correct.
    Can anyone tell me, why this is giving different output.(first time 1 record, and second time 3 records) record 3 output is correct.
    Regards,
    Kumar
    Edited by: kumar r12 on Mar 18, 2011 9:00 AM

    Hi Kumar,
    Are you looking at the "Hit List" or the output of the results in the lower pane?  The hit list will only give you the number of persons who will be in your output.  The refresh button should give you a preview of the output. 
    What persons or fields are different or not shown in the preview area vs. the output?  Also, what are the dates for the data?  Are you looking at current data or looking for history?  The output may be showing you history and the preview only current data.  Most concerns with Ad Hoc Query output are related to dates - for the selection and the output. 
    Paul

  • AD-hoc query...urgent

    hi,
    I wanted to generate ad hoc query.I kno that it is generated to transmit the data in the Vendor systems from the SAP System.
    so plz tell me how to generate it in SAP HR.plz if possible explain it with the example and what is the impact of it on SAP system as well as vendor system??
    points r assured.
    Thanx

    Ad hoc query is a report which is based on database tables. It is normally used if a report is required to dump the data from one or more tables using table join not having complex logic.
    Ad hoc query can be created for any module. You need to know the database table/s or logical database with correct logic. Since, it is just a report, it does not have any impact on another area.
    regards,

  • Ad-hoc query

    Hello,
    Our business users would like to use ad-hoc query for the reports they would want to generate on the as need basis. Can anyone please elaborate on how to use ad-hoc reports in HR.
    I tried with the t-code S_PHO_48000516 for running ad-hoc reports, but its only for PA. We would want to run queries both on PA and OM data simultaneously. Also I could not pull the custom infotypes data in there.
    Please elaborate on how to use Ad-hoc and Infoset queries.
    Thanks in advance.

    Hi,
    U can use Infoset Query for report in HR. T-Codes are SQ03, SQ02 AND SQ01. By SQ03 create user group. then SQ02 -infoset and by SQ01 create reports.
    try this. it works.
    Regards
    Nas

  • Out put problem in Ad hoc query reports

    Hi Gurus,
    I am tryting to generate a report through Ad hoc query in S_PH0_48000510 - Ad Hoc Query SAP/Query/HR_ADM - > Selected several options like personnel number / employee name / entry date / leaving date.
    But when we select it shows the input details but when i try for output the entry date / leaving date even the names of the employees are not reflecting.
    But the age/date of birth other fields are coming in output.
    Kindly let me know the solution to get a out put. If there is any changes need to be done in the back end. Pls advice with the path details.
    Thanks & Regards,
    Pradeep Krishnamurthy

    Hi Madhu,
    Yes, I did but out put is not coming.
    Regards,
    Pradeep Krishnamurthy

  • Benefit cost reporting in ad hoc query

    Is it possible to use ad hoc query to report on future dated benefit cost changes?  I have tried several different ways but have not been successful.
    I tried changing the date of the reporting period to match that of the effective date for the benefit cost change but the system still outputs the old costs.
    I also tried using the benefit cost calculation date as a selection field and then enter the effective date for benefit change but that did not work either.
    Does anyone have any insight?  Thanks in advance for your input!

    Did you ever find an answer to your question?  I am having the exact same issue.  Unless a new infotype is saved with the dates that coincide with the cost configuration change, I cannot report on the new cost via Ad hoc or SAP query.  The only thing that works is the standard health plan cost report but my users prefer to use query so they can get every field they need.

  • AAP and EEO Report by Ad Hoc Query

    SAP Gurus,
    My client went live with basic modules of SAP Jan 2007. The problem is with AAP EEO Report. We will develop ABAP report later. For now we want to generate the AAP EEO report by using Ad Hoc Query. We are storing the EEO and AAP codes in IT1610  for Job. If I have to build query what is the best way :
    1-     I tried an infoset with  PNPCE and apart from the basic PA infotypes I selected 1000, 1001 and 1610 for job. But when I select EEO and AAP category in output I don’t get the actual data. I know I am doing something wrong here but don’t know what ?
    2-     If I will start a table join with IT0000, IT0001,……….etc and V_T5U13 …….will it work ?
    Any other suggestions how can we address this issue temporarily by ad hoc query ?
    Sanghamitra

    First, do not try and reinvent the wheel...the EEO-1 and AAP reports are standard supplied SAP reports and can be found under Human Resources --> Personnel Management --> Administration --> Infosystem --> Reports --> Administration US --> Compliance.
    The EEO-1 report is changing for 2007 and the latest support packs must be installed to give you the new tables and table entries, features and report layout needed for this year.  See SAP Notes 976273, 435204 and 986115.  The IT1610 itself changes as do the definitions, so the support pack installation is a must,
    If you still want to try to get this information via Ad Hoc Query, you will need to utilize a PCH based Infoset.  Create this based on the object Position.  The position is your link between the person with HR Master Data and the Job with job related data such as IT1610.  With this infoset, you can do the reporting on the EEO Job classes from IT1610 and the Ethnic groupings from IT0077-Additional Personal Data for the employee and gender from IT0002.

  • SAP Query dwonload through report

    Hi All,
    I have a SAP Query. I want to download the output of the SAP query on application server using report.
    please let me know how to use SAP Query in report. Please provide some sample code if you have.

    Do you have option of copying the query to Z report and then incorporate the logic of writing on application server in the Z report...

  • Outputting System User Name in Ad Hoc Query (S_PH0_48000513)

    I am trying to create an HR Ad Hoc Query and one of the fields that I am trying to output is System User Name from infotype 0105 Communications.  If I choose this field and do not choose the Communication Type, I get two records per employee - one record with the System User Name populated and one record with a blank value for System User Name.
    If I choose the System User Name field for output and also make a selection on Communication Type (= subtype 0001), employees with no System User Name (i.e. no Infotype 0105, subtype 0001) are eliminated from the report.
    I want the report to show all selected employees, including those without a System User Name; however, I do not want the same employee to appear on the report twice.
    Has anyone else experience this problem?  If so, have you figured out how to eliminate the extraneous record for each employee when you do not select the Communication Type?
    Thanks in advance.

    Hi,
    Love to know if you managed to find a solution for this issue as I'm experiencing the same problem.  However I'm reporting on both system user and email address which are distinct fields and would prefer to see this information only on a single line.  With my report I get communication system user on one line and then email address on the another, I'd also like to be able to include those users where the info types have not been maintained.
    With the query I have created I also included logon data from the USR02 table.
    Cheers
    Bill

  • Reports in MSS... Same as Ad-hoc query??

    Hi experts.
    I have developed some reports in Ad-Hoc Query that pulls through HR data into MSS... If I create subtotals on my report in Ad-hoc query then I can collapse and expand data per employee which would be really cool for managers to use also...
    As standard would this functionality be replicated in the MSS Portal?? Or would the data come through is a standard table of data?? does it depend on the portal at all?
    Any ideas on how we could test this or even implement it would be great. We have managers with 4-5 employees but each employee has possible 10+ absence quotas (don't ask why) so if the manager could see an overview per employee and then expand for a single employee it would be a really great solution.
    thanks in advance!
    Euan Robertson

    You can have your reports, but that has to be converted to LPA format, You can check the steps here
    http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=199820849

  • Can we use ad hoc query to get a temporary report of payroll result?

    Hi,All
    can we use ad hoc query to get a temporary report of payroll result?or we have to get a report of payroll result by customizing and ABAP?
    and how can I customizing a report on the basis of standard SAP report for payroll?

    Hi
    As of my Knowledge You cannot get the payroll report through Adhoc query you have to go for ABAP Devlopment
    Thanks
    Mahantesh

  • Questions in Ad Hoc Query & How to Configure the EEO standard reports

    Hi all,
      I have a  question in Ad hoc query report in HR.
    <b>How to:</b> Get a list of the total number of employees included in a particular report at the end of the report. Ex: If i create and run a report for salaried employees, sorted out by company codes, how can i get a sub-total and total no. of employees listed in the report.
    I tried Ranked format, but when you print the report it doesn't retain the report name on the top.
    -->I have a question regarding the Standard reports for EEO and AAP
    <b> How do I</b>
    1. Start configuring these report
    2. What are the things i should have before configuring it in IMG
    If anyone can provide me with some documentation regarding the EEO and AAP report configuration that would be great.
    Thanks in advance.....
    Harish

    This can be done using the security for the Infoprovider,  provide the users access to create queries only for that Infoprovider.

Maybe you are looking for