05-29-2008 10:34 AM
in selection screen i am having two radio button option
1) display the result in alv grid format
2) download the result to local desktop
if i sellect first it will show the alv display if i select 2nd it will download the data to local desktop (using GUI_download fn)
now i got one problem, in selection screen i am having option to select the layout for ALV output.
now user wants , if he select the layout and opt the 2nd one it should download the file as the given layout
format , is it possible?
please help me on this issue.
Thanks in advance
05-29-2008 10:36 AM
Yes it is possible...
For that you have to populate layout in ur internal table .
& by using GUI_DOWNLOAD or WS_DOWNLOAD function module you can do it..
Edited by: swarup basagare on May 29, 2008 11:36 AM
05-29-2008 10:36 AM
Yes it is possible...
For that you have to populate layout in ur internal table .
& by using GUI_DOWNLOAD or WS_DOWNLOAD function module you can do it..
Edited by: swarup basagare on May 29, 2008 11:36 AM
05-29-2008 10:38 AM
05-29-2008 10:42 AM
LOOP AT ifinal.
MOVE: ifinal-SLNO TO IT_EXCEL_LAYOUT-SLNO ,
ifinal-HERST TO IT_EXCEL_LAYOUT-HERST ,
ifinal-QMNUM TO IT_EXCEL_LAYOUT-QMNUM ,
ifinal-QERDAT TO IT_EXCEL_LAYOUT-QERDAT ,
ifinal-AUFNR TO IT_EXCEL_LAYOUT-AUFNR ,
APPEND IT_EXCEL_LAYOUT.
ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:\filename.xls'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
SHOW_TRANSFER_STATUS = ABAP_TRUE
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = IT_EXCEL_LAYOUT[]
FIELDNAMES =
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 <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
05-29-2008 10:42 AM
LOOP AT ifinal.
MOVE: ifinal-SLNO TO IT_EXCEL_LAYOUT-SLNO ,
ifinal-HERST TO IT_EXCEL_LAYOUT-HERST ,
ifinal-QMNUM TO IT_EXCEL_LAYOUT-QMNUM ,
ifinal-QERDAT TO IT_EXCEL_LAYOUT-QERDAT ,
ifinal-AUFNR TO IT_EXCEL_LAYOUT-AUFNR ,
APPEND IT_EXCEL_LAYOUT.
ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:\filename.xls'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
SHOW_TRANSFER_STATUS = ABAP_TRUE
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = IT_EXCEL_LAYOUT[]
FIELDNAMES =
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 <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
05-29-2008 11:08 AM
hi thanks ,
but my requirement is not like this i need to download the file as like layout which is saved by the user that is saved in ALV . i want to retrive the layout and i want to modify my internal table according to that then i have to download
for ex , user having 3 layouts saved in ALV like std, new, test
1)std
having the field alignment like
matnr, matkl,maktx,BISMT,ZEIAR
2) new
having the field alignment like
matnr,maktx,ZEIAR
3)test
having the field alignment like
matnr,maktx,ZEIAR,maktx,BISMT
if user select the layout new , then the download fields should be like following
matnr,maktx,ZEIAR
and one more scenario
user can save layout at any time he needs
and the program should retrive the layout then it should download the file like that
please help me to do this
05-29-2008 11:12 AM
Hi,
For your requirement, check box only used and not the radio button because the end user may need both.
so place to two check box and first check the check box for download. If its 'X' then call the GUI_DOWNLOAD.
Finally check the check box for ALV output. If its 'X' then call the REUSE_ALV_GRID_DISPLAY.
Regards,
Raghu
05-29-2008 10:42 AM
Hai,
In ALV display in menu bar click
List -
> Export -
> Local File -
> Excel file -
> Give the file path to Popo up window. -
> Enter.
Thanks,
Durai.V