Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

passing dynamic internal table into ALV

I have made one ALV report where i had created one button 'GENERATE'. ON CLICKING THIS BUTTON the data in the ALV report is downloaded to excel file.

i have used this:-

CALL METHOD cl_gui_frontend_services=>file_save_dialog

EXPORTING

window_title = l_title

default_extension = 'XLS'

initial_directory = 'C:\'

CHANGING

filename = filename

path = path

fullpath = fullpath

user_action = user_action

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

not_supported_by_gui = 3

OTHERS = 4.

IF sy-subrc <> 0.

EXIT.

ENDIF.

  • Check which button is pressed

IF user_action <> cl_gui_frontend_services=>action_ok.

EXIT.

ENDIF.

  • Download error data collected from the internal table

CALL METHOD cl_gui_frontend_services=>gui_download

EXPORTING

filename = fullpath

filetype = 'ASC'

write_field_separator = '#'

  • codepage = '4103'

  • write_bom = c_true

CHANGING

data_tab = gi_final

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

not_supported_by_gui = 22

error_no_gui = 23

OTHERS = 24.

  • If selection is successful

IF sy-subrc EQ 0.

MESSAGE s004 . " File created successfully

ELSE.

MESSAGE i005 . " File is not created successfully

ENDIF.

In the table i have passed the internal table . this is working fine.

<b>But,

The problem is if i want to display the data in diferent layout based on selection screen criteria the data downloaded are same as default layout.

how to pass a dynamic internal table in the

CALL METHOD cl_gui_frontend_services=>gui_download</b>

Former Member
Not what you were looking for? View more on this topic or Ask a question