Cl_gui_frontend_services= gui_download
hi.
i use this method to download a table to excel file.
1.when i download i get a file with 6000K and when i open it in notepad i get it tab delimeted.
2.when i opened it and make save as new_name.xls i get 2000K and when i opened it notepad i get it not tab delimeted.
i wnat it to be as the 2. option what i nedd to do.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = file_down
filetype = 'ASC' * i change it to bin too
write_field_separator = 'X' * i made remark
CHANGING
data_tab = IT_DATA
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
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
thank oliver.
here as i seen it in notepad
method gui_download
1.12222 22222 333333
in notepad savin in excel.
2. ׀ֿ א¡± ב > u200F " ְ u200F u200F ¡
when i use MS_EXCEL_OLE_STANDARD_DAT i get it good as " 2." but it open in the screen.
Similar Messages
-
CALL METHOD cl_gui_frontend_services=>gui_download EXPORTING
filename = c:\abc.txt
filetype = 'ASC'
write_field_separator = space
HAS_FIELD_SEPARATOR = SPACE
HEADER_LENGTH = 0
DAT_MODE = SPACE
CODEPAGE = 'ASC'
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
READ_BY_LINE = 'X'
IMPORTING
FILELENGTH =
HEADER =
CHANGING
data_tab = t_pch[]
here the file abc.txt get some text as header.
butwhen i want write actual data again witht he same file name the file get over writed
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = c:\abc.txt
filetype = 'ASC'
write_field_separator = space
HAS_FIELD_SEPARATOR = SPACE
HEADER_LENGTH = 0
DAT_MODE = SPACE
CODEPAGE = 'ASC'
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
READ_BY_LINE = 'X'
IMPORTING
FILELENGTH =
HEADER =
CHANGING
data_tab = t_pc[]Hi
When second time you call method just add the following
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = v_value
append = 'X' <------- Just add this line -
Hi Guys,
I'm currently changing the programs that uses the obsolete function WS_DOWNLOAD with CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD, and I just want to ask what are the valid FILETYPE for GUI_DOWNLOAD and how can I use a WK1, XLS and DAT filetype in GUI_DOWNLOAD.Hi,
PARAMETERS p_file LIKE rlgrap-filename.
DATA lv_file TYPE string.
lv_file = p_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = lv_file
filetype = 'ASC'
write_field_separator = c_x
TABLES
data_tab = i_download
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 ne 0.
MESSAGE i000 WITH text-005. "Error in File downloded
ENDIF.
Instead of 'ASC', you can give 'WK1' or 'XLS' if you want. -
Hello experts,
The FM CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD is not working in windows 7 OS. The error is - Data provider exception. But is is ok in XP.
Is there any solution for this.
Thanks in advance,
BalajiNow
I've applyed patch 8 and no problem with CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
Have you sure you've have all authorization to write a file there?
Max -
Passing column headers in cl_gui_frontend_services= gui_download
How to pass the coulumn headers in in the internal table while down loading it to a excel file by using method cl_gui_frontend_services=>gui_download
For having the header in the same internal table, all the fields must have type C. Fill the fields with the header text and insert at index 1.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = Your file name
filetype = 'TXT'
CHANGING
data_tab = i_data
EXCEPTIONS
file_write_error = 1
no_batch = 2
Pls also refer the following Creating a comma delimited(.csv)file
Thanks
Vinod -
Hello,
we are using cl_gui_frontend_services=>gui_download to create from an itab an excel file.
We face the issue that in this excel file german special characters like Ä, Ü, Ö, ß are not displayed correctly.
I think we need to use a different codepage. But which one?
could you please give us a short coding example how to call cl_gui_frontend_services=>gui_download.
Thanks a lot
Kind regards
ManfredHi,
Check the system is unicode or non-unicode . Codepage for Unicode system is ' 4102' and non-unicode is '1100'.
Below are the sample code for the GUI_download with Class.
DATA: l_filename TYPE string,
l_filen TYPE string,
l_path TYPE string,
l_fullpath TYPE string,
l_usr_act TYPE I.
l_filename = SPACE.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
DEFAULT_FILE_NAME = l_filename
CHANGING
FILENAME = l_filen
PATH = l_path
FULLPATH = l_fullpath
USER_ACTION = l_usr_act
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4.
IF sy-subrc = 0
AND l_usr_act <>
CL_GUI_FRONTEND_SERVICES=>ACTION_CANCEL.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = l_fullpath
FILETYPE = 'DAT'
TABLES
DATA_TAB = T_DOWNL
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.
ENDIF.
Edited by: Sumodh P on May 11, 2010 5:24 PM -
Cl_gui_frontend_services= gui_download without carriage return
Hi,
Is there a way to get download a file to PC that way, that in the end of every lines there is a carriege return character except the last one? (Special format required by az external bank application)
I tried to add carriage return to every lines, except the last one and use cl_gui_frontend_services=>gui_download.
Although the "write_lf" parameter is set to space, the # is still inserted in the end of the last lines.
Any suggestion, idea?
Thanks in advance,
PeterHi
When second time you call method just add the following
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = v_value
append = 'X' <------- Just add this line -
Hello,
we are using the method cl_gui_frontend_services=>gui_download to store files on the presentation front end (Windows Vista with UAC).
When the user has no windows rights to the target directory and UAC is active, then the method gui_download stores the file in other directory (C:\Users\<USER_NAME>\AppData\Local\VirtualStore\Windows) and returns with sy-subrc = 0.
In our opinion this is a critical problem but SAP doesn't want to correct it.
What do you think about it?
regards,
KrisHello kpsgoutam ,
thank you for your post but it's not an answer for my question. I know how to use 'gui_dowload'. The problem is, it works wrong with UAC and target directory, where you have no rights to write the file.
Consider following code:
REPORT ztest.
DATA:
" to reproduce the problem the UAC must be active
" and you can't have write rights to the target directory
lv_filename TYPE string VALUE 'c:\windows\test.txt',
lt_data TYPE TABLE of string,
lv_data TYPE string,
lv_outlen TYPE i.
lv_data = 'Some test content'.
APPEND lv_data TO lt_data.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = lv_filename
IMPORTING
filelength = lv_outlen
changing
data_tab = lt_data
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
not_supported_by_gui = 22
error_no_gui = 23
others = 24.
WRITE: / 'sy-subrc =', sy-subrc. " error: with active UAC the sy-subrc is 0
regards,
Kris -
Hi SDN's,
Can u tell me how to get headers when we download data to excel with using (we are using DBF as file type in the following method )
CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
(We can't use GUI_DOWNLOAD)
Thanks in advance..
BRHi,
I m giving u a bdc code i hope ur prob ll be solved.
*& Report ZDTK_BDC_LT01
*& PROGRAME TITLE : LT01
*& AUTHOR : D TARUN KUMAR
*& MM CONSULTANT : Mr. MRINMOYE CHAKRABORTY
*& REQUEST NO. : RD1K901995
*& TRANSACTION ID : ZLT01
*& PACKAGE : ZTARUN
*& DESCRIPTION : BDC REPORT TO UPLOAD INITIAL STOCK POSTING AND
*& STORAGE BINS THROUGH LT01.
REPORT ZDTK_BDC_LT01
no standard page heading line-size 255.
TYPE-POOLS: TRUXS.
STRUCTURE DECLARATION
TYPES : BEGIN OF TY_UPLOAD,
LGNUM(3),
BETYP(1),
BENUM(10),
BWLVS(3),
MATNR(18),
BISMT(18),
ANFME(16),
WERKS(4),
LGORT(4),
CHARG(10),
LETYP(10),
VLTYP(3),
VLBER(3),
VLPLA(10),
VLQNR(10),
NLTYP(3),
NLBER(3),
NLPLA(10),
NLQNR(10),
END OF TY_UPLOAD.
INTERNALTABLE & WORKAREA DECLARATION
DATA : T_UPLOAD TYPE STANDARD TABLE OF TY_UPLOAD,
T_BDCDATA TYPE STANDARD TABLE OF BDCDATA,
T_BDCMSGCOLL TYPE STANDARD TABLE OF BDCMSGCOLL,
W_UPLOAD TYPE TY_UPLOAD,
W_BDCDATA TYPE BDCDATA,
W_BDCMSGCOLL TYPE BDCMSGCOLL,
GLOBLE DECLARATION
G_FLNAME TYPE STRING,
G_MESSAGE(70) TYPE C,
IT_RAW TYPE TRUXS_T_TEXT_DATA,
GLOBLE DECLARATION
WA_OPT TYPE CTU_PARAMS.
WA_OPT-UPDMODE = 'A'.
WA_OPT-DEFSIZE = 'X'.
WA_OPT-DISMODE = 'A'.
SLECTION SCREEN DECLARATION
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN SKIP 2.
PARAMETER : P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN : END OF BLOCK B1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
PERFORM GET_FILENAME.
START-OF-SELECTION.
PERFORM UPLOAD_DATA.
*PERFORM GET_FINAL.
*PERFORM GET_MIGO.
PERFORM SESSION.
*PERFORM TEST.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR W_BDCDATA.
W_BDCDATA-PROGRAM = PROGRAM.
W_BDCDATA-DYNPRO = DYNPRO.
W_BDCDATA-DYNBEGIN = 'X'.
APPEND W_BDCDATA TO T_BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> NODATA.
CLEAR W_BDCDATA.
W_BDCDATA-FNAM = FNAM.
W_BDCDATA-FVAL = FVAL.
APPEND W_BDCDATA TO T_BDCDATA.
ENDIF.
ENDFORM.
*& Form GET_FILENAME
TEXT
FORM GET_FILENAME .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE'
IMPORTING
FILE_NAME = P_FILE
ENDFORM. " GET_FILENAME
*& Form UPLOAD_DATA
text
form UPLOAD_DATA .
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER = 'X'
I_TAB_RAW_DATA = IT_RAW
I_FILENAME = P_FILE "WORK TABLE
TABLES
I_TAB_CONVERTED_DATA = T_UPLOAD[] "ACTUAL DATA
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
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. " UPLOAD_DATA
*& Form SESSION
text
FORM SESSION .
*sort t_upload by bismt.
LOOP AT T_UPLOAD INTO W_UPLOAD.
REFRESH T_BDCDATA.
*CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = W_UPLOAD-CHARG
IMPORTING
OUTPUT = W_UPLOAD-CHARG .
*CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = W_UPLOAD-VLBER
IMPORTING
OUTPUT = W_UPLOAD-VLBER .
*CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = W_UPLOAD-NLTYP
IMPORTING
OUTPUT = W_UPLOAD-NLTYP .
*CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = W_UPLOAD-NLBER
IMPORTING
OUTPUT = W_UPLOAD-NLBER .
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = W_UPLOAD-CHARG
IMPORTING
OUTPUT = W_UPLOAD-CHARG .
DATA : BWLVS(3),
LGORT(4),
WERKS(4),
CHARG(10),
LETYP(10),
VLTYP(3),
VLBER(3),
VLPLA(10),
VLQNR(10),
NLTYP(3),
NLBER(3),
NLQNR(10).
DATA : W_MATNR(18).
*SELECT SINGLE MATNR FROM MARA INTO W_MATNR
WHERE BISMT = W_UPLOAD-BISMT.
BWLVS = '999'.
LGORT = '3500'.
WERKS = '1030'.
LETYP = 'E1'.
VLTYP = '998'.
VLBER = '001'.
VLPLA = 'AUFNAHME'.
NLTYP = '354'. "(packaging material)
*NLTYP = '353'. "(spareparts material)
NLBER = '001'.
*include bdcrecx1.
*start-of-selection.
*perform open_group.
perform bdc_dynpro using 'SAPML03T' '0101'.
perform bdc_field using 'BDC_CURSOR'
'LTAP-CHARG'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LTAK-LGNUM'
W_UPLOAD-LGNUM. "'350'.
perform bdc_field using 'LTAK-BENUM'
W_UPLOAD-BENUM. "'1000000000'.
perform bdc_field using 'LTAK-BETYP'
W_UPLOAD-BETYP. "'P'.
perform bdc_field using 'LTAK-BWLVS' BWLVS. "'999'.
perform bdc_field using 'LTAP-MATNR'
W_upload-MATNR. "'40000009'.
perform bdc_field using 'RL03T-ANFME'
W_UPLOAD-ANFME. "'1,000'.
perform bdc_field using 'LTAP-WERKS' WERKS. "'1030'.
perform bdc_field using 'LTAP-CHARG'
w_upload-charg.
perform bdc_dynpro using 'SAPML03T' '0102'.
perform bdc_field using 'BDC_CURSOR'
'LTAP-NLPLA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RL03T-ANFME'
W_UPLOAD-ANFME. "'1,000'.
*perform bdc_field using 'LTAP-ALTME'
'KG'.
perform bdc_field using 'LTAP-LETYP' LETYP. "'E1'.
*perform bdc_field using 'LTAP-CHARG' W_UPLOAD-CHARG. "'0000000101'.
perform bdc_field using 'LTAP-VLTYP' VLTYP. "'998'.
perform bdc_field using 'LTAP-VLBER' VLBER. "'001'.
perform bdc_field using 'LTAP-VLPLA' VLPLA. "'AUFNAHME'.
perform bdc_field using 'LTAP-NLTYP'
W_UPLOAD-NLTYP. "'351'.
perform bdc_field using 'LTAP-NLBER' NLBER. "'001'.
perform bdc_field using 'LTAP-NLPLA'
W_UPLOAD-NLPLA. "'01 00 01'.
*perform bdc_transaction using 'LT01'.
*perform close_group.
CALL TRANSACTION 'LT01' USING T_BDCDATA
MODE 'A'
UPDATE 'A'
OPTIONS FROM WA_OPT
MESSAGES INTO T_BDCMSGCOLL.
IF SY-SUBRC <> 0.
READ TABLE T_BDCMSGCOLL INTO W_BDCMSGCOLL INDEX 1.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = 'EN'
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = G_MESSAGE
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
WRITE : / W_upload-matnr ,'-----' , G_MESSAGE.
REFRESH T_BDCMSGCOLL.
ENDIF.
ENDIF.
*clear : w_matnr, w_upload.
ENDLOOP.
ENDFORM. " SESSION -
Hi,
I want to replace FM GUI_DOWNLOAD with CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD in one of our old program, however parameter FIELDNAMES is used, and this parameter is no longer available in CL_GUI_FRONTEND_SERVICES.
Any idea is there any other parameter for this? HEADER might be, but I don't think so, as it has a different purpose in FM 'GUI_DOWNLOAD' also.
Thanks in advance,
PeterHi Peter
One work around will be to use the method twice,
first to download the header to file and then in append
mode to download the data.
Kind Regards
Eswar
Message was edited by: Eswar Rao Boddeti -
Getting error while using cl_gui_frontend_services= gui_download
Hi Experts,
I am using class method cl_gui_frontend_services=>gui_download for downloading a file and i getting an error that of type compatible of internal table with formal parameter DATA_TAB of class cl_gui_frontend_services. My code is as follow -
DATA: filename_string TYPE string VALUE 'c:\data\testdw.txt'.
TYPES : BEGIN OF y_citibank,
data(1028) TYPE c,
END OF y_citibank.
DATA : t_citibank TYPE STANDARD TABLE OF y_citibank.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = filename_string
FILETYPE = 'ASC'
changing
data_tab = t_citibank
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
NOT_SUPPORTED_BY_GUI = 22
ERROR_NO_GUI = 23
others = 24.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Please let me know, how can i overcome this error.
Thanks in advance,
Akash SawantHi,
Pass t_citibank[] instead of t_citibank in the CALL METHOD.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = filename_string
FILETYPE = 'ASC'
changing
data_tab = <b>t_citibank[]</b>
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
NOT_SUPPORTED_BY_GUI = 22
ERROR_NO_GUI = 23
others = 24.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Sri
Message was edited by:
Sri Tayi -
Hello all,
I'm trying to run a report that uses the method cl_gui_frontend_services=>gui_download in background mode, to export data from an internal table to a xml file.
In foreground everything works fine, but when I try to run the report in background the execution stops when the method is called. Does anyone know how to avoid this problem and run the report in background mode?
Thanks in advance,
Nuno A.Hi,
For background processing you need to use syntax
OPEN DATASET
ld_file = p_infile.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
ELSE.
DO.
CLEAR: wa_string, wa_uploadtxt.
READ DATASET ld_file INTO wa_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
APPEND wa_upload TO it_record.
ENDIF.
ENDDO.
CLOSE DATASET ld_file.
ENDIF.
aRs -
Cl_gui_frontend_services= gui_download and logical path issue
Hi all!!
I'm downloading a table with this class/method, and when i have worked with a LOCAL folder, it worked fine, but now, i need to put the file into a server folder. So i get the logical path in this way:
10.20.xx.xx
but when i pass the filename to the method: v_filename = '
10.20.xx.xx\file.txt' the file is not generated into this folder.. and i have permission to access and modify this folder..
Thanks for your feedbak!If you need transfer each record of the table (I suppose itab with header line):
LOOP AT itab.
TRANSFER itab TO file_path
ENDLOOP.
Note: All of fields in itab must be character-type if the file was opened as a text file.
Other example:
OPEN DATASET '/usr/sap/tmp/ztest.txt' FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
TRANSFER zdepmentt TO '/usr/sap/tmp/ztest.txt'.
ENDIF.
CLOSE DATASET '/usr/sap/tmp/ztest.txt'.
Here the content of the data object (flat structure) "zdepmentt" is transferred to the application server file '/usr/sap/tmp/ztest.txt'.
Note: The file ztest.txt is automaticaly created. -
Add double quotes (") surrounding each field in GUI_DOWNLOAD
Experts,
Does anyone know if it is possible to add double quotes (") to all fields in .txt file using FM GUI_DOWNLOAD besides manually concatenate the quotes into each field before calling the FM?
For example, output need to be:
"0000123" "NAME1" " 200.00"
Any advice is greatly appreciated.
Best regards,
MinamiIf you are interested, here is a complete solution.
report zrich_0001.
data: it001 type table of t001.
data: xt001 type t001.
data: iflatf type table of string.
data: xflatf type string.
data: filename type string.
data: field_value type string.
field-symbols: <fs>.
* Selection Screen
selection-screen begin of block b1 with frame title text-002 .
parameters: p_file type localfile default
'C:Test.txt'.
selection-screen end of block b1.
start-of-selection.
select * into table it001 from t001.
loop at it001 into xt001.
do.
assign component sy-index of structure xt001 to <fs>.
if sy-subrc <> 0.
exit.
endif.
concatenate '"' <fs> '"' into field_value.
if sy-index = 1.
xflatf = field_value.
else.
concatenate xflatf field_value into xflatf separated by space.
endif.
enddo.
append xflatf to iflatf.
endloop.
filename = p_file.
call method cl_gui_frontend_services=>gui_download
exporting
filename = filename
filetype = 'ASC'
changing
data_tab = iflatf.
Regard,
Rich Heilman -
Using Gui_download for excel output
Hi,
I am using gui_download to output in excel format, my requirement is i want to start records from 3rd row in excel.
On first row first column title shoud come? Second row blank, i used fieldname for header in export paramenter from 3rd row.
Plz help me to sove this issue.
Thanks in advance.
Vishnu.Hi vishnu,
Here is the sample code below.
*& Report ZVK_TEST1
REPORT zvk_test1.
TYPES:BEGIN OF ty_ekko,
ebeln TYPE ekko-ebeln,
bukrs TYPE ekko-bukrs,
END OF ty_ekko.
TYPES:BEGIN OF ty_fields,
field TYPE dd03l-fieldname,
END OF ty_fields.
DATA:lt_ekko TYPE STANDARD TABLE OF ty_ekko,
lt_dummy TYPE STANDARD TABLE OF ty_ekko.
DATA:lw_ekko TYPE ty_ekko.
APPEND INITIAL LINE TO lt_dummy.
APPEND INITIAL LINE TO lt_dummy.
SELECT ebeln bukrs INTO TABLE lt_ekko
FROM ekko UP TO 10 ROWS.
DATA:lt_fields TYPE TABLE OF ty_fields,
lw_field TYPE ty_fields.
lw_field-field = 'PO NUMBER'.
APPEND lw_field TO lt_fields.
lw_field-field = 'COMPANY CODE'.
APPEND lw_field TO lt_fields.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize =
filename = 'C:\Documents and Settings\krishnavatte\Desktop\kris.xls'
filetype = 'ASC'
CHANGING
data_tab = lt_dummy
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
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize =
filename = 'C:\Documents and Settings\krishnavatte\Desktop\kris.xls'
filetype = 'ASC'
append = 'X'
write_field_separator = 'X'
fieldnames = lt_fields
CHANGING
data_tab = lt_ekko
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
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Maybe you are looking for
-
I have lighroom on my older computer, which my daughter is borrowing, and I need to download it onto my new computer. I do not need to transfer my previous files, I just want to start fresh on my new computer. How do I do this?
-
My itunes wont play the movie ive rented it just comes up with a black screen why?
cccc
-
LightRoom 2 (Windows XP) - Preference File
I have just noticed that Lightroom 2 in Windows XP has slowed down somewhat and I believe that it may be due to the preference file having to be trashed. Could someone please advise me as to where I can find the preference file in Windows for Lightro
-
Hi I have the following problem ... I have created a pdf document, and also added javasqript ... so I can not edit this document in acrobat LiveCycle must change the security settings .... where can i edit the settings ??? 4 Example a picture of my
-
Possible to turn off MBP Sleep Light?
The sleep light on my MBP is bright. The pulsing can actually wake me up. Is it possible to turn it off? The iMac G5 got a "Sleep Indicator Light" update that turns it off at night. I'm not sure if it's configurable or not, but even if it's not, the