on 08-18-2015 11:34 AM
Hello Experts,
We have ESS Leave application built using Java web dynpro, but the leave records will be sent to SAP server using some custom function module.
Recently we got a requirement to attach files while creating a leave request. We implemented GOS(Generic Object Services) functionality. So attached file from java webdynpro will be converted to a XSTRING and sent to the SAP server. I can save and retrieve the file content in the SAP server. Now the problem is i am unable to display the file content.I cannot use cl_wd_runtime_services=>attach_file_to_response since it can only work with ABAP Webdynpro. So the function module dumps. Pls suggest.
Any suggestion is highly appreciated.
Thanks
Vivek
Hi vivek,
I don't understand what does ' i am unable to display the file content' but you can create cm object for order. if u have binary content of your file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Vivek,
I believe ı can help you.
1. Create a button and his action on webdynpro.
2. Then create a simple zcomponenet and call it like a popup
3. create z sicf service
4. In your zcomponenet in .htm part call this sicf serivce with header guid like
lv_item_url = cl_crm_web_utility=>create_url( iv_path = '/sap/crm/zcrm_doc'
iv_absolute = 'X'
iv_query = lv_query
iv_in_same_session = ''
iv_no_cookie = 'X'
"iv_server_object = server
).
5. in your webservice
method IF_HTTP_EXTENSION~HANDLE_REQUEST.
DATA: lv_guid_s TYPE string,
lv_guid TYPE comt_product_guid,
lv_item_guid TYPE comt_product_guid,
lt_content TYPE zcrm_document_cont_tab,
ls_content TYPE zcrm_document_cont,
lv_value TYPE string,
xstring TYPE xstring,
lv_size TYPE i.
***************************************************************************************
***************************************************************************************
CALL METHOD server->request->get_form_data
EXPORTING
name = 'guid'
CHANGING
data = lv_guid_s.
lv_guid = lv_guid_s.
clear lt_content.
lt_content = zcrm_document_tools=>get_document_content( iv_guid = lv_guid ).
IF lt_content is not INITIAL.
LOOP AT lt_content INTO ls_content WHERE mime_type = 'image/jpeg' OR mime_type = 'image/png'.
ENDLOOP.
CHECK sy-subrc EQ 0.
DATA: lv_dummy TYPE string,
lv_ext TYPE string,
lv_mime_type TYPE string.
SPLIT ls_content-mime_type AT '/' INTO lv_dummy lv_ext .
CONCATENATE 'attachment; filename=export_' lv_guid_s '.' lv_ext INTO lv_value.
server->response->set_header_field( name = 'Content-Disposition' "#EC NOTEXT
value = lv_value ).
* -> create response
lv_mime_type = ls_content-mime_type.
server->response->set_header_field( name = 'Content-Type' "#EC NOTEXT
value = lv_mime_type ).
server->response->set_header_field( name = 'expires' "#EC NOTEXT
value = '0' ).
lv_size = ls_content-filesize.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = lv_size
* FIRST_LINE = 0
* LAST_LINE = 0
IMPORTING
buffer = xstring
TABLES
binary_tab = ls_content-content
* EXCEPTIONS
* FAILED = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
IF xstring is not INITIAL .
server->response->set_data( data = xstring ).
ENDIF.
else.
CLEAR xstring.
ENDIF.
6. it will return you your file url and open it in your htm.
Simply you can display file with url of it. There is other ways to create url you can search.
Hi acar atmaca,
Thanks for your reply.
" Create a button and his action on webdynpro." .
As of now we only call the RFC function module to save the leave application details. Now u want me to call a ABAP webdynpro application from JAVA webdynpro. But how do i pass the data(For Example: Leave Number) to ABAP webdynpro application. Can u pls send me the info.
Thanks,
Vivek
Hi vivek ,
'So attached file from java webdynpro will be converted to a XSTRING and sent to the SAP server. '
After this sentences ı understood u want display document from Sap. I cant help with java part.
What ı done is in Sap Crm system ı create url with content of document and display it with url.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.