2013 Nov 25 7:48 AM
Hi Experts, Good Day.
When I am using READ_TEXT function module, I want to exclude the line-item/row contains the log (System date, time, username etc.). When user edits long text multiple times READ_TEXT fetches all the log data, so user doesn't require that data.
So please let me how to exclude log row when calling READ_TEXT or logic to delete after fetching into Internal table.
Thanks & Regard,
-Vijay
2013 Nov 25 8:22 AM
2013 Nov 25 9:51 AM
Hi Smruthi,
Firstly thanks for your reply. STXH table contains only last change details I think. But I required all the log.
Thanks,
-Vijay
2013 Nov 25 8:30 AM
Hi Vijay
Can you please attach screen shot of LT_TEXT table which you see in debugging showing the date time stuff
Nabheet
2013 Nov 25 9:54 AM
Hi Nabheet,
Please find the attached screen shot and I need to exclude or delete the highlighted rows.
Thanks,
-Vijay
2013 Nov 25 9:59 AM
Hi Vijay
Tell me one thing is the text is being saved by you or custom application?
Nabheet
2013 Nov 25 10:07 AM
You can delete the * from each row using this code.
LOOP AT it_tdlines.
REPLACE FIRST OCCURRENCE OF '*' IN it_tdlines-tdline WITH ''.
SHIFT it_tdlines-tdline LEFT DELETING LEADING ' ' .
IF it_tdlines-tdline NE ' '.
MODIFY it_tdlines INDEX sy-tabix TRANSPORTING tdline.
ELSE.
DELETE it_tdlines INDEX sy-tabix .
ENDIF.
ENDLOOP.
Then for removing the timestamp row use this code.
LOOP AT it_tdlines .
IF it_tdlines-tdline+2(1) EQ '.' AND it_tdlines-tdline+5(1) EQ '.' AND
it_tdlines-tdline+13(1) EQ ':' AND it_tdlines-tdline+16(1) EQ ':'.
DELETE it_tdlines INDEX sy-tabix .
ENDIF.
ENDLOOP.
2013 Nov 25 10:21 AM
Hi-
You can use below logic:
DATA: it_line TYPE STANDARD TABLE OF tline,
wa_line TYPE tline.
wa_line-tdformat = '*'.
wa_line-tdline = '24.11.2013 14:50:58 ABAP (ABAP)'.
APPEND wa_line TO it_line.
wa_line-tdline = 'Venkat Test'.
APPEND wa_line TO it_line.
wa_line-tdline = '29.12.2014 19:55:60 ABAP (ABAP)'.
APPEND wa_line TO it_line.
LOOP AT it_line INTO wa_line.
IF ( wa_line-tdformat = '*' AND
wa_line-tdline+2(1) = '.' AND
wa_line-tdline+5(1) = '.' AND
wa_line-tdline+10(1) = ' ' AND
wa_line-tdline+13(1) = ':' AND
wa_line-tdline+16(1) = ':' ).
ELSE.
WRITE: wa_line.
ENDIF.
ENDLOOP.
Output:
If you want you can also add more validations.
-Venkat
2013 Nov 25 10:45 AM
Hi Nabheet,
This text editor is from transaction WCTL for entering WCA Description (longtext). This will be entered by Customer. But when ever we open this editor automatically the log line will be filled by system.
Thanks,
-Vijay
2013 Nov 25 11:17 AM
Hi Venkat..
what if user enter the date in same formate then it is invalid i believe
Nabheet
2013 Nov 25 11:29 AM
Hello Nabheet-
In my logic I have considered time stamp value too( wa_line-tdline+13(1) = ':' AND wa_line-tdline+16(1) = ':'), so I don't think users will be adding these values. However if they add then those will be an exemption case and that line won't be considered.
-Venkat
2013 Nov 25 12:07 PM
Hi All,
I implemented my own logic comparing the string with Existing Usernames. And actually I posted this to know any standard method if exists. Thank you all for your helpful inputs.
-Vijay
2013 Nov 28 10:29 AM
Hi All,
try it
FORM read_text USING p_id LIKE thead-tdid
p_name
CHANGING p_val.
DATA : tdname TYPE thead-tdname .
DATA : BEGIN OF tline OCCURS 0 .
INCLUDE STRUCTURE tline .
DATA : END OF tline .
tdname = p_name.
* compressed text data with text name
TYPES: BEGIN OF ty_stxl,
tdname TYPE stxl-tdname,
clustr TYPE stxl-clustr,
clustd TYPE stxl-clustd,
END OF ty_stxl.
DATA: t_stxl TYPE STANDARD TABLE OF ty_stxl.
FIELD-SYMBOLS: <stxl> TYPE ty_stxl.
* compressed text data without text name
TYPES: BEGIN OF ty_stxl_raw,
clustr TYPE stxl-clustr,
clustd TYPE stxl-clustd,
END OF ty_stxl_raw.
DATA: t_stxl_raw TYPE STANDARD TABLE OF ty_stxl_raw.
DATA: w_stxl_raw TYPE ty_stxl_raw.
* decompressed text
DATA: t_tline TYPE STANDARD TABLE OF tline.
FIELD-SYMBOLS: <tline> TYPE tline.
*and then
* select compressed text lines in blocks of 3000 (adjustable)
SELECT tdname clustr clustd
INTO TABLE t_stxl
FROM stxl
PACKAGE SIZE 3000
* for all entries in t_main"(itab with application data and TDNAME)
WHERE relid = 'TX' "standard text
AND tdobject = '/CSPL/EXPK'
AND tdname = tdname
AND tdid = p_id
AND tdspras = sy-langu.
* loop at t_stxl assigning <stxl>.
READ TABLE t_stxl ASSIGNING <stxl> INDEX 1.
* decompress text
CLEAR: t_stxl_raw[], t_tline[].
w_stxl_raw-clustr = <stxl>-clustr.
w_stxl_raw-clustd = <stxl>-clustd.
APPEND w_stxl_raw TO t_stxl_raw.
IMPORT tline = t_tline FROM INTERNAL TABLE t_stxl_raw.
* access text lines for further processing
READ TABLE t_tline ASSIGNING <tline> INDEX 1.
p_val = <tline>-tdline."whatever
* endloop.
* endloop.
FREE t_stxl.
ENDSELECT.
ENDFORM. " read_text