on 02-01-2013 8:43 PM
HI ALL,
I have developed a webdynpro (ABAP) component which shows a list of attachment for a document. we have allowed some file type e.g. DOC, DOCX, TXT, XLS, PPT , PDF , MSG (Outlook File).
Now my problem is that for few file types like MSG, PPT, DOCX etc while opening it always ask to select program (like open with) and you need to select particular program each time so its annoying user. can we make any such configuration so for users no need to select supported program each and every time.
Thanks In Advance,
P$G.
You can use BDS functionality to store your content and open it directly from there. below is the sample code for getting the documents and displaying them.
DATA: all_connections_wd TYPE TABLE OF bdn_con.
DATA: lw_all_connections_wd TYPE bdn_con.
CALL FUNCTION 'BDS_ALL_CONNECTIONS_GET'
EXPORTING
* LOGICAL_SYSTEM =
classname = 'Z_CONTENT'
classtype = 'OT'
* OBJKEY =
* CLIENT = SY-MANDT
* ALL = 'X'
* NO_AL_DOCS = ' '
* NO_GOS_DOCS = 'X'
* CHECK_STATE = ' '
* IMPORTING
* COUNT =
TABLES
* SIGNATURE =
all_connections = all_connections_wd
* FRAMEWORK =
* EXCEPTIONS
* NO_OBJECTS_FOUND = 1
* ERROR_KPRO = 2
* INTERNAL_ERROR = 3
* NOT_AUTHORIZED = 4
* OTHERS = 5
.
DATA: ob_wd_document_ui TYPE REF TO cl_hap_wd_document_ui.
CREATE OBJECT ob_wd_document_ui.
lv_aid = lw_all_connections_wd-loio_id.
DATA: lv_hap_attachment_type TYPE hap_attachment_type.
lv_hap_attachment_type = lw_all_connections_wd-docuclass.
CALL METHOD ob_wd_document_ui->attachment_get_detail
EXPORTING
attachment_id = lv_aid
attachment_type = lv_hap_attachment_type
attachment_storage = 'BDS'
IMPORTING
file_content = lv_fcon
file_content_hex = lv_fchex
mime_file_type = lv_mftyp
s_return = lv_ret.
DATA:
l_file TYPE string,
l_mime TYPE string,
pdf_data TYPE xstring.
CONCATENATE 'application/' lw_all_connections_wd-docuclass INTO l_mime.
l_file = lw_all_connections_wd-comp_id .
CALL METHOD cl_wd_runtime_services=>attach_file_to_response
EXPORTING
i_filename = l_file
i_content = lv_fchex
i_mime_type = l_mime.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Prathamesh,
Try the below code. It will allow you to download all type of file
wdr_task=>client_window->client->attach_file_to_response( i_filename = ls_files-filename
i_content = ls_files-data
i_mime_type = ls_files-filetype
i_in_new_window = 'X'
i_inplace = 'X'
).
Thanks & Regards
Arun.K.P
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.