2010 Mar 10 3:21 AM
Hi all,
i want to display through a report.in the output i want to keep one push button
if i select that pushbutton,the data need to download into the text file format.
please help me how to do this.
regards,
swami.
Hi all,
i want to display through a report.in the output i want to keep one push button
if i select that pushbutton,the data need to download into the text file format.
please help me how to do this.
regards,
swami.
2010 Mar 10 4:40 AM
Hi,
Create on PF-Status with one button. Set this PF-Status in your report.
Behind this button, code the functionality to download the internal table using various methods/FM's given by SAP.
Hope this helps you.
Regards,
Tarun
2010 Mar 10 4:45 AM
hi,
for this you have to create the PF-STATUS in which you define all you custom button functionality and on the click of the custom which you define say DOWNLOAD, write code to download the data need to download into the text file format.
hope this helps
Regards
RItesh
2010 Mar 10 4:50 AM
WHEN 'DOWNLOAD'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\FILE1.TXT'
FILETYPE = 'ASC'
APPEND = 'X'
WRITE_FIELD_SEPARATOR = ';'
TABLES
DATA_TAB = ITAB
2010 Mar 10 4:51 AM
Hi,
After including your button in the pf status of your program,
in the user command event of your report you can check the
function code of that button included and call function module:
GUI_DOWNLOAD to download text file.
Hope it helps
Regards,
Mansi
2010 Mar 10 4:53 AM
Hi...
you need to declare radio buttons in the selection screen like
selection-screen : begin of block b2 with frame title text-to2.
parameters : p_r1 radiobutton group g1,
p_r2 radiobutton group g1,
p_r3 radiobutton group g1,
p_path type rlgrap-filename.
selection-screen: end of block b2.
per example if customer selects p_r1 radio button and execute the report then u need to write code for alv display.
if customer selects p_r2 radio button and execute the report then u need to write code for grid display.
if customer selects p_r3 radio button and execute the report then u need to write code for normal display.
if customer gives p_path and execute the report then u need to write code for downloading the data created to specific location in the format like .txt, .xls etc.
Hope this is helpful. please get back to me if you need any assistance
Regards,
Lokeswari.
2010 Mar 10 4:57 AM
Hi,
If you are using ALV for output display then do the below things.
1 Create a new PF status ---> SET PF-STATUS '' STATUSNAME" (Name Mention here)
2. In the REUSE_ALV FM in the Exporting Parameters STATUS = '' Mention Your Status".
3. When the output is displayed check your button will appear.
4. When you click the button using the AT USER-COMMAND event build your logic.
5 . For download use the below FM
CALL Function gui_download
EXPORTING
filename = gd_file
filetype = 'DAT'
CHANGING
data_tab = ITAB
EXCEPTIONS
OTHERS = 1.
If you are using normal list display
in the evenet AT USER-COMMADN
Call the FM to download.
2010 Mar 10 5:17 AM
Hi,
You can do it without setting PF-STATUS also..............after display of your output,you can save the output from LIST->SAVE/SEND->FILE....
If ALV report then you can save it from LIST->Export->Local File.
Regards,
Sarbajit.
2010 Mar 10 6:44 AM
Hi,
In program you can do like below
1)
top-of-page.
format color 6.
write: ' >>Click here to Download... <<' hotspot on.
format color off.
2)
at line-selection.
data : fid(20) type c.
get cursor field fid.
if fid = ' '.
perform generate_l_file_xl.
endif.
3)
form generate_l_file_xl .
call function 'GUI_FILE_SAVE_DIALOG'
exporting
default_extension = 'txt'
importing
filename = filename
path = path
fullpath = fullpath
user_action = user_action.
call function 'GUI_DOWNLOAD'
exporting
filename = filename
filetype = 'ASC'
write_field_separator = 'X'
trunc_trailing_blanks = 'X'
trunc_trailing_blanks_eol = 'X'
tables
data_tab = ITAB
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.
else.
message s071(dmee) with filename.
endif.
endform.
Regards
Nehruu
2010 Mar 10 7:32 AM
2010 Mar 10 12:44 PM
Hi Swami
Use this code for download data.
and use SET-PF STATUS to create pushbutton, and assign this code to pushbutton function.
DATA: P_FILE TYPE RLGRAP-FILENAME."file upload path
DATA: IT_EXCEL TYPE TRUXS_T_TEXT_DATA. "for move data to in_raw to main internal table
DATA : G_FILENAME TYPE STRING.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
IMPORTING
FILE_NAME = P_FILE.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = P_FILE " EXCEL FILE PATH
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
APPEND = 'X'
TABLES
DATA_TAB = IT_DATA[]
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 'A file could not be written' TYPE 'I'.
ENDIF.
it will work.
Regards,
Abhilash
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |