Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

HI All, Dowloading sap table data to excell to user desktop directory.

Former Member
0 Kudos

Hi All,

When user wants to download on to the excel file a dialog box has to come with the user desktop directory and with filename as .xls.

for example :

Directory : C:\Documents and Settings\<user>\Desktop

File name : .XLS

its urgent..

Thanks & Regards.

Bharat.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI,

For this you have to use 2 function modules.

The first one provides F$ help for selecting file. You can use this FM and select the location and then specify the file in name with extension .xls

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

EXPORTING

PROGRAM_NAME = SYST-REPID

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = 'P_P_SRCFIL'

CHANGING

FILE_NAME = P_P_SRCFIL

EXCEPTIONS

OTHERS = 2.

This will get the file path in to the parameter text box p_sucfil.

i_filename = p_sucfil.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = i_filename

FILETYPE = 'ASC'

WRITE_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = itab.

This will download the itab data into excel sheet .

Hope this solves the problem.

Reward points if helpful.

Thanks and regards.

1 REPLY 1

Former Member
0 Kudos

HI,

For this you have to use 2 function modules.

The first one provides F$ help for selecting file. You can use this FM and select the location and then specify the file in name with extension .xls

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

EXPORTING

PROGRAM_NAME = SYST-REPID

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = 'P_P_SRCFIL'

CHANGING

FILE_NAME = P_P_SRCFIL

EXCEPTIONS

OTHERS = 2.

This will get the file path in to the parameter text box p_sucfil.

i_filename = p_sucfil.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = i_filename

FILETYPE = 'ASC'

WRITE_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = itab.

This will download the itab data into excel sheet .

Hope this solves the problem.

Reward points if helpful.

Thanks and regards.