on 03-05-2019 5:21 PM
Hello,
We have a batch job which calls a query. The batch when compeleted stores the output in a spool.
Now customer need a change that when the batch job is finished, an excel file is also stored with the same output as spool output.
How to achieve this ?. Can Through ABAP, we can read spool and convert it into excel. If yes, how to code this and where ?
regards
Sonu
You have the extension SQUE0001 (function module EXIT_RSAQEXCE_001, include ZXQUEU01) to process the SAP query output at the moment it is generated. It receives a table with columns from the SAP query, so it's much more simple to process than the spool data which is not structured.
You may also use the function module RSAQ_REMOTE_QUERY_CALL with parameter DATA_TO_MEMORY = 'X'.
Maybe you can intercept the ALV data produced by the query, by using the class CL_SALV_BS_RUNTIME_INFO.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sachin Arora Try intercepting the query data with CL_SALV_BS_RUNTIME_INFO, and call CL_SALV_BS_TT_UTIL=>IF_SALV_BS_TT_UTIL~TRANSFORM to generate the Excel file. Search the forum for examples.
It's feasible to read a spool in ABAP and it's feasible to create an Excel file. This can be easily confirmed in Google.
However, at this time you might want to start questioning whether this approach is still a good idea or you'd be better off just converting query into a custom ABAP program.
If for some odd reason you'd prefer to stick with a query and a "wrapper" program to create a file then, technically, you don't have to go through spool. Query is generated as an ABAP report too, so technically you could just run it from a program, read the created list from memory and then create Excel thus avoiding all the spool overhead. Use Google.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Jelena. My ABAP resource says that it is not possible to create an Excel from Spool. Only PDF can be created from Spool.
Pls can you advise which is the optimum way to create an excel sheet. we need to store excel sheet ina directory. I have heard that excel sheet will not come in proper format ?
rgds
sachin
sachin.arora4 - Google -> "read spool into internal table site:sap.com" -> hundreds of hits.
Sorry, I don't understand the inquiry about "excel sheet". Sheet is part of a worksheet in Excel and the whole worksheet is written into a file.
I'd suggest to get a knowledgeable ABAP consultant on this. It's not a matter of a quick SCN question. Please also note Sandra's answer.
User | Count |
---|---|
95 | |
9 | |
8 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.