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

Storing long text data

Former Member
0 Likes
2,039

Hi All,

I have a small requirement. I need to store long text data (maybe 5000 characters) in the SAP. And also I need to retrieve the data whenever I need it.

Please guide me how can I achieve the same technically.

Just for your information, I have designed a z-table with the following fields -

1. MANDT

2. KEY FIELD

3. A field whose data type is SMO_LNGTXT (Attachment Pointer - long text data)

But I do not know how to make use of attachment pointer in order to store and retrieve long text data.

Please guide me how to achieve this, either by following the approach I have taken up or any new approach which u suggest.

Thanks in advance,

Pradipta Paul.

8 REPLIES 8
Read only

Former Member
0 Likes
1,193

use fm

READ_TEXT

to read the long text,

EDIT_TEXT to edit long Text

Regards,

Alpesh

Read only

0 Likes
1,193

But how do i do the same using these two FMs. I also need a reference to the data which I shall be storing, so that I can retrieve the sam in the future.

Read only

Former Member
0 Likes
1,193

You can create a standard text for each key field using FM 'SAVE_TEXT'.

Regards,

Aparna

Read only

0 Likes
1,193

Use

TDOBJECT = 'TEXT'

TDNAME = ur key field

TDID = 'ST'

TDSPRAS = sy-langu

Create standard text using FM 'SAVE_TEXT' which will create standard text. Enter long text in 'lines' of this FM.

This will create long text which is stored in standard text for each key field.

Read standard text using FM' READ_TEXT'.

I hope this will work.

Regards,

Aparna

Read only

0 Likes
1,193

Hi All,

Thanks for the answers. But I could see that the FM cuts the text at 132 characters only. The rest of the text is missed out. Pls help me in this regard.

Regards,

Pradipta Paul.

Read only

0 Likes
1,193

Hi Pradipta,

Use the Read, Save, Delete text FMs in conjunction with these FMs:

- CONVERT_STREAM_TO_ITF_TEXT, to save text

- CONVERT_ITF_TO_STREAM_TEXT, to read and display text.

You will be using a container object cl_gui_textedit, this is the text box that will display your data.

So, to display your data, you create your object. Call READ_TEXT to get the data into an internal table and then call CONVERT_ITF_TO_STREAM_TEXT which creates another internal table which you pass to display on your screen.

After editing data from the screen, you call CONVERT_ITF_TO_STREAM_TEXT and then call SAVE_TEXT to save your data.

Hope this helps.

Filler

Read only

Former Member
0 Likes
1,193

you should be carefull about the datatype

you may use lchr or rawstring

for this case

Read only

Former Member
0 Likes
1,193

ok