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

down load

Former Member
0 Likes
462

Hi ,

I have a requirement that i have to place my header and line item bownloaded in the same excel sheet .Can any one say me

1) Do i have to take header in one internal table and the line item in the other internal table .

2) what is the function module to do the above .

Thank you .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
440

Method 1)

You can pass the names of the fields in the table : FIELDNAMES in the fm: GUI_DOWNLOAD

Method 2)

You have to pass the names of the fields as a single record in DATA_TAB for the first time and then open the same file in append mode using the actual data passed in data_tab in the function moduel GUI_DOWNLOAD

call function 'GUI_DOWNLOAD'

TABLES

data_tab = itab. "itab has only names

call function 'GUI_DOWNLOAD'

exporting

APPEND = 'X'

TABLES

data_tab = itab. "itab has the data

Regards,

ravi

Message was edited by:

Ravi Kanth Talagana

3 REPLIES 3
Read only

Former Member
0 Likes
441

Method 1)

You can pass the names of the fields in the table : FIELDNAMES in the fm: GUI_DOWNLOAD

Method 2)

You have to pass the names of the fields as a single record in DATA_TAB for the first time and then open the same file in append mode using the actual data passed in data_tab in the function moduel GUI_DOWNLOAD

call function 'GUI_DOWNLOAD'

TABLES

data_tab = itab. "itab has only names

call function 'GUI_DOWNLOAD'

exporting

APPEND = 'X'

TABLES

data_tab = itab. "itab has the data

Regards,

ravi

Message was edited by:

Ravi Kanth Talagana

Read only

0 Likes
440

u can use code like this to download file with header line via gui_download -

DATA: full_file_name TYPE string,

z_akt_filesize TYPE i .

full_file_name = p_file.

PERFORM fill_colnames .

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = full_file_name

FILETYPE = 'DAT'

NO_AUTH_CHECK = c_x

CODEPAGE = '1160 '

TABLES

DATA_TAB = p_daten[]

FIELDNAMES = col_names[]

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 e016 WITH 'Download-Error; RC:' sy-subrc.

ENDIF.

&----


*& Form fill_colnames

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fill_colnames .

clear : col_names .

col_names-line = 'Pers.No.'.

append col_names.

col_names-line = 'First Name'.

append col_names.

col_names-line = 'Last Name'.

append col_names.

col_names-line = 'BirthDate'.

append col_names.

col_names-line = 'Hier. Entry'.

append col_names.

col_names-line = 'From'.

append col_names.

col_names-line = 'To'.

append col_names.

col_names-line = 'From-To'.

append col_names.

col_names-line = 'Company'.

append col_names.

col_names-line = 'Org Unit'.

append col_names.

col_names-line = 'Position'.

append col_names.

col_names-line = 'JG'.

append col_names.

col_names-line = 'PG'.

append col_names.

col_names-line = 'Band Information'.

append col_names.

ENDFORM. " fill_colnames

Read only

Former Member
0 Likes
440

are you using

REUSE_ALV_HIERSEQ_LIST_DISPLAY

then you have the option there itself

else use

FM GUI_DOWNLOAD

here you can pass only one internal table.

regards

shiba dutta