09-24-2008 11:42 AM
Hi Gurus,
I want to display the data that i fetched to internal table in msword.means i want to see the output in msword.please provide me the sample code.
09-24-2008 11:48 AM
Hi,
Use GUI_DOWNLOAD function module. give filename as
<filename>.doc
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'D:\flight.doc' "<----extension for Msword file
filetype = 'ASC'
Regards
Abhijeet
09-24-2008 11:48 AM
Hi,
Use GUI_DOWNLOAD function module. give filename as
<filename>.doc
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'D:\flight.doc' "<----extension for Msword file
filetype = 'ASC'
Regards
Abhijeet
09-24-2008 11:52 AM
Hi Abhi,
transfer the data means i want to see the data in msword when i press execute button.i think i have to use OLE.but i dont have much knowledge on that.if you know how to please tell me.
09-24-2008 11:55 AM
Hi,
Check this sample code, by this code data of internal table will be downloaded in MSWORD file with name Flight.
REPORT z_FILE_DOWNLOAD.
DATA: w_name(90) TYPE c.
DATA:
BEGIN OF fs_flight,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
price LIKE sflight-price,
currency LIKE sflight-currency,
END OF fs_flight.
DATA:
t_flight LIKE
TABLE OF
fs_flight.
SELECT-OPTIONS:
s_carrid FOR fs_flight-carrid.
START-OF-SELECTION.
SELECT carrid
connid
fldate
price
currency
FROM sflight
INTO TABLE t_flight
WHERE carrid IN s_carrid.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'D:\flight.doc'
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
tables
data_tab = t_flight
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 EQ 0.
MESSAGE 'Download successful' TYPE 'S'.
ELSE.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards
Abhijeet
09-24-2008 12:10 PM
Hi,
Use the code below to download and show in word.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'c:\file.doc'
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
tables
data_tab = itab_data.
IF sy-subrc eq 0.
CALL FUNCTION 'GUI_RUN'
EXPORTING
command = 'WINWORD'
PARAMETER = 'c:\file.doc'.
ENDIF.
Regards
Karthik D
09-24-2008 12:18 PM
Hi Karthik,
This is help me.But it is creating a file in clients system.i want to display the output in msword without saving the data.
Thnaks for your response.
09-24-2008 12:23 PM
If you dont want the file just give the file path to temp folder.
But i think what you need cannot be done without storing the file in the system.
Regards
Karthik D
09-24-2008 12:24 PM
Hi Karthik,
If i use the path like "D:\file" it will work if we have d drive.otherwise it will not .we are not sure that the client will have the same drives.please check it once.
09-24-2008 12:41 PM
Hi,
Use the following FM to get file name& path from the user before the above said function modules and assign the lv_filename to GUI_DOWNLOAD and GUI_RUN Fms.
data : lv_filename TYPE string,
lv_path TYPE string,
lv_fullpath TYPE string.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = 'Save as'
default_extension = 'doc'
default_file_name = 'file.doc'
file_filter = '*.doc'
prompt_on_overwrite = 'X'
CHANGING
filename = lv_filename
path = lv_path
fullpath = lv_fullpath
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
This will show the file save dialog box and get the path from the user.
Regards
Karthik D
09-24-2008 11:53 AM
hii
we can download data in to .txt or .xls and .doc using gui_download FM.also try using
POPUP_AND_DOWNLOAD_FOR_WORD
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = 'C:\Documents and Settings\Desktop\twi1.doc'
filetype = 'ASC'
* APPEND = ' '
* write_field_separator = 'X'
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
regards
twinkal
09-24-2008 12:09 PM
HELLO
YOU WANT TO DOWNLOAD WORD FILE USE FM - GUI_DOWNLOAD IN FILE NAME PARAMETER WHERE YOU GIVE PATH THERE U GIVE (.DOC AT LAST).
HOPE THIS WILL HELP YOU.
09-24-2008 12:41 PM
Hi,
use OLE in abap. In Tcode DWDM you find some example.
Regards, Dieter