05-26-2008 1:20 PM
Is there an alternative way in BW 7.0 to export data from a query to a CSV-file on the application server without using the open hub-functionality?
08-11-2008 12:02 PM
08-29-2008 11:46 AM
Hi Nikhil,
Could you please solve my problem?
I am trying to download it as a CSV file (local and unix files), but when i get the data in excel , the issue occurs is:
F1 F2 F3
OU Code OU Name OU Description
0000010000 0000010000-PG/US/PRIM CARE
0000010001 0000010001-PG/US/APOTH COMMODIT APOTHECON COMMODITY
note: in the first line iam getting as F1,F2 & F3. i dont want these to come, rest all iam getting it perfectly.
For downloading it i used the below code:
&----
*& Form DOWNLOAD_FILE
&----
text
-
--> p1 text
<-- p2 text
-
FORM DOWNLOAD_FILE .
**Add column headers
clear x_out_prctr.
x_out_prctr-prctr = 'OU Code'.
x_out_prctr-ktext = 'OU Name'.
x_out_prctr-ltext = 'OU Description'.
x_out_prctr-OUTNAME = 'OU Type Name'.
x_out_prctr-OTNAME = 'Organization Type Name'.
x_out_prctr-POUCODE = 'Parent OU'.
x_out_prctr-STATUS = 'Status'.
x_out_prctr-OUOUNAME = 'OU Owner'.
x_out_prctr-OUAUNAME = 'OU Assistant'.
x_out_prctr-OUCUNAME = 'OU Controller'.
x_out_prctr-OUMRUNAME = 'OU MSP Rep'.
Insert x_out_prctr into it_out index 1.
Insert x_out_prctr into it_out1 index 1.
clear x_out_prctr.
**
IF p_local = c_x.
perform gui_download.
elseif p_unix = c_x.
open dataset p_file for output in text mode encoding non-unicode
ignoring conversion errors.
if sy-subrc = 0.
*-For Profit Center
loop at it_out into x_out_prctr.
transfer x_out_prctr to p_file.
if sy-subrc ne 0.
write:/ 'Error writing file'(011), p_file.
stop.
endif.
endloop.
endif.
Close dataset
close dataset p_file.
endif.
ENDFORM. " DOWNLOAD_FILE
&----
*& Form GUI_DOWNLOAD
&----
text
-
--> p1 text
<-- p2 text
-
FORM GUI_DOWNLOAD .
DATA : lv_fname TYPE string.
CLEAR lv_fname.
lv_fname = p_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = lv_fname
FILETYPE = 'DBF'
TABLES
DATA_TAB = it_out
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " GUI_DOWNLOAD
Regards,
Shalini