on 09-15-2014 5:59 AM
Hi SAP gurus,
I want to display a long static text in my view.
This text contains instructions for a particular scenario.
I want the text to be displayed in one UI element, as it would be static and will not change.
Please let me know the procedure for the same, also if it is done via coding please help me with the code snippet.
Below is the sample text that I want to display.
Regards,
Aakash Awasthi
METHOD READ_SKILLS .
DATA: IT_SKILL1 TYPE STANDARD TABLE OF TLINE.
DATA: IT_SKILL_TEMP TYPE TLINE.
DATA: STR TYPE STRING.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'ST'
LANGUAGE = SY-LANGU
NAME = 'ZMYS_ABOUTMYSKILLS'
OBJECT = 'TEXT'
TABLES
LINES = IT_SKILL1
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
ENDIF.
DATA LO_ND_SKILL_TEXT TYPE REF TO IF_WD_CONTEXT_NODE.
DATA LO_EL_SKILL_TEXT TYPE REF TO IF_WD_CONTEXT_ELEMENT.
DATA LT_SKILL_TEXT TYPE IF_ABOUTMYSKILLS=>ELEMENTS_ABOUT_MY_SKILLS.
DATA LS_SKILL_TEXT TYPE IF_ABOUTMYSKILLS=>ELEMENT_ABOUT_MY_SKILLS.
LO_ND_SKILL_TEXT = WD_CONTEXT->GET_CHILD_NODE( NAME = 'ABOUT_MY_SKILLS' ).
LOOP AT IT_SKILL1 INTO IT_SKILL_TEMP.
LS_SKILL_TEXT-TEXT = IT_SKILL_TEMP-TDLINE.
APPEND LS_SKILL_TEXT TO LT_SKILL_TEXT.
ENDLOOP.
LO_ND_SKILL_TEXT->bind_table( new_items = LT_SKILL_TEXT ).
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Akash,
you will need to use a formattedtextview to display your text as required by customer.
As about which method you need to write the code, its completely dependant on your requirement
for eg: if you want it at launch, then it will be the init method.. if you want it after an action (do it in a action handler).
I suggest you can do a basic reading about the hook methods, i assure you it will help you on the long run.
Regards,
Tashi
Hi Akash,
As suggested by Tashi, you can achieve your requirement by using FormattedTextView ui element.
Please follow the below steps
refer link: Steps to Translate OTR Texts in Webdynpro ABAP
Hope this helps you.
Regards,
Rama
Hi Aakash,
Yes, there is restriction for length of OTR text upto 255 chars. Also you cannot have bullets inside the otr text.
To better fit your case, I suggest you to set the text to attribute of formattedTextView ui element as below
<p><strong> Instructions: </strong></p><p>Prior to completing the formall applicants must: </p><p><ul><li>Read the policy through this link</li><li>text2</li><li>Test 3</li></ul><div><br /></div><div><br /></div></p>
Hope this helps you.
Regards,
Rama
Hi Ram,
I used the following code, and it is getting displayed correctly, but as u suggesting I used the html tags, its printing the tag itself, inspite of bullets. Also do let me know, if this is the correct mehtod for displaying the text.
DATA lo_nd_textedit TYPE REF TO if_wd_context_node.
DATA lo_el_textedit TYPE REF TO if_wd_context_element.
DATA ls_textedit TYPE wd_this->element_textedit.
DATA lv_textedit_header TYPE wd_this->element_textedit-textedit_header.
DATA: lv_string_ins TYPE string_table.
* navigate from <CONTEXT> to <TEXTEDIT> via lead selection
lo_nd_textedit = wd_context->get_child_node( name = wd_this->wdctx_textedit ).
* get element via lead selection
lo_el_textedit = lo_nd_textedit->get_element( ).
APPEND ' Prior to completing this form, all applicants must:' to lv_string_ins.
APPEND ' 1. Read the Purchased Leave Policy available through this link.' to lv_string_ins.
APPEND ' 2. Discuss all proposed leave dates with their Manager.' to lv_string_ins.
APPEND ' 3. Contact the Human Resources Department for any inquiry.' to lv_string_ins.
APPEND ' 4. Check accrued leave balance as indicated in the form below.' to lv_string_ins.
APPEND ' 5. Seek appropriate financial advice to see the effect of purchasing addtional' to lv_string_ins.
APPEND ' leave will have on their superannuation payments and entitlements, and on ' to lv_string_ins.
APPEND ' salary packaging items' to lv_string_ins.
* set single attribute
lo_el_textedit->set_attribute(
name = `TEXTEDIT_HEADER`
value = lv_string_ins ).
Regards,
Aakash
It is giving me this exception
Note
The following error occurred in system ODE : WebDynpro Exception: Tag
"<li>" is not permitted
The error occurred on application server INCAS1039_ODE_00 and in work
process. 14
The termination type was: RABAX_STATE
The ABAP call stack was:
Method: RENDER of program
CL_WD_FORMATTED_TEXT==========CP
Method: RENDER_XHTML of program
CL_WDR_TEXT_FORMATTER=========CP
Method:
IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program
/1WDA/CASTANDARD==============CP
Method:
IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program
/1WDA/C8STANDARD==============CP
Method:
IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program
/1WDA/C8STANDARD==============CP
Method:
IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program
/1WDA/C8STANDARD==============CP
Method:
IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program
/1WDA/C7STANDARD==============CP
Method:
IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program
CL_WDR_VIEW_ADAPTER===========CP
Method:
IF_WDR_NW7_DELTA_RENDERER~CALCULATE_DELTA_BLOCKS of program
CL_WDR_VIEW_ADAPTER===========CP
Method: PROCESS_DELTA_BLOCKS of program
CL_WDR_WINDOW_CONTENT_ADAPTER2CP
User | Count |
---|---|
89 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.