Skip to Content

How to store a long text in database

I have a Z database table in which I would like to store a long text as a field ( a string with length 2000 for example) .

I have copied stxh table into zmm_stxh table and I wass wondering about using read_text in order to read the stored text.

Now, the problem is.., how could I save text? Which type of field should I show to the user for her/him to insert text? Which function should I use to store this long text in my zmm_stxh database table?

Does someone know another way to get this out?

Thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Jul 14, 2011 at 11:37 AM


    You can use READ_TEXT and then save the text in the SAP text database with function ..... SAVE_TEXT. In that case you would utilize standard SAP text repository. For that purpose you need to define your own text ID - transaction SE75.

    For displaying the long text to the user you can use SAP's Text Edit Control being called on any event (depending on the context in your app) - URL, HotSpot field in ALV table with say first 128 characters of the text, and so on, and after clicking on that editor will be called (you can preload the text to editor window after you read it with READ_TEXT).

    Text Edit Control:


    Good luck,


    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 14, 2011 at 11:53 AM

    If you just want to store a long string, SAP provides us ways (data types) to do that in a standard transparent table. Do a little research do NOT want to replicate STXH and STXL, and there is, of course, absolutely no need to do that in SAP.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 14, 2011 at 01:16 PM

    you can store the standard text name in the ztable.

    you can user read_text and save_text to read and write the long text.

    input to the user will be a text field. (where the user enters the long text).

    once the user click on save, create a GUID, a FM will be availble to generate a GUID.

    This GUID will be used as a standard text name.

    using the above guid create the standard text( save the long text)

    and finally push the regular data along with GUID to save the data in the ztable

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 14, 2011 at 08:31 PM

    Hi Jarizkuren, there is no need and no use to create copies of STXH and STXL. If you want to handle sap script long texts, you may create your own text ID and TEXT object (look at STXH header key fields) and maintain very efficient using SAP standard functions READ_TEXT and SAVE_TEXT.

    If you just want to store not formatted text, create a table with a useful key field (i.e. numeric from number range) and one field of type STRING. Then you can store any length of text sing just as much storage as required.



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.