First to get an idea how this solution works, please read the article: Text-Editing with Notes - Logic.
The solution is based on set of several objects which make use of an interface to accommodate the different editor types SAP supports. The first step is to create the interface Z_I_SYT_EDITOR in se24. Just create the interface as the picture is below and save it. We will come back after we created the required data elements, domains and structures we need.
The interface needs several predefined domains. Please use the same name for the data element as for the domain. You can define these in se11. You can use the table below to copy the information into SE11:
Name | Description | Data Type | - No. Characters
| Decimal Places |
ZSTATUS_BAR_TEXT | Status bar Text | CHAR | 256 | |
ZZNOTES_POSITION | Notes position in text object | CHAR | 1 | |
ZZSORT_ORDER | Sort Order | NUMC | 1 | |
ZZTEXTCONV | Data Conversion types for text object | CHAR | 1 | |
The value table for each of the domains ( only three have a value table assigned) are shown here:
ZZNOTES_POSITION |
Fix val. | Short description |
T | Top |
B | Bottom |
L | Lext |
R | Right |
| |
ZZSORT_ORDER |
Fix val. | Short description |
1 | Oldest to Newest |
2 | Newest to Oldest |
3 | Newest to Oldest not first |
| |
ZZTEXTCONV |
Fix val. | Short description |
' ' | Plain text |
S | Snippet (mainly HTML: text without header/body ) |
Be aware that you can copy the values directly from the screen.
In addition you need to create the following Structures in se11. First you hace to create ZSYT_S_TEXT_DISP_OPT_BOX. Also use the table below to copy the data into se11. Thesecond structure you need is below and is called ZSYT_S_TEXT_DISP_OPT.
ZSYT_S_TEXT_DISP_OPT_BOX | | | | Text Object Display Options Box |
Component | RType | Component type | Data Type | Length | Decimal Pl | Short Description |
NO_TOOLBAR_DISP | | FLAG | CHAR | 1 | 0 | General Flag |
NO_STATUSBAR_DISP | | FLAG | CHAR | 1 | 0 | General Flag |
STATUS_BAR_TEXT | | ZSTATUS_BAR_TEXT | CHAR | 256 | 0 | Status Bar Text |
DISPLAY_ONLY | | FLAG | CHAR | 1 | 0 | General Flag |
DISPLAY_NOTES_TOOLBAR | FLAG | CHAR | 1 | 0 | General Flag |
NOTES_POSITION | | ZZNOTES_POSITION | CHAR | 1 | 0 | Notes position for text object |
SASH_POSITION | | INT4 | INT4 | 10 | 0 | Natural Number |
TABMODE | | INT4 | INT4 | 10 | 0 | Natural Number |
| | | | | | |
ZSYT_S_TEXT_DISP_OPT | | | | Text Object Display Options |
Component | RType | Component type | Data Type | Length | Decimal Pl | Short Description |
.INCLUDE | | ZSYT_S_TEXT_DISP_OPT_BOX | | 0 | 0 | Text Object Display Options Box |
USERTITLE | | TDUSERTITL | CHAR | 1 | 0 | Text editor: User-defined title for title bar |
Now let's go back to se24 and finish the interface. On the methods tab please copy the following methods for the interface Z_C_SYT_EDITOR. You should be able to use the table as displayed:
Method | Level | Description |
INITIALIZE | Instance Method | Create editor and set everything up |
FREE | Instance Method | Free |
FILL_DESCRIPTION | Instance Method | Get two lines of description |
GET_IS_MODIFIED | Instance Method | Check if text has been changed |
GET_LINE_COUNT | Instance Method | Get line count of text |
REFRESH_TEXT | Instance Method | Update text with newer lines |
SET_DISPLAY_OPTIONS | Instance Method | Set toolbar and status bar mode |
GET_TEXT_FROM_EDITOR | Instance Method | Get the updated text |
ADD_HISTORYLINE | Instance Method | Add the history line for notes logic |
SET_DISPLAY_OPTIONS_NOTES | Instance Method | Set toolbar and status bar mode |
CONVERT_TEXT | Instance Method | Convert text to required format and table type |
Now we go to the attributes tab. Here the Interface Z_I_SYT_EDITOR has the following attributes. Again, just copy from the table below:
Attribute | Level | Typing | Associated type | Description | Initial value |
W_LINES_START | Instance Attribute | Type | I | | |
C_NORMAL | Constant | Type | ZZTEXTCONV | Conversion types for text object | ' ' |
C_SNIPPET | Constant | Type | ZZTEXTCONV | Conversion types for text object | 'S' |
Now we go back to the method tab and enter for the following methods parameter informetion. For each method you have to click first on the method name, then on the parameter button. Cope the correct table section of the method and then go back to the method overview. The Interface Z_I_SYT_EDITOR has the following parameters:
INITIALIZE | | | | | | | |
Parameter | Type | P | O | Typing Method | Associated Type | Default Value | Description |
IS_THEADER | Importing | | | Type | THEAD | | SAPscript: Text Header |
IC_PARENT | Importing | | | Type Ref To | CL_GUI_CONTAINER | | Container for Custom Controls in the Screen Area |
IT_LINES | Importing | | | Type | TSFTEXT | | SAPscript: Text Lines |
| | | | | | | |
FILL_DESCRIPTION | | | | | | | |
Parameter | Type | P | O | Typing Method | Associated Type | Default Value | Description |
IT_TEXT | Importing | | | Type | TSFTEXT | | Smart Forms: Text |
IS_HEADER | Importing | | | Type | THEAD | | SAPscript: Text Header |
E_PART1 | Exporting | | | Type | STRING | | First line of Text |
E_PART2 | Exporting | | | Type | STRING | | Second line of Text |
| | | | | | | |
GET_IS_MODIFIED | | | | | | | |
Parameter | Type | P | O | Typing Method | Associated Type | Default Value | Description |
I_FLUSH | Importing | | X | Type | FLAG | 'X' | General Flag |
R_IS_MODIFIED | Returning | X | | Type | I | | Text has been modified |
| |
As this is only the interface. We are done no code has to be added. Please try to activate the interface.
Let me know if I have missed anything for the interface Z_I_SYT_EDITOR.
Hope it works for you.