‎2009 Jan 06 5:46 AM
Hi Rene,
It was really an interesting article posted on Notings, i was just going through it and was keen to implement it, but i was not able to figure out how to implement it, can you please share the solution and the code..please find below the link of your article.
‎2009 Jan 06 1:53 PM
After creating the configuration in table TTXFORMAT and the related changes in SE75 for in my example customer master the system will call the function: EDIT_TEXT_FORMAT_ZXXXNX.
I have created two functions EDIT_TEXT_FORMAT_ZXXXNX and EDIT_TEXT_FORMAT_ZXXXTX. As SAP has implemented the standard functions, I also use these functions to execute a report ( SAP version: sapredit_text_format_doi ), which does the text maintenance with GUI interface.
the code for the functions are in my case ( export and import values are as the standard SAP function EDIT_TEXT_FORMAT_DOC 😞
EDIT_TEXT_FORMAT_ZXXXNX
DATA: dest(32),
msg(80),
report LIKE rsvar-report,
device(1),
formattype(3) VALUE 'XXX',
value TYPE string,
word_version(7).
DATA: datasize TYPE i.
DATA: has_activex(1).
DATA: l_lines TYPE i.
DATA: linesn TYPE TABLE OF tline WITH HEADER LINE.
DATA: linest TYPE TABLE OF tline WITH HEADER LINE.
* If user comes back and changes again
READ TABLE wt_text INTO ws_text
WITH TABLE KEY tdobject = header-tdobject
tdname = header-tdname
tdid = header-tdid.
IF sy-subrc EQ 0.
lines[] = ws_text-lines.
linesn[] = ws_text-linesn.
linest[] = ws_text-linest.
ELSE.
READ TABLE lines INDEX 3.
IF sy-subrc = 0 .
* Text changed with history already there.
CLEAR ws_text.
ws_text-tdobject = header-tdobject.
ws_text-tdname = header-tdname.
ws_text-tdid = header-tdid.
ws_text-lines = lines[]. " Old text unchanged for now
ws_text-linesn = linesn[]. " Empty we show the user
ws_text-linest = lines[]. " Old text with history show user
linest[] = lines[].
INSERT ws_text INTO TABLE wt_text.
ELSE.
* New text perhaps one or two lines from screen.
CLEAR ws_text.
ws_text-tdobject = header-tdobject.
ws_text-tdname = header-tdname.
ws_text-tdid = header-tdid.
ws_text-lines = lines[]. " Old text unchanged for now
ws_text-linesn = lines[]. " We show first lines
ws_text-linest = linest[]. " Empty we start from scratch
linesn[] = lines[].
INSERT ws_text INTO TABLE wt_text.
ENDIF.
ENDIF.
CALL FUNCTION 'GUI_HAS_ACTIVEX'
IMPORTING
return = has_activex.
IF has_activex = 'X'.
device = 'X'.
EXPORT header control lines linesn linest device formattype TO MEMORY ID 'ZNOT'.
SUBMIT zsytu003 AND RETURN.
IMPORT newheader newcontrol lines linesn linest FROM MEMORY ID 'ZNOT'.
IF sy-subrc NE 0.
* Fehlerbehandlung:
FREE MEMORY ID 'ZNOT'.
newcontrol = control.
newheader = header.
newcontrol-function = space.
MESSAGE i016(texteditdoi).
MESSAGE e016(texteditdoi).
ELSE.
READ TABLE wt_text INTO ws_text
WITH TABLE KEY tdobject = header-tdobject
tdname = header-tdname
tdid = header-tdid.
ws_text-lines = lines[]. " New text changed
ws_text-linesn = linesn[]. " We show first lines
ws_text-linest = linest[]. " Text before start
MODIFY TABLE wt_text FROM ws_text.
PERFORM tobjectv using newheader.
ENDIF.
FREE MEMORY ID 'ZNOT'.
ELSE.
MESSAGE e009(texteditdoi).
ENDIF.
PERFORM refresh_table ON COMMIT.
and EDIT_TEXT_FORMAT_ZXXXTX
DATA: dest(32),
msg(80),
report LIKE rsvar-report,
device(1),
formattype(3) VALUE 'XXX',
value TYPE string,
word_version(7).
DATA: datasize TYPE i.
DATA: has_activex(1).
READ TABLE lines INDEX 1.
CALL FUNCTION 'GUI_HAS_ACTIVEX'
IMPORTING
return = has_activex.
IF has_activex = 'X'.
device = 'X'.
EXPORT header control lines device formattype TO MEMORY ID 'ZTXT'.
SUBMIT zsytu001 AND RETURN.
IMPORT newheader newcontrol lines FROM MEMORY ID 'ZTXT'.
IF sy-subrc NE 0.
* Fehlerbehandlung:
FREE MEMORY ID 'ZTXT'.
newcontrol = control.
newheader = header.
newcontrol-function = space.
MESSAGE i016(texteditdoi).
MESSAGE e016(texteditdoi).
ELSE.
PERFORM tobjectv using newheader.
ENDIF.
FREE MEMORY ID 'ZTXT'.
ELSE.
MESSAGE e009(texteditdoi).
ENDIF.
The code which I developed to handle the notes logic and make use of the different editors SAP has, is fully handle inside the report zsytu001. All the text maintenance is encapsulated into serveral objects, which allow the use of different text editors based on the entries in se75 and also handles the notes logic.
I hope this answers your question.
‎2009 Jan 06 2:39 PM
Hi Rene,
Thanks a lot for the code, i have got a few calrifications regarding the code, if could answer me that wil be really nice of you...
IN FM EDIT_TEXT_FORMAT_ZXXXNX.
1) * If user comes back and changes again
READ TABLE wt_text INTO ws_text
READ TABLE lines INDEX 3.
What is the table that you are refering to in declaration, is it STXH?
2) SUBMIT zsytu003 AND RETURN.
Is the report used with submit wrapper of this report this sapredit_text_format_doi, can you pls share that code?
3) What is the code of this routine PERFORM tobjectv using newheader & PERFORM refresh_table ON COMMIT refering to.
IN FM EDIT_TEXT_FORMAT_ZXXXTX.
1) READ TABLE lines INDEX 1.
which table does is refer to in declaration.
SUBMIT zsytu001 AND RETURN.
2) Which report is used here as this is custom report, can u share the code pls.
Please care to reply back.. Thank you for sharing.
‎2009 Jan 06 5:08 PM
Your questions:
Please check the function definiton of the function I mentioned (edit_text_format_doc😞
FUNCTION edit_text_format_doc.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(HEADER) LIKE THEAD STRUCTURE THEAD
*" VALUE(CONTROL) LIKE TTXCT STRUCTURE TTXCT
*" EXPORTING
*" VALUE(NEWHEADER) LIKE THEAD STRUCTURE THEAD
*" VALUE(NEWCONTROL) LIKE TTXCT STRUCTURE TTXCT
*" TABLES
*" LINES STRUCTURE TLINE
*" CHANGING
*" REFERENCE(DOC_CONTENT) TYPE TABLE OPTIONAL
*" REFERENCE(DOC_SIZE) TYPE I OPTIONAL
*" EXCEPTIONS
*" COMMUNICATION
*" TEXTFORMAT
*"----------------------------------------------------------------------
The table is coming from the parameters of the function. This is how the text loaded by the transaction get's passed into the function and back. The table wt_text is part of the function group and is used to store the text, if the user changes or creates text (with notes logic) and then comes back in text maintenance before saving.
Yes I can give you the code for the report, but the report only calls a list of objects. If you want to reproduce the whole notes logic, I have developed you need all this code. I thought you only want to understand how the logic works to implement a different editor of your own choice?
Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 4:43 PM
‎2009 Jan 07 5:29 AM
Hi Rene,
I wanted to reproduce the notes logic that you have developed in my system and thats the reason am asking you the code of reports and the step by step process, although i did complete 2 functions modules one to open a editor to write the text and other editor has the text which retrieves all the text of a particular object( i can share that if you want me to), but i want to implement your solution and reproduce wat you have done in my system.. please care to share your solution so that i can enable it in my system..
Regards,
Abdul.
‎2009 Jan 19 1:35 AM
Hi
To give you all the code I did. I have created a tutorial. I have posted Part I and will do two more parts.
have look here: [Code Tutorial|https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/text-editingfromNotes-LogictoHTMLStandardtextPartI]
I hope this helps.
Rene
‎2009 Jan 22 7:04 AM
‎2009 Jan 24 10:48 PM
I have created now part II. [code tutorial part II|https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/text-editingfromNotes-LogictoHTMLStandardtextPartII]
If you have any question regarding the code let me know
Rene
‎2009 Feb 06 8:28 AM
Hi Rene Turnheim!
I have studied your Text Editing with Notes-logic Article. It is very interesting and challenging task to do. I go through all the codes which you had posted in SDN both partI and PartII. I decided to do the implementation.I have some doubt in part-I that is some of the variables are not Declared. Can you please give me the solution for this?.I mentioned below the variables witch class and methods..
Am Waiting for Your reply!
Class Methods variables
Z_C_SYT_TEXT_OBJECT -->FREE -->wc_texteditor
Z_C_SYT_TEXT_NOTES -->CONSTRUCTOR -->ws_textdo-notes_position
Z_C_SYT_TEXT_NOTES -->CONSTRUCTOR -->is_textf-display_only
Z_C_SYT_TEXT_NOTES -->CONSTRUCTOR -->ws_textdo-sash_position
Z_C_SYT_TEXT_NOTES -->CONSTRUCTOR -->ws_tobject_md-sort_order
Z_C_SYT_TEXT_BOX> SET_DISPLAY_ATTRIBUTES>wc_texteditor
Z_C_SYT_TEXT_BOX>SET_DISPLAY_ATTRIBUTES>ws_textdo
Z_C_SYT_TEXT_OBJECT>GET_TEXT_FORMATED>wt_texts
Please care to reply back..
Thanks
Dharmaraj.
‎2009 Feb 08 9:43 PM
Yes you are correct; I forgot the addtional attributes of the object Z_C_SYT_TEXT_OBJECT. I have added to part I, but here is the missing list also:
Attributes
Attribute Level Visibility Typing Associated type Description Initial value
WS_TOBJECTV Instance Attribute Public Type ZSYT_TOBJECTV Text Objects
W_LINES_START Instance Attribute Public Type I
WS_TEXTDO Instance Attribute Protected Type ZSYT_S_TEXT_DISP_OPT Text Object Display Options
WS_TEXTF Instance Attribute Protected Type ZSYT_S_TEXTS_FIELDS Fields needed for Texts
WS_TEXTS Instance Attribute Protected Type ZSYT_S_TEXT_KEY_FIELDS Key fields for text's
WS_THEADER Instance Attribute Protected Type THEAD SAPscript: Text Header
WC_TEXTEDITOR Instance Attribute Protected Type Ref To Z_I_SYT_EDITOR SAP TextEdit Control
WC_TEXTEDITORN Instance Attribute Protected Type Ref To Z_I_SYT_EDITOR SAP TextEdit Control
WT_TEXTS Instance Attribute Protected Type TSFTEXT Text Lines
W_NODISPLAY Instance Attribute Protected Type FLAG No screen display of text opbject
WC_PARENT Instance Attribute Protected Type Ref To CL_GUI_CONTAINER Container for Custom Controls in the Screen Area
WT_NOTES Instance Attribute Protected Type TSFTEXT Note Lines
WC_PARENT2 Instance Attribute Protected Type Ref To CL_GUI_CONTAINER Reduced Version of Splitter Container Control
W_DESCR1 Instance Attribute Protected Type ZSYT_TOBJECTV-DESCR1 Description 132
W_DESCR2 Instance Attribute Protected Type ZSYT_TOBJECTV-DESCR1 Description 132
WS_TOBJECT_MD Instance Attribute Protected Type ZSYT_S_TOBJECT_MD Master for data for text object
WC_SPLITTER Instance Attribute Protected Type Ref To CL_GUI_SPLITTER_CONTAINER Splitter Control
WC_PARENT1 Instance Attribute Protected Type Ref To CL_GUI_CONTAINER Abstract Container for GUI Controls
W_IS_MODIFIED Instance Attribute Protected Type I If text has been changed
LT_TEXT_DATA Static Attribute Protected Type ZSYT_T_TEXT_DATA Text data for all text in text objects
Let me know if you need more.
Rene
‎2009 Mar 02 2:57 PM
Hi Rene,
declaration of abap_true is also missing, what does <> abap_true denote here.
IF ws_textdo-display_only <> abap_true AND
w_is_modified = c_true.
‎2009 Mar 02 5:11 PM
Hi
abap_true comes from a type pool of SAP called 'ABAP' .
Where is the code you copied from? It looks like it misses the operand?
If it is in one of the object you have to added this type group ABAP on the property tab.
‎2009 Mar 03 2:34 PM
Dear Rene,
Am penning down some other missing parts as well;
PART-1
1. Convert_text_to_screen method is missing where do we in-coporate this (Which class)?
2.
To get the sample program ZSAMPLE_TEXT_OBJECT_SIMPLE to work, create in SE75 a new text object and text id. The program uses ZSY_TEXT with TO01 as ID.
In addition you have to create the entry in ZSYT_TTXOB accordingly.
333 ZSY_TEXT TO01 MANDT DOCNO04 132Is this a sample program to check if the created classes are working coz i think we need to create a module pool and incorporate the code in the PBO and PAI events, please clarify on thi
3. In the method UPDATE_TEXT Function module 'ZSYO_ACTUALIZA_TEXTO' is used can u pls give the code of this FM
4. Do we need to keep the data element same as domain name for ZZNOTES_POSITION
5. Can u pls clarify on Exceptions config and raise error.
6. Z_C_SYT_2BOX_NOTES is this class used only for sample program not for customer text implementation
Please answer the above queries, Many thanks all your efforts
‎2009 Mar 09 7:33 AM
Hi Rene !
In previous thread Abdul Bari said some missing parts is correct and also i have found some other missing parts in the coding .In
‎2009 Mar 09 7:46 AM
Hi Rene !
In previous thread Abdul Bari said some missing parts ,it is correct and also I have found some other missing parts in the coding .
In class Z_C_SYT_TEXT you have mention the method UPDATE_TOBJECTV,UPDATE_TOBJECTV2. and
there is no coding in that method.
In class Z_C_SYT_TEXT you have mention the method AFTER_SAVE but there is no coding in that method.
You have mentioned the methods in class but some of the methods having no coding,Please check it and inform me.
As Bari said 'ZSYO_ACTUALIZA_TEXTO' this FM is missing and i have found this ZSY_USER_HISTORY_LINE FM coding also Missing .
Can You please Clarify this issue! Waiting for Your Replay!
Thanks
Dharmaraj
‎2009 Mar 10 12:04 AM
Yes, I agree there are still o few points open.
Firfst of all I have started a blog and I will try to post all objects in a bit more detail.
Some of your questions are already answered in the first blog. As soon as it is aproved Iwill post the link here.
1) Both update methods in Z_C_SYT_TEXT update_tobjectv and update_tobjectv2 I have only used for conversion and should not be created. I thought I deleted it out of the code I provided. Please ignore.
2) Sorry for the FM: ZSYO_ACTUALIZA_TEXTO. I overlooked that I am using this FM in the object:
This is just to be sure that the text gets deleted, if the user has deleted the text.
FUNCTION zsyo_actualiza_texto .
*"----------------------------------------------------------------------
*"*"Módulo funciones actualiz.
*"
*"*"Interfase local
*" IMPORTING
*" VALUE(ZHEADER) LIKE THEAD STRUCTURE THEAD
*" TABLES
*" LINES STRUCTURE TLINE
*" EXCEPTIONS
*" ACTUALIZACION_FALLIDA
*"----------------------------------------------------------------------
* Work variables:
DATA: nr_of_lines TYPE i.
* Create new text, if any exists:
DESCRIBE TABLE lines LINES nr_of_lines.
IF nr_of_lines GT 0.
READ TABLE lines INDEX 1.
IF nr_of_lines GE 1 OR NOT lines-tdline IS INITIAL.
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
fid = zheader-tdid
flanguage = zheader-tdspras
fname = zheader-tdname
fobject = zheader-tdobject
save_direct = 'X'
fformat = '/'
TABLES
flines = lines
EXCEPTIONS
no_init = 01
no_save = 02.
IF sy-subrc NE 0.
RAISE actualizacion_fallida.
ENDIF.
ENDIF.
ELSE.
CALL FUNCTION 'DELETE_TEXT'
EXPORTING
* CLIENT = SY-MANDT
id = zheader-tdid
language = zheader-tdspras
name = zheader-tdname
object = zheader-tdobject
savemode_direct = 'X'
* TEXTMEMORY_ONLY = ' '
EXCEPTIONS
not_found = 1
OTHERS = 2.
ENDIF.
ENDFUNCTION.
I will post the details in the blog; Class by class.
Rene
‎2009 Mar 10 5:44 AM
Hi Rene,
Many thanks for publishing the code in blogs, am awaiting to check that out and see it implemented..Thanks again