cancel
Showing results for 
Search instead for 
Did you mean: 

Using GUI_DOWNLOAD

Former Member
0 Kudos

Hi Experts,

i am able to save the file on local disk but if i am trying to save another one it's replacing the first file. i know methods where in i can save any number of files at

runtime. actually i am trying to save mini statements(banking software) so i want

these files to be saved with their respective account no or names of the concerned person.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
* using below code u can get the account no as filename

loop at it_accounts.

p_filename = it_accounts-accounts.

     CALL FUNCTION 'GUI_DOWNLOAD'.
          filename = p_filename

endloop.
Former Member
0 Kudos

Hi,

How can i find that where the file is getting stored.

Former Member
0 Kudos

hi,

check the path which is given in the gui_download option.

and also the idea of naresh is an excellent one and probably an apt to the current scenario wat u have said.

Former Member
0 Kudos

Hi Vipin,

<b>* This method of file download with check uses the latest techniques

  • and achieves a very neat solution

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

user_action = ld_result.

  • Check user did not cancel request

CHECK ld_result EQ '0'.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = ld_fullpath

filetype = 'ASC'

  • APPEND = 'X'

write_field_separator = 'X'

  • CONFIRM_OVERWRITE = 'X'

TABLES

data_tab = it_datatab[] "need to declare and populate

EXCEPTIONS

file_open_error = 1

file_write_error = 2

OTHERS = 3.</b>

Former Member
0 Kudos

In filename i am passing p_filename not the path.

So could you please tell that how can i define path for the file.

p_filename = it_accounts-accounts.

CALL FUNCTION 'GUI_DOWNLOAD'.

filename = p_filename

Former Member
0 Kudos

hi,

CONCATENATE p_filename 'SY-DATUM sy-time INTO p_filename.

jst before the func module call write the above stmt and ur problem is solved

Former Member
0 Kudos

hi vipin...

example--

p_filename contains <b>C:\Documents and Settings\nreddy\Desktop\SAP_install_latest.xxx</b> so wht i mean to say is change this name dinamically to avoid u r problem...

suppose u have file on deskto OUTPUT.XXX.

u r program is replacing the existing file.. so u wanto avoid this. am i right?

if yes chage the file name..OUTPUT.xxx to OUTPUT123.xx like that,,,

but u need to do this with out u r interference at run time that why i have give the above solution..

try to omplement the solutions .. then u r problem willbe solve...

Former Member
0 Kudos

hi vipin.

follow the following code

contants: lc_path(8) value 'C:\durga',

lc_date(10) value sy_datum,

lc_time(5) value sy_uzeit,

lc_pdf(4) value '.PDF'.

concatenate lc_path lc_date lc_time lc_pdf into p_filename.

now pass the p_filename to the fm.

Former Member
0 Kudos

THX Naresh,

I got the desired output.

Answers (3)

Answers (3)

Former Member
0 Kudos

probaly u r giving the same name every time...

so u need to change the name every time

use this statement

V_PATH is the file path u r using..

   CONCATENATE V_PATH 'xxx' SY-DATUM sy-time INTO P_FLNAM.

by conatnating this every second the file name will be changed.... so the existing one will be safe

Former Member
0 Kudos

Hi vipin,

If the file names are same then it replace the existing file. So try changing the file names.

Former Member
0 Kudos

hi Vipin,

Try changing the filename with an account number dynamcally.

Regards,

santosh