Question on cl_gui_frontend_services= file_save_dialog
Hi all,,, need your help.. thank you i n ad vance ..
why ist tht happen? the default extension, 'txt'
but the "save as type" in the dialog box shows 'XLS', excel file ??
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = 'Save file to'
DEFAULT_EXTENSION = 'txt'
default_file_name = v_filename
INITIAL_DIRECTORY = 'c:\'
CHANGING
filename = t_file
path = ld_path
fullpath = ld_fullpath
user_action = ld_result.
you can do in this way....
in this case default is 'XLS' and he can choose all the files.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = l_title
default_extension = 'XLS'
file_filter = ' '
CHANGING
fullpath = l_fullpath
path = l_path
filename = l_filename
EXCEPTIONS
OTHERS = 1.
Regards
Vijay
Similar Messages
-
Question for cl_gui_frontend_services= file_save_dialog
Hi Expert.
I made simple test page.
there is nothing but this code in oninitlization
* event handler for data retrieval
DATA: ld_filename TYPE string,
ld_path TYPE string,
ld_fullpath TYPE string,
ld_result TYPE i.
* Display save dialog window
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
* window_title = ' '
DEFAULT_EXTENSION = 'XLS'
default_file_name = 'accountsdata'
INITIAL_DIRECTORY = 'c:temp'
CHANGING
filename = ld_filename
path = ld_path
fullpath = ld_fullpath
* Check user did not cancel request
CHECK ld_result EQ '0'.
and that shows
"method:FILE_SAVE_DIALOG ,line : 164
An attempt was made to execute a dynamic method callon an initial(NULL-) object reference. The reference must refer to an object."
why this error caught?
Did I miss something or made mistake BSP code above?
should I create some object before call cl_gui_frontend_services=>file_save_dialog?
I don't have any clue on this.
help me please. thanks .Oh yes - this most certainly will not work from BSP. This class and any other that uses the control framework are written as proxy objects to code that actually executes as part of the SAPGui on the client machine.
BSP is completly web centric. Its output can only be ran in a browser. To the browser the output of BSP doesn't look any different than any other web page that might come from ASP, JSP, PHP, etc.
Also because BSP runs in a browser - the amount of interaction that can occur with the client (particularly around file downloads) is somewhat limited. There is no file download element or a file save as dialog object. There are other ways to attach content to an HTTP Response or place it in a hidden iFrame - the browser is then responsible for intrepting this information and offering the file save as or open dialog based upon the appropriate MIME Type.
This weblog is the primer on BSP downloads written by the Jedi Master himself:
<a href="/people/mark.finnern/blog/2003/09/23/bsp-programming-handling-of-non-html-documents:///people/mark.finnern/blog/2003/09/23/bsp-programming-handling-of-non-html-documents
If you search you will find other examples in the older BSP weblogs as well. -
hi all, i'm using the: cl_gui_frontend_services=>file_save_dialog class and method..
My question, how can i do for RESTRICT the file extension of the file JUST to '.txt' ?? if the user select the name of the file to create to 123.pdf -for example- that the system don't let him to continue, or just add the txt extension to the final of the filename.. -like 123.pdf.txt ??
Thanks!!Hi Pampeano,
i I have created a small code snippet :-
LV_FILENAME TYPE STRING,
LV_FULLPATH TYPE STRING,
LV_PATH TYPE STRING,
LV_ACTION TYPE I,
LV_FILE TYPE STRING,
DEFAULT_EXTENSION TYPE STRING.
if DEFALUT_EXTENSION ne 'TXT'.
eRROR ........
ENDIF.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
WINDOW_TITLE = 'Please select the location'
DEFAULT_EXTENSION = DEAFAULT_EXTENSION
DEFAULT_FILE_NAME = LV_FILE
FILE_FILTER = '*.TXT'
CHANGING
FILENAME = LV_FILENAME
PATH = LV_PATH
FULLPATH = LV_FULLPATH
USER_ACTION = LV_ACTION
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
OTHERS = 3.
Regards
Abhii
Edited by: Abhii on Aug 17, 2010 7:44 AM
Edited by: Abhii on Aug 17, 2010 7:44 AM
Edited by: Abhii on Aug 17, 2010 7:44 AM
Edited by: Abhii on Aug 17, 2010 7:46 AM -
Hello Experts,
Is there a way to disable the 'Cancel' button in method 'FILE_SAVE_DIALOG' of class
cl_gui_frontend_services? Because in our requirement, the saving of the file is mandatory.
Thank you guys and take care!HI, Viraylab
Use the Logic Bellow it will solve out your problem, using following you must provide a file name other wise after selecting Cancel button this dialog will appear again.
PERFORM save_dialog.
*& Form save_dialog
* text
FORM save_dialog.
DATA: filename TYPE string,
path TYPE string,
fullpath TYPE string.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = 'Select File Name'
CHANGING
filename = filename
path = path
fullpath = fullpath
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF filename IS INITIAL.
PERFORM save_dialog.
ENDIF.
ENDFORM. "save_dialog
Please Reply if any Issue,
Best Regards,
Faisal -
Hi Guys,
I am saving Invoice Output type into local PDF file and using CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG to give user the choice where to save the file. It gives an abap short dump "Access not possible using 'NULL' object reference". and update is terminated in the same method.
I think output types are executing in Update Taks.
It's working fine when used in other programs(Normal)
Suggestions are Welcome. Thanks! Vijender
The code is :
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
WINDOW_TITLE = 'Save PDF File'
DEFAULT_EXTENSION = 'PDF'
DEFAULT_FILE_NAME = LV_NAME_INIT
FILE_FILTER = '*.PDF'
INITIAL_DIRECTORY = 'C:'
PROMPT_ON_OVERWRITE = 'X'
CHANGING
FILENAME = LV_FNAME
PATH = LV_PATH_FOLDER
FULLPATH = LV_FILE_NAME
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.HI, Viraylab
Use the Logic Bellow it will solve out your problem, using following you must provide a file name other wise after selecting Cancel button this dialog will appear again.
PERFORM save_dialog.
*& Form save_dialog
* text
FORM save_dialog.
DATA: filename TYPE string,
path TYPE string,
fullpath TYPE string.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = 'Select File Name'
CHANGING
filename = filename
path = path
fullpath = fullpath
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF filename IS INITIAL.
PERFORM save_dialog.
ENDIF.
ENDFORM. "save_dialog
Please Reply if any Issue,
Best Regards,
Faisal -
CALL METHOD cl_gui_frontend_services= file_save_dialog
Hi,
I want to use 'CALL METHOD cl_gui_frontend_services=>file_save_dialog', to choose a path for saving my txt files. I only want the user to be able to choose the path and not have to supply a filename aswell. My filenames are standard in the program and I don't want them to be changed by the user.
Is there another method which is designed for this or is there a simple parameter I have missed?
Thanks and regards,
Simon.AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_f.
PERFORM f_search_help_pa_f1.
FORM f_search_help_pa_f1 .
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = sy-repid
dynpro_number = sy-dynnr
CHANGING
file_name = pa_f
EXCEPTIONS
mask_too_long = 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. " f_search_help_pa_f1
Try this
Regards -
Cl_gui_frontend_services= file_save_dialog?
Hi All,
Im trying to use the below method, what are all the parameters need to fill and hw to declare those parameters.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION =
DEFAULT_FILE_NAME =
FILE_FILTER =
INITIAL_DIRECTORY =
WITH_ENCODING =
PROMPT_ON_OVERWRITE = 'X'
CHANGING
filename =
path =
fullpath =
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Puppy.Hi ,
copy this code and try this , after executing this code ypu will get the path into " lv_fullpath " .
and then pass this lv_fullpath to next function module like gui_download .
DATA: v_name TYPE string,
v_file TYPE rlgrap-filename,
lv_filename TYPE string,
lv_filen TYPE string,
lv_path TYPE string,
lv_fullpath TYPE string.
* MOVE v_name TO lv_filename.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
* WINDOW_TITLE =
* DEFAULT_EXTENSION =
* default_file_name = lv_filename
* WITH_ENCODING =
* FILE_FILTER =
* INITIAL_DIRECTORY =
* PROMPT_ON_OVERWRITE = 'X'
CHANGING
filename = lv_filen
path = lv_path
fullpath = lv_fullpath
* USER_ACTION =
* FILE_ENCODING =
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
Aby. -
APPEND cl_gui_frontend_services file_save_dialog
Hi,
with old functions DOWNLOAD it was possible to append a file to an existing,
how can I do this using method file_save_dialog of the class cl_gui_frontend_services?
Please help me!
Thanks
LaraHello Lara,
file_save_dialog doesn't have this option but gui_download from cl_gui_frontend_services has it (append).
Regards, Martin -
Hi,
In sap gui was trigered action whih is using smartform and then output was being downloaded and saved as using:
CALL FUNCTION 'GUI_DOWNLOAD' - to
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
After the ubgrade this action is not working in web ui.
Anyone knows how to change this to work in web ui?
Thank you in advanceHi Tanja Lukovic
Pls check the settings defined in the SPRO path CRM->Basic settings->actions under this select your relevant application area and check whether any start/schedule conditions are not met (check in conditions) , apart from this reason there could be other reasons also pls check the trigger processing type (it should be smart form print).
if the actions are already created , you can change actions and conditions.
Thanks & Regards
Raj -
About file_save_dialog and gui_download
Hello experts,
I have made a report wherein I can let the users download the report to their PC. Now, they want it in such a way that they don't have to 'maximize' the width for each column so the data can be read clearly. Also, they want it to be defaulted in excel format.
below are the codes:
DATA: file_name TYPE string,
file_path TYPE string,
full_path TYPE string,
act TYPE i,
var1 TYPE string.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
CHANGING
filename = file_name
path = file_path
fullpath = full_path
user_action = act
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
*NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF act = 0.
var1 = full_path.
p_file = var1.
ENDIF.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = var1
filetype = 'ASC'
write_field_separator = 'X'
CHANGING
data_tab = it_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 <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Again, thank you guys and take care!Hi,
Check this in that case....
REPORT testexcel .
INCLUDE ole2incl.
DATA: application TYPE ole2_object,
workbook TYPE ole2_object,
sheet TYPE ole2_object,
cells TYPE ole2_object.
CONSTANTS: row_max TYPE i VALUE 256.
DATA index TYPE i.
DATA: BEGIN OF itab1 OCCURS 0,
first_name(10),
last_name(10),
END OF itab1.
START-OF-SELECTION.
itab1-first_name = '123445'.
itab1-last_name = 'tesst'.
append itab1.
clear itab1.
itab1-first_name = '123446'.
itab1-last_name = 'tesst'.
append itab1.
clear itab1.
CREATE OBJECT application 'excel.application'.
SET PROPERTY OF application 'visible' = 1.
CALL METHOD OF application 'Workbooks' = workbook.
CALL METHOD OF workbook 'Add'.
* Create first Excel Sheet
CALL METHOD OF application 'Worksheets' = sheet
EXPORTING #1 = 1.
CALL METHOD OF sheet 'Activate'.
SET PROPERTY OF sheet 'Name' = 'Sheet1'.
LOOP AT itab1.
index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name
CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.
SET PROPERTY OF cells 'Value' = itab1-first_name.
index = index + 1. " 1 - column name
CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.
SET PROPERTY OF cells 'Value' = itab1-last_name.
ENDLOOP.
* Save excel speadsheet to particular filename
CALL METHOD OF sheet 'SaveAs'
EXPORTING #1 = 'c:tempexceldoc1.xls' "filename
#2 = 1. "fileFormat
Regards
vijay -
Cl_gui_frontend_services
How it possible to download file to excel with the column header by using the class cl_gui_frontend_services
Hi,
Please go through the following Thread hope will help you out,
[Download Data Into Excel File |Re: download data into excel file]
[Regarding CL_GUI_FRONTEND_SERVICES|Regarding CL_GUI_FRONTEND_SERVICES]
[CALL METHOD cl_gui_frontend_services=>file_save_dialog|Re: CALL METHOD cl_gui_frontend_services=>file_save_dialog]
Kind Regards,
Faisal -
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 -
HOW TO USE Class Interface CL_GUI_FRONTEND_SERVICES
Dear All,
I am working to get output of SMARTFORMS through report into PDF file.Following code i am using inside LOOP.
*CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION = 'PDF'
DEFAULT_FILE_NAME = 'PAYSLIP.pdf'
WITH_ENCODING =
FILE_FILTER =
INITIAL_DIRECTORY =
PROMPT_ON_OVERWRITE = 'X'
CHANGING
FILENAME = W_FILE_NAME
PATH = W_FILE_PATH
FULLPATH = W_FULL_PATH
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4
*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 FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_BIN_FILESIZE
FILENAME = W_FILE_NAME
FILETYPE = 'BIN'
TABLES
DATA_TAB = T_PDF_TAB.
*IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
I am getting proper output through the above coding.
But problem is,if there will be a multiple PDF output it always ask the path to save each PDF file as i am using "FILE_SAVE_DIALOG"
I want all PDF files to save at once by giving default path of PC.
How can i do this, is there any other method i can use please
let me know...
Regards,
AnkurHi,
I have used following code..
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize =
filename =
filetype = 'ASC'
append = SPACE
write_field_separator = SPACE
header = '00'
trunc_trailing_blanks = SPACE
write_lf = 'X'
col_select = SPACE
col_select_mask = SPACE
dat_mode = SPACE
confirm_overwrite = SPACE
no_auth_check = SPACE
codepage = SPACE
ignore_cerr = ABAP_TRUE
replacement = '#'
write_bom = SPACE
trunc_trailing_blanks_eol = 'X'
wk1_n_format = SPACE
wk1_n_size = SPACE
wk1_t_format = SPACE
wk1_t_size = SPACE
IMPORTING
filelength =
changing
data_tab = T_PDF_TAB
but the error it is giving that "T_PDF_TAB is not a compatible type". -
Hello,
I would like to set the file extension for cl_gui_frontend_services=>file_open_dialog such that my default extension in the file open dialogue is the .csv (comma-separated value) file. May I know how can I do that?
Thanks!
Regards,
AnyiHello,
Thanks for the quick reply.
Howeer, I tried to use the extension of CSV and the file dialogue opened up with .RTF (which is the default extension) instead.
Any comment on that?
Thanks!
Anyi
> HI,
>
> Here is the code
>
DATA: l_title TYPE string,
> l_dfext TYPE string,
> l_dfinm TYPE string,
> l_file TYPE string,
> l_path TYPE string,
> l_fpath TYPE string.
> le = 'SAVE FILE PATH'.
> l_dfext = 'csv'.
> l_dfinm = 'Error_Idoc'.
>
> CONCATENATE l_dfinm sy-datum sy-uzeit INTO l_dfinm
> SEPARATED BY '_'.
>
> CONCATENATE l_dfinm l_dfext INTO l_dfinm SEPARATED
> BY '.'.
>
> CALL METHOD
> cl_gui_frontend_services=>file_save_dialog
> EXPORTING
> window_title = l_title
> default_extension = l_dfext
> default_file_name = l_dfinm
> INITIAL_DIRECTORY = L_DIR
> CHANGING
> filename = l_file
> path = l_path
> fullpath = l_fpath
> CEPTIONS
> cntl_error = 1
> error_no_gui = 2
> OTHERS = 3.
> s,
> Richa -
GUI_DOWNLOAD - fieldnames does not exist
Hi All,
I have managed to sort out the format of my question, so I have closed the other post and started a fresh
I am wondering if you can help in anyway, I am trying to create a datafile and dump it to a PC, so far I use the cl_gui_frontend_services=>file_save_dialog to allow the user to specify the file location and this does indeed create the file, what I really need are column heading added to the file.
I have search around and it seems that I have to pass FIELDNAMES to cl_gui_frontend_services=>gui_download.
I have created the headers and insterted the field FIELDNAMES but get an error saying :
Formal Parameter FIELDNAMES does not exist.
Also I really need the fieldnames to be created by myself as a couple of the column types are the same and that would confuse the users.
Here is the code I use.
TYPES: BEGIN OF t_fieldnames_structure, " Structure for table of internal fieldnames
col_text(10) TYPE c,
END OF t_fieldnames_structure.
DATA: lw_filename TYPE string, " For file_save_dialog to store the filename
lw_path TYPE string, " For file_save_dialog to store the filepath
lw_fullpath TYPE string, " For file_save_dialog to store the full path
lw_save_result TYPE i, " For file_save_dialog to store the user input, cancel, save.....
li_fieldnames TYPE TABLE OF t_fieldnames_structure, " Internal table for the fieldnames
lwa_fieldnames LIKE LINE OF li_fieldnames. " Work area for the fieldnames internal table
lwa_fieldnames-col_text = 'MATNR'.
APPEND lwa_fieldnames TO li_fieldnames.
" Display the file save dialog
cl_gui_frontend_services=>file_save_dialog(
EXPORTING
window_title = 'Data unload'
default_extension = 'TXT'
default_file_name = 'GLD-datadump'
initial_directory = 'c:\temp\'
CHANGING
filename = lw_filename
path = lw_path
fullpath = lw_fullpath
user_action = lw_save_result
IF sy-subrc <> 0.
ENDIF.
IF lw_save_result = 0.
" User wants the data to be saved
" Write the file to the desired destination
cl_gui_frontend_services=>gui_download(
EXPORTING
filename = lw_filename
filetype = 'DAT'
write_field_separator = 'X'
CHANGING
data_tab = i_simulation_structure
fieldnames = li_fieldnames
EXCEPTIONS
file_write_error = 1
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.
ENDIF. " User wants the data to be saved
If you have any ideas how I can achieve this it would be great.
Thanking you in advance
IanHi,
i would first download the header then the data with append.
here a short example:
TYPES: BEGIN OF TY_HEAD,
MATNR(18),
MTART(04),
END OF TY_HEAD.
TYPES: BEGIN OF TY_MARA,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
END OF TY_MARA.
DATA: IT_MARA TYPE TABLE OF TY_MARA.
DATA: IT_HEAD TYPE TABLE OF TY_HEAD.
DATA: WA_HEAD TYPE TY_HEAD.
WA_HEAD-MATNR = 'Material'.
WA_HEAD-MTART = 'Mart'.
APPEND WA_HEAD TO IT_HEAD.
SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE IT_MARA UP TO 10 ROWS.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME = 'C:MATNR.TXT
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
CHANGING
DATA_TAB = IT_HEAD[].
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME = 'C:MATNR.TXT
FILETYPE = 'ASC'
APPEND = 'X'
WRITE_FIELD_SEPARATOR = 'X'
CHANGING
DATA_TAB = IT_MARA[].
regards, Dieter
Sorry Rajvansh,
i have just see, that you post the idea before.
Regards, Dieter
Edited by: Dieter Gröhn on Jun 7, 2011 11:39 AM
Maybe you are looking for
-
I deleted all my photos and videos and then delete the deleted files but the photo app is still taking up 12 GB of space and I have no room for new stuff. How can I clear the memory space used by my deleted videos and photos? I don't know why the p
-
VL31N: multiple item Inbound is not allow
Dear experts, I have customer's requirement: In VL31N, there is only 1 PO is refer. It means inbound delivery is single item, multiple item Inbound is not allow, could you know how to do or any user exit support to do that. Thanks
-
How can I bring a process to the foreground?
I work in a manufacturing facility, and I'm working on developing a system to send process related notifications to assembly line workers. Events in an Oracle database trigger the display and use the UTL_TCP package to send a message containing a URL
-
If this has already been addressed, I apologize. I just wasn't entirely sure how to phrase this to see if anyone else was having this problem. For the past several months, my iBook G4 (2005) has been freaking out at random intervals. What do I mean b
-
Hi! I have a desktop "iMac" and a "macbook". I use the same user ID. I installed after purchasing 'Facetime" on my macbook. But, I can't buy and install the same on my iMac. If, I don't want to change my Apple ID, (I think it must be the issue) how c