SAP Query in Excel
I actually found what I needed to do this on the forum last week and now I can't duplicate it nor can I find the original forms thread. I need to get the SAP Query results to a file or to Excel. The first time I tried this, I executed the query in background, got the spool number then went to SP01. There I believe it did the following:
[Execute]
Selected: Spool Request / Forward / Export as Text
At this point, I was presented a popup similiar to when downloading with options: unconverted, spreadsheet, etc. I selected spreadsheet and everyting went fine.
Now when I repeat the process, after I do Spool Request / Forward / Export as Text, the file is automatically written to a text file; I do not get the option to put it in a spread sheet.
Please, can someone tell me what I'm doing wrong? If I hadn't saved the spreadsheet last week, I would have myself convinced I only dreamed that I got it to work.
You can try this way
sp01> display spool>spool request> forward> save to local file--> spread sheet
otherwise try with
Once you logged in, press Alt+F12 -> Options -> Local Data. Then just press "Clear History" button
and try spool> forward> write to text
a®
Similar Messages
-
Error 'Unable to open file' when downloading SAP Query to Excel
Hi all
I'm running a SAP Query which is set to download straight to a spreadsheet (Pivot Table / Microsoft Excel). Intermittently it does not work - apparently at random (at least, I've can't recreate the error at will).
It does one of the following:
- Works ok, and creates the pivot table
- Gives an Excel error message 'Unable to open file', then returns to the 'save the data in a spreadsheet' popup when enter is pressed on the error.
- Does not issue error message, just goes to the 'save the data in a spreadsheet' popup.
In the last two cases, the excel pivot table sheet is not created.
Has anyone seen anything similar, or have any idea as to what is causing the problem?
Any help gratefully received!
Not urgent as I've found a way round - further testing seems to show that I don't get the error is Excel is already open - but in the past I've run many SAP query downloads without needing to open Excel first. I suppose it's possible that this is just something to do with the Excel setup at the user site
Message was edited by:
E GregoryHi,
Ensure that file name with same name and in same path should not be open while saving the data.
Award if it helps.
Jogdand M B -
Error in Excel while exporting from SAP query.
Hi Gurus,
While exporting one SAP query to excel the last row/line of information lost partially.
Means we get some information in the last line of excel but some information is not exported in that same line.
Can you throw some light on this please....Hi
Due to special Chracters in the Values sometimes this happens when exporting to excel.
Please download into Unconverted format selection & after downloading Open with excel & save it in excel
Thanks & Regards
Kishore -
SAP Query output download to Excel
Hi All,
Once I export/download Query Output to Excel the fields are not in the order of Actul Query output
<u><i><b>Char fields are treated as Key fields and displayed Left side.</b></i></u>
As it is a SAP Query where to keep this kind of setting(key columns = 0).?
Thanks in advance and useful answer will be awarded.
cheers!!
Komatsuwhen u download data to excel sheet, u can't handle the data from SAP....The data in excel takes excel properties and accordingly data gets adjusted to the formats of excel.
If u need formatting u need to use OLE concepts in SAP from which u can set the formats of Excel Sheet. -
SAP Query output download to excel fields order is different
Hi All,
while download Query Output to Excel the fields are not in the order of actual Query output
Char fields are treated as Key fields and displayed Left side.
As it is a SAP Query where to keep this kind of setting(key columns = 0).?
Thanks
Komatsuwhen u download data to excel sheet, u can't handle the data from SAP....The data in excel takes excel properties and accordingly data gets adjusted to the formats of excel.
If u need formatting u need to use OLE concepts in SAP from which u can set the formats of Excel Sheet. -
SAP Query : Excel sheet download problem
Hi,
While executing a Z SAP query in SQ01 and data is displaying fine in the ALV format. But when we export the data to excel sheet, every column is appearing twice (repeating only the header, with empty items)
something like this......
Excel sheet...
Header MATNR MATNR MATKX MATKX LIFNR LIFNR KUNNR KUNNR
Item 10 Test ABC ABC
20 Test2 XYZ XYZ
30 Test3 MNO MNO
What can be possible cause of this ? What can be the corrective step to the issue?
Thanks,
JaiHi ,
Please follow the below step .
In SQ01 --> In the List Display screen --> click on Export --> Local file --> Spread Sheet --> Give the File name and click on generate .
It s working file . and i can be able to download all the records to excel without any repeatation .
Thanks
Pavendhan -
SAP Query : Save to file in XLS format in background
Hello everybody,
I used the enhancement SQUE0001 for saving result (an XLS file) of SAP query in background.
I used also the ABAP commands 'OPEN DATASET', 'TRANSFER' and 'CLOSE DATASET' as described in the SAP note 537735.
The execution of SAP query generated multiple columns. But when I go to see my downloaded file (.xls), all generated columns are condensed into 1 !!!
How to save the file (.xls) and keep the separated columns, please?
Thanks for your answers.For saving the file in Excel format in the App server you have to first convert the data in XLS format and then use the transfer statement.
You can either use FM SAP_CONVERT_TO_XLS_FORMAT for that.
OR
Create a comma sepreated file which will open in excel.
open dataset file for output in text mode.
loop at itab.
concatenate itab-field1 itab-field2 itab-field2 into str
separated by ','.
transfer str to file.
endloop.
close dataset file. -
SAP Query - SQVI or SQ01 -- Implementing Group By
Hi,
Please advice on whether we can use GROUP BY and HAVING clauses in SAP Query.
For ex. I need to find all the customers in the system who have been defined for multiple company codes. In ABAP, I could do it using
Select kunnr count(*) from knb1
group by lifnr
having count(*) > 1
Is this possible to do this in SAP query?
Thanks,
AniAni P,
IN ABAP Query you can write this in under START-OF-SELECTION event.
There are 2 options for out put
1. Out in ALV format in System itself
This can be possible in RECORD PROCESSING.Here you don't have command on "main selection statement ".System will write this.
If you want to do some validations OR want to delete some records you have write logic for this here. Process will be record by record.
2.Output in Excel format.
If you want "GROUP BY or Having" write code in START-OF-SELECTION event.
Extract all the data in one final internal table.
use Function Module WS_EXCEL.
3.Output in file format in application server.
This is also you can do in START-OF-SELECTION by using
OPEN DATASETS.
For your requirement better use " START-OF-SELECTION ".
Pls. reward if useful -
ABAP Coding Help for Subtotal type output - SAP Query
I've created a SAP Query to display a stock overview by storage type using the table LQUA.
The output that I get is:
Material
Description
Plant
WHN
SLOC
Storage Type
Batch
GR Date
Available stock
2057
STRAWBERRIES
BP01
100
0088
200
0001081766
17.06.2014
225
2057
STRAWBERRIES
BP01
100
0088
200
0001081766
17.06.2014
720
2061
VOSTIZZA CURRANTS
BP01
100
0088
200
0001081272
17.06.2014
1,000
2061
VOSTIZZA CURRANTS
BP01
100
0088
200
0001081272
17.06.2014
1,000
2061
VOSTIZZA CURRANTS
BP01
100
0088
200
0001081272
17.06.2014
1,000
2061
VOSTIZZA CURRANTS
BP01
100
0088
200
0001081272
17.06.2014
1,000
I can get a subtotal for each Material, batch and GR date combination by using the ALV grid functionality.
This method adds too much clutter to my query and can't be easily manipulated in Excel afterwards for what I want. I want to condense the results down and just keep a cumulated available stock, e.g:
Material
Description
Plant
WHN
SLOC
Storage Type
Batch
GR Date
Available stock
2057
STRAWBERRIES
BP01
100
0088
200
0001081766
17.06.2014
945
2061
VOSTIZZA CURRANTS
BP01
100
0088
200
0001081272
17.06.2014
4,000
How can this be done?Hi,
Please try to use STATISTICS in your SAP Query. you can sort and add your value based on condiiton then it will be show you collect value in SQ01.
Please see the below documents for STATISTICS
https://help.sap.com/saphelp_erp2004/helpdata/en/d2/cb4263455611d189710000e8322d00/content.htm
Regards,
Prasenjit Mishra -
Difference between 2 sub-totals in SAP query
Hello Experts,
Is there any possibility to find out the difference between 2 sub-totals and display it at the bottom of the ALV output( like total) in SAP Query using SQ01.
For example: see below example(Request you to paste the below in an excel sheet for more readability).
PRZ 25.05.2011 A 007 008 01 15 10 EA 0,00 INR 0,00 INR 2,00 INR 0,00 INR
PRZ 27.05.2011 A 007 008 01 00 1 PC 10,00 INR 0,00 INR 0,20 INR 0,10 INR
PRZ 27.05.2011 A 007 008 01 00 1 PC 10,00 INR 0,00 INR 0,20 INR 0,10 INR
Sub-total 10 EA 20,00 INR 0,00 INR 2,40 INR 20 INR
2 PC
DRP 26.05.2011 WDB2020261X744924 1 PC 60,00 INR 50,00 INR 30,00 INR 0,00 INR
DRP 31.05.2011 WDB2020261X744924 1 PC 60,00 INR 50,00 INR 30,00 INR 0,00 INR
Sub-total 2 PC 120,00 INR 100,00 INR 60,00 INR 0,00 INR
Grand totals 10 EA 140,00 INR 100,00 INR 62,40 INR 20 INR
4 PC
In the same way as Grand total, Is there any possibility to find out the difference between the 2 sub-totals and display at the bottom after the Grand Totals row.
Please let me know if there is any possibility for the same.Just to update on my question.
In the sub-totals line you can see that there is 20,00 INR value which is summation of the above fields present in individual line numbers above. And the same way for the rest of the fields as well.
After calculating the sub-totals in this manned, I need to find out the difference between the subtotals and display it at the bottom of the output.
Please let me know if this is possible. -
Ask again user and pass, when download query on excel on BW3x
Dear,
When try download query at excel, ask me again user and pass, can you help me about that.
best regards
OArenasGood day,
This sounds like you are not using an anonymous user or alias users ..??
When you download into Excel, the cookie for the MIME handler is not held. This means that the system needs to verify the userid/password again. Check out the SAP Notes 516884 and 487456 - there are some other SAP Notes referenced in these that may also be helpful if you still have a problem.
Regards,
Karen -
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 ManyamHi,
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 -
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
PraveenHi,
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
VijayHi 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 -
SAP QUERY report for vendor line items
Hi
I have created a SAP QUERY report for vendor line items with fields vendor no.,vendor name,amount,company code and period.But there is one line item i donot know from wher system is getting it picked with is not in that vedor account,when i compare with fbl1n.I checked the document number too...the same doc number is twice in my query report.One with correct amount and another with wrong one.How do i chk.Where did i go wrong in creating query.I used logical database KDF.
Please advise.i chked...how do we get the amount displayed in query...it just displays amount no debit credit symbol... i have selected BSEG-DMBTR field but no -/+ sign,how is it done in query,please suggest.
Maybe you are looking for
-
HP Pavillion dv6500 hard drive replacemen​t (upgrade)
My HD just crashed and am trying to find a new (better) compatible HD to fit in my computer. Any suggestions or what specs I need to look for so it is compatible? This question was solved. View Solution.
-
Result_cache and data dictionary views
Hi, Are there any special considerations when caching the results of a function which uses data dictionary views to determine it's results? This question has popped because I have a such a result_cached function for which the result_cache objects are
-
Hi, I have a requirement where i need to pass the schema names during run time for a cursor. Is there any way I can do it for an existing cursor? For example, the idea is to pass the schema name as a parameter as mentioned below.we have set of progra
-
Help! Why won't iTunes 7.5 dowload to my pc?
I have windows xp, 512 ram, and 1.86 ghz processor. I just added more ram (from 256 to 512) hoping that would solve the problem but it hasn't. Any suggestions? I want to download some songs that require itunes 7.2 or greater. Is 7.2 available for dow
-
6gen nano doesn't like certain songs
There seems to be a problem with certain songs on my dad's 6gen nano. It plays with no problem but on certain songs it will play for about a minute, makes a "bubbling" noise then skips to another song. Can anyone help - what am I missing?? Thanks