Application Development and Automation 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: 
Read only

Using WS_DOWNLOAD

Former Member
0 Likes
1,911

hi ,

i have used WS_DOWNLOAD to download my data . i wnat to include the fields name of these data into excel files.?

TABLES

DATA_TAB = IFINAL1 " this is ur contents

FIELDNAMES = .

where ifinal1 is my internal table.

hi ,

i have used WS_DOWNLOAD to download my data . i wnat to include the fields name of these data into excel files.?

TABLES

DATA_TAB = IFINAL1 " this is ur contents

FIELDNAMES = .

where ifinal1 is my internal table.

7 REPLIES 7
Read only

Former Member
0 Likes
1,197

Declarate internal table to store field names.

call ws_download : Pass the header internal table, it create the file with header names.

now call ws_download again and pass the second internal table.

here for paratemers MODE pass 'A' it will append the values to the already created file.

Read only

Former Member
0 Likes
1,197

hi,

create a internal table type similar to that in ws_download and poulate it with your field names

Read only

0 Likes
1,197

could u show me how to poulate the fields name in the first of internal table that should have the fields name.

best regared,

Ali

Read only

Former Member
0 Likes
1,197

HI,

!st do not use ws_download , its obsulute stmt in sao,use

CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD method

Even if u are using ws_download then for filed name put them in one table and usin the abv fm ws_download, then when dowloading the values use the ab FM ws_download with MODE as append.

Regards,

Vaibhav B Gawali.

Read only

Former Member
0 Likes
1,197

import filetype must be 'DAT' to get field names

Read only

Former Member
0 Likes
1,197

Hi ali,

1. Download internal table with field names as headings !

2.

a) Use GUI_DOWNLOAD fm instead of WS_DOWNLOAD.

b) we have to write some extra logic, to Fetch the field names

3. Just copy paste to get a taste of it.

report abc.

*----


data : itab like table of t001 with header line.

*----


select * from t001 into table itab.

perform mydownload tables itab using 'D:\t001.txt'.

*----


  • INDEPENDENT FORM

*----


form mydownload tables ptab using filename.

*----


DAta

DATA : components LIKE rstrucinfo OCCURS 0 WITH HEADER LINE.

DATA : allfields(300) TYPE c.

DATA : fld(100) TYPE c.

data : begin of htab occurs 0,

allfields(300) type c,

end of htab.

*----


Get component list

CALL FUNCTION 'GET_COMPONENT_LIST'

EXPORTING

program = sy-repid

fieldname = 'ITAB'

TABLES

components = components.

*----


construct

LOOP AT components.

CONCATENATE components-compname

CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB INTO fld.

CONCATENATE allfields fld INTO allfields .

ENDLOOP.

htab-allfields = allfields.

append htab.

*----


download first field list

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

FILENAME = 'D:\t001.txt'

WRITE_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = htab

.

*----


then download file data

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

FILENAME = filename

APPEND = 'X'

WRITE_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = ptab

.

endform.

regards,

amit m.

Read only

0 Likes
1,197

could i use WS_Download to download txt file.

if yes i want to be downloaded in a prober formate- not mixed fields