Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAVE_TEXT and READ_TEXT

Former Member
0 Likes
3,702

Hi all,

this is my problem: I need to store a long text in a DB and watching thread I've seen I have to use the FM in the title. I think I'm near to the solution, but I need some help to finish:

what I did is simply this:


" here I have to set the text I want to store
DATA text_table TYPE STANDARD TABLE OF tline.
DATA wa_line LIKE LINE OF text_table.
wa_line = 'line1'.
INSERT wa_line INTO TABLE text_table.
wa_line = line2'.
INSERT wa_line INTO TABLE text_table.
wa_line = 'line3'.
INSERT wa_line INTO TABLE text_table.
wa_line = 'line3.
INSERT wa_line INTO TABLE text_table.
wa_line = 'line4'.
INSERT wa_line INTO TABLE text_table.
wa_line = 'line5'.
INSERT wa_line INTO TABLE text_table.

" header element to pass to the save_text
DATA header TYPE thead.
header-tdid = '0001'.
header-tdname = 'TRYING'.
header-tdspras = 'EN'.


CALL FUNCTION 'SAVE_TEXT'
  EXPORTING
    header                = header
  tables
    lines                 = text_table.

But when I launch this report I get e message error saying "Text Object is not available" so I understand that probably there is a matchcode on another table and I would like to know how to set my own values in this table for text. I see also there is an

object

field that I don't know how to handle so an hint also for this would be great. I see that once set these values and call

SAVE_TEXT

, retrieve the text with

READ_TEXT

should be easy

thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,203

You need to specifiy the OBJECT , ID, NAME for the save_text. Object would be the one where you are storing the Text, ie for standard text it is ST, for sales order headers it is VBBK and so on.

You need to specifiy the OBJECT , ID, NAME for the save_text. Object would be the one where you are storing the Text, ie for standard text it is ST, for sales order headers it is VBBK and so on.

6 REPLIES 6
Read only

Former Member
0 Likes
3,204

You need to specifiy the OBJECT , ID, NAME for the save_text. Object would be the one where you are storing the Text, ie for standard text it is ST, for sales order headers it is VBBK and so on.

Read only

0 Likes
3,203

thanks

I see the error is because object field was not set. But ST doesn't work: if i fill with this value I get the same error: 'The object ST does not exist' (just now I understand that before was the object 'empty string' that was not found ). If I put VBBK I get no error, but I want to mantain a logical link to the type of text I am storing so:

how can I declare a generic text or better, how can I add a new type for object text so that I can create my own for my report?

thanks

Gabriele

Read only

0 Likes
3,203

what is this text you wanna save? either the texts are linked to a transaction in SAP, or to Standard Texts.

Read only

0 Likes
3,203

ok

I semi-solved: was not the object ST, but tid; the object must be TEXT for standard text. I am already saving data and wathing them via STXH table, but now I have another problem; the working for the report is this:

1) user edit some text

2) user can save text (SAVE_TEXT)

3) user can watch text saved (READ_TEXT) ...

4) and modify it again (again SAVE_TEXT)

but for what I see, the data I set with first SAVE_TEXT are key for the table of text, and if I try to make SAVE_TEXT with same key, operation is ignored. So, is there a way to update text in STXH and a way to delete a text from it?

thanks for your help: your hints and questions are putting me on the right way

Gabriele

Read only

0 Likes
3,203

I am sure SAVE_TEXT will update the text if you are modifying that. try using commit text afterwards

I see gthe following functions and more in the same group. you can check these out for your issues

INCLUDE LSTXDU01. "READ_TEXT

INCLUDE LSTXDU02. "DELETE_TEXT

INCLUDE LSTXDU03. "INIT_TEXT

INCLUDE LSTXDU05. "EDIT_TEXT

INCLUDE LSTXDU06. "COMMIT_TEXT

INCLUDE LSTXDU07. "SELECT_TEXT

INCLUDE LSTXDU08. "SAVE_TEXT

INCLUDE LSTXDU09. "RENAME_TEXT

INCLUDE LSTXDU10. "READ_TEXT_INLINE

INCLUDE LSTXDU11. "EDIT_TEXT_INLINE

Read only

Former Member
0 Likes
3,203

thanks a lot