on 09-21-2009 8:30 AM
Hi ,
I have an internal table of type string .
Internal table contains Report Output .
when i am trying to display the data in a view ..the spaces between text has been removed.
I need to dispay internal table data as it is.
I tried with the UI elements : TextView, Text Editor and Table
With TextEditor i alomost got the required output but still some alignment is missing because of spaces between text.
Please help me in this issue.
Thanks and regards,
Sravan.
I guess one question is why is your data in the internal table as a string and with no column separators. Do you have any control over the creation of the internal table? There really isn't a UI element in Web Dynpro that will be able to display that very well. If the data was at least tab delimited or something like that, you could display it via Excel.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas,
Thank you for reply.
Actually my reqiurement is to display standard ABAP reports ( clasical and ALV ) in webdynpro .
For that i got the report output into internal table ( of type string ) using funtion modules : LIST_FROM_MEMORY
and LIST_TO_ASCI.
I need to dispaly this internal table as it is in the view .
Thanks & Regards,
sravan.
Well there is no UI element that will work directly with what comes out of LIST_TO_ASCII, but I came up with a couple of options for you.
First is to conver the list to HTML and display it in an iFrame. See example:
http://www.flickr.com/photos/tjung/3945747776/
For this you use function module WWW_HTML_FROM_LISTOBJECT. The only drawback to this solution is the current situation with the iFrame UI element. The iFrame was deprecate and is removed via a later support package in 7.0 and 7.01. However the iFrame will return to full support in 7.02 next year. If it weren't for the strange status of the iFrame UI element, this would be an obvious solution. If you really wanted to go this route, you could always use two iViews in the Portal and have the List HTML content displayed in the second iView as a BSP application. Or take the risk with the iFrame UI element, that the element might be removed at a future SP application (but will return by 7.02).
Second option is to modify the output of the LIST_TO_ASCII. The colums are separated by |. You can replace the | with CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB and then you have output that is ready to export to Excel:
See Example:
http://www.flickr.com/photos/tjung/3945747864
It would be possible to even dynamically manipulate this LIST_TO_ASCII content (following a similar approach) into a dynamic internal table and using WDDOMODIFYVIEW create a Table UI element to display it. You would lose your data types, value help, etc - but could display the data tabular. I'm just afraid that is more time than I have to experiment with it right now.
Source code for the conversion to HTML:
DATA listobject TYPE STANDARD TABLE OF abaplist.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject.
data html type STANDARD TABLE OF W3HTML.
call function 'WWW_HTML_FROM_LISTOBJECT'
TABLES
html = html
listobject = listobject.
data lx_html type xstring.
lx_html = CL_BCS_CONVERT=>txt_to_xstring( it_soli = html ).
****Create the cached response object that we will insert our content into
data: cached_response type ref to if_http_response.
create object cached_response
type
cl_http_response
exporting
add_c_msg = 1.
* cached_response->set_compression( options = cached_response->IF_HTTP_ENTITY~CO_COMPRESS_IN_ALL_CASES ).
try. " ignore, if compression can not be switched on
call method cached_response->set_compression
exporting
options = cached_response->co_compress_based_on_mime_type
exceptions
others = 1.
catch cx_root.
endtry.
****set the data and the headers
data: l_app_type type string.
cached_response->set_data( lx_html ).
l_app_type = 'text/html'.
cached_response->set_header_field( name = if_http_header_fields=>content_type
value = l_app_type ).
cached_response->set_status( code = 200 reason = 'OK' ).
cached_response->server_cache_expire_rel( expires_rel = 60 ).
data guid type guid_32.
data lv_iframe_url type string.
call function 'GUID_CREATE'
importing
ev_guid_32 = guid.
concatenate '/sap/public' '/' guid '.' 'html' into lv_iframe_url.
****Cache the URL
cl_http_server=>server_cache_upload( url = lv_iframe_url
response = cached_response ).
* set single attribute
wd_context->get_child_node( name = wd_this->wdctx_output )->get_element( )->set_attribute(
name = `HTML_URL`
value = lv_iframe_url ).
Source code for the conversion to Excel:
DATA listobject TYPE STANDARD TABLE OF abaplist.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject.
DATA list_ascii TYPE list_string_table.
CALL FUNCTION 'LIST_TO_ASCI'
IMPORTING
list_string_ascii = list_ascii " Table Type for FB LIST_TO_ASCI
* list_dyn_ascii = list_dyn_ascii " Table with Generic Width
TABLES
listobject = listobject. " Container for list object
IF sy-subrc = 0.
ENDIF.
FIELD-SYMBOLS <Wa_ascii> like line of list_ascii.
data l_excel type string.
loop at list_ascii ASSIGNING <Wa_ascii>.
REPLACE ALL OCCURRENCES OF `|` in <Wa_ascii> with cl_abap_char_utilities=>horizontal_tab.
l_excel = l_excel && <Wa_ascii> && cl_abap_char_utilities=>newline.
endloop.
data l_mimetype type string.
l_mimetype = `application/excel`.
cl_wd_runtime_services=>attach_file_to_response(
i_filename = `ABAP_Report.xls`
i_content = cl_bcs_convert=>string_to_xstring( l_excel )
i_mime_type = l_mimetype
* i_in_new_window = abap_false
* i_inplace = abap_false
).
Hi Thamos,
Thank you for your valuable replies.
I've tried with below statement.
REPLACE ALL OCCURRENCES OF `|`
IN TABLE olist WITH cl_abap_char_utilities=>horizontal_tab
RESPECTING CASE.
I am getting the item level data with perfect alignment .
But the alignment with header datal and item level data was not there.
Thanks & Regards,
Sravan.
Hi, for this you have to use to use the rowrepeater UI element. Else there is absolutely no way to display a string table as it is.
For this 1. bind the data source, 2. bind the rowdescription property to the attribute of your data source node, 3. set the firstvisiblerow as 5 (say), 4. set the height and width property accordingly.
Regards,
Prosenjit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.