2006 May 17 1:53 PM
I am trying to save text to text tables, and then read the same text. It appears as though the save is working (it returns sy-subrc of 0), but I'm not sure, because I can't see the text in the tables (STXH and STXL). When I try to retrieve the text, it is saying it is not found.
Here is my code for saving the text:
* Convert a String to TDLINE Table
CALL FUNCTION 'SOTR_SERV_STRING_TO_TABLE'
EXPORTING
TEXT = qtcomm
FLAG_NO_LINE_BREAKS = 'X'
LINE_LENGTH = 132
LANGU = SY-LANGU
TABLES
TEXT_TAB = t_tdline.
* Convert TDLINE to ITAB_LINES and adding the format
loop at t_tdline into lw_tdline.
clear wtab_lines.
if sy-tabix = 1.
wtab_lines-tdformat = '*'.
else.
wtab_lines-tdformat = '/'.
endif.
wtab_lines-tdline = lw_tdline.
append wtab_lines to itab_lines.
endloop.
* Save Text
CALL FUNCTION 'INIT_TEXT'
EXPORTING
ID = 'ST'
LANGUAGE = sy-langu
NAME = lv_name
OBJECT = 'TEXT'
IMPORTING
header = lv_texthead
TABLES
LINES = itab_lines
EXCEPTIONS
OTHERS = 5.
if sy-subrc is initial.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
HEADER = lv_texthead
SAVEMODE_DIRECT = 'X'
TABLES
LINES = itab_lines
EXCEPTIONS
OTHERS = 5.
endif.Here is my code for retrieving the text:
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = 'ST'
LANGUAGE = sy-langu
NAME = lv_tdname
OBJECT = 'TEXT'
TABLES
LINES = t_tdline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
others = 8.The read_text is returning a sy-subrc value of 4 (not found). The tdname value in both the save and the read is "Q0000000161 1".
Does anybody see any problems with my code?
2006 May 17 3:31 PM
Hi,
you need to call the FM COMMIT_TEXT after your SAVE_TEXT FM call.
then only your text will be saved.
Regards
vijay
Hi,
you need to call the FM COMMIT_TEXT after your SAVE_TEXT FM call.
then only your text will be saved.
Regards
vijay
2006 May 17 1:56 PM
Hi,
Try to call the function COMMIT_TEXT after save_text and before read_text.
Regards,
Ravi
Note : Please mark the helpful answers
2006 May 17 1:59 PM
Which parameters in the COMMIT_TEXT do I need to use? They are all optional. Which ones are required?
CALL FUNCTION 'COMMIT_TEXT'
* EXPORTING
* OBJECT = '*'
* NAME = '*'
* ID = '*'
* LANGUAGE = '*'
* SAVEMODE_DIRECT = ' '
* KEEP = ' '
* LOCAL_CAT = ' '
* IMPORTING
* COMMIT_COUNT =
* TABLES
* T_OBJECT =
* T_NAME =
* T_ID =
* T_LANGUAGE =
2006 May 17 1:59 PM
Are you able to Display the Text using SO10?
Regards,
Suresh Datti
2006 May 17 2:50 PM
2006 May 17 3:26 PM
Hi Denise,
Please try to code something like this.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = sy-mandt
HEADER = lv_texthead
INSERT = 'X'
TABLES
LINES = itab_lines
EXCEPTIONS
OTHERS = 5.
CALL FUNCTION 'COMMIT_TEXT'.
Hope this will help.
Regarsd,
Ferry Lianto
Please reward points if helpful.
2006 May 17 3:52 PM
I have added the call to COMMIT_TEXT, but it still isn't saving it.
2006 May 17 3:31 PM
Hi,
you need to call the FM COMMIT_TEXT after your SAVE_TEXT FM call.
then only your text will be saved.
Regards
vijay
2006 May 17 6:13 PM
Hi,
The fact that you are unable to see the data in SO10 could be because its not getting committed, which has a lesser probability of happening or the parameters you are passing need to looked at again.
Can you go in debig mode, make a note of the exact value being passed to SAVE_TEXT and use those exact values in SO10?
Regards,
Ravi
2006 May 17 7:30 PM
Yes, I just did this. Copied the name value, then using that in SO10, and it isn't there.
2006 May 17 7:40 PM
I thought INIT_TEXT deletes the line items and only populated the header with some defaults?
I usually build the lines after INIT_TEXT.
Also, can you show is the value of LV_TEXTHEAD just before SAVE_TEXT?
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |