Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Add Text

Hi,

The requirement I'm working with requires to add text to the existing text object. I used READ_TEXT to read the existing text and SAVE_TEXT to append the additional text. There is a scenario where there might be no text in the text object. In this case the FM READ_TEXT fails and the program stops at that point. Is there any way we can check if there is already some text in a text object so that only in that case we can use FM READ_TEXT else we just use SAVE_TEXT to append new text.

Any help will be appreciated.

Thanks,

ALAM.

Tags:
Former Member
replied

Hi Alam,

to check if the text exists just use FM READ_TEXT. If there is no text, the FM will raise exception NOT_FOUND which you catch via subrc code.

So it is just enough to use case of subrc after call of the FM.

If subrc is 0 then text exists, then just edit table with text and use SAVE_TEXT.

If text doesn't exitst - I don't know which value of subrc is it now (you will get it when you use pattern button) then first call INIT_TEXT and then SAVE_TEXT (or you can use CREATE_TEXT - but this is not working properly in some cases because of COMMIT inside the body).

Regards,

Karol

Edited by: Karol Seman on Sep 29, 2008 8:55 PM

1 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question