Processing:
The processing to implement the user-exit is as below:
First create a Project through transaction CMOD say ZSQFILE .
Then use enhancement assignment to include SQUE0001 SAP Query: Private data file
Further implement the user-exit EXIT_RSAQEXCE_001 in the component section .
Click on Include ZXQUEU01 to create it and then implement the given code. Please change the 'SharedFileDirectoryName' to replace with your shared directory ( Directory that you should be able to see / configure through transaction AL11 )
Activate the user- exit.
Now Run SQ01 ( Background or foreground ) and select 'Private file' ( and not File Store ) on the selction screen. Further it will download the results in a file on folder as specifird in the code as .
Please understand that a parameter can't be provided for file name, it will be downloaded as the description name of the query <.txt >. As it is, it will create a tab separated file.
ABAP Code:
Code:
*&---------------------------------------------------------------------*
*& Include ZXQUEU01 *
*&---------------------------------------------------------------------*
* Implemented by: Ram Manohar Tiwari
* Presented by : www.rmtiwari.com
* Function : Enhancement SQUE0001 : SAP Query - Private Data File
* User-Exit FM : EXIT_RSAQEXCE_001
* to download the SQ01 Query Results on application
* server as tab separated data file.
*----------------------------------------------------------------------*
class cl_abap_char_utilities definition load.
DATA : lv_file_name LIKE rlgrap-filename.
DATA : empty(1),
fcnt TYPE i,
fpos TYPE i,
cfpos TYPE i,
feld(1000).
DATA: BEGIN OF ldata OCCURS 100.
INCLUDE STRUCTURE rsaqldata.
DATA: END OF ldata,
maxpos TYPE i.
FIELD-SYMBOLS: <feld>,
<cfeld>.
DATA: l_pos TYPE i.
data: l_length type i,
l_number(3) type n,
l_pos_f type i.
constants: bufferlength type i value 1024.
constants: lc_tab type X value '09'.
REFRESH ldata.
LOOP AT datatab.
CLEAR ldata.
maxpos = 0.
fcnt = 0.
LOOP AT listdesc WHERE lid = list_id.
fcnt = fcnt + 1.
IF fcnt <> 1.
l_pos = maxpos + 1.
IF l_pos > bufferlength.
APPEND ldata.
CLEAR ldata.
maxpos = 0.
ENDIF.
ENDIF.
fpos = listdesc-flpos.
ASSIGN COMPONENT fpos OF STRUCTURE datatab TO <feld>.
WRITE <feld> TO feld.
SHIFT feld LEFT DELETING LEADING space.
l_length = strlen( feld ).
l_number = l_length.
l_pos_f = maxpos + l_length + 1.
if l_pos > bufferlength.
append ldata.
clear ldata.
maxpos = 0.
endif.
IF fcnt <> 1.
concatenate ldata CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
feld into ldata.
else.
concatenate ldata
feld into ldata.
ENDIF.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.