Application Development 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: 

How to store a long text in database

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

marcin_makowski
Explorer
0 Kudos

Hello,

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:

[url]http://help.sap.com/saphelp_sm32/helpdata/en/7d/fe9f6f8af411d3805e00c04f99fbf0/content.htm

Good luck,

Marcin

4 REPLIES 4

marcin_makowski
Explorer
0 Kudos

Hello,

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:

[url]http://help.sap.com/saphelp_sm32/helpdata/en/7d/fe9f6f8af411d3805e00c04f99fbf0/content.htm

Good luck,

Marcin

Former Member
0 Kudos

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 first....you do NOT want to replicate STXH and STXL, and there is, of course, absolutely no need to do that in SAP.

shahid
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

Clemenss
Active Contributor
0 Kudos

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.

Regards,

Clemens