cancel
Showing results for 
Search instead for 
Did you mean: 

Need to accept Long Text

former_member184386
Active Participant
0 Kudos

Hi everyone,

I need to make an enhancement to my existing custom table to accept long text. The text will be uploaded to this table and has length of 300 characters.

Do you know how I can implement this?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

former_member583013
Active Contributor
0 Kudos

You should create an append structure (On SE11)...so you don't mess with you actual table definition...Just use a domain with 300 characters and you're on -;)

Greetings,

Blag.

former_member184386
Active Participant
0 Kudos

The maximum length for a character domain is only 255.

suresh_datti
Active Contributor
0 Kudos

have u tried data type STRING?

Suresh

former_member583013
Active Contributor
0 Kudos

These domains are 300 characters of lenght...

<b>

CHAR300

MESSTEXT

SLCNA_STR

TEXT300

</b>

Greetings,

Blag.

former_member184386
Active Participant
0 Kudos

Hmm, I've never actually thought about using a string, I think I'll try and let you know.

Thanks,

Ricky

Former Member
0 Kudos

string is not allowed for DD tables. it is only for structures.

Use type 'LCHR'. But there are some restrictions. This long text character field should immediately be preceded by another field of data type INT2. You don't have to fill anything, but it has to be there.

Also this long text field has to be the last field of the table.

Message was edited by: Srinivas Adavi

athavanraja
Active Contributor
0 Kudos

string is <b>allowed</b> for DD tables starting WAS6.40

Regards

Raja

Former Member
0 Kudos

Thanks Raja, I was looking in an older version.

former_member184386
Active Participant
0 Kudos

I'm using SAP 4.6C, so I guess I wont be able to use STRING, is this correct?

Former Member
0 Kudos

I tried it in 46c and it did not allow me to use STRING. So your only other option is what I mentioned previously, using LCHR. This is what the EDI/IDoc tables use.

former_member184386
Active Participant
0 Kudos

Thanks, but I cant find LCHR, is this a data element or a domain?

Former Member
0 Kudos

This is a data type not data element or domain. Toggle from Data element to Direct Type by pressing the button above the table control that has the text 'Data Element/Direct Type'.

There may be some existing data elements of this type, but this is a direct approach.

former_member184386
Active Participant
0 Kudos

ZHR_LCHR500 i found this field type with LCHR as the data type, is this what you're talking about?

Former Member
0 Kudos

As I said, you can either use existing data elements(in that case, you will have to accept whatever description that is there with the data element) or

specify the data type and length directly or

create your own domain and data element of this type.

former_member184386
Active Participant
0 Kudos

Thanks, do you have a sample program that shows how this field can be populated?

Former Member
0 Kudos

I have a table defined as below.


MANDT	MANDT	CLNT	3
ZZTEST	ZZTEST1	CHAR	1
NUM		INT2	5
LONGTEXT	LCHR	300

Here is a program that fills this table.


REPORT zjstest .

DATA: BEGIN OF itab OCCURS 0.
        INCLUDE STRUCTURE ztest.
DATA: END OF itab.

DATA: l_num TYPE i.

START-OF-SELECTION.

  itab-zztest = '2'.
  DO 299 TIMES.
    IF l_num = 10.
      l_num = 0.
    ENDIF.
    itab-longtext+sy-index(1) = l_num.
    l_num = l_num + 1.
  ENDDO.

  itab-num = strlen( itab-longtext ).
  APPEND itab.
  INSERT ztest FROM TABLE itab.

former_member184386
Active Participant
0 Kudos

Thanks for the help, I just given you the reward.

Former Member
0 Kudos

Glad to be of help, just remember <b>you cannot use this field in a WHERE clause of a SELECT statement.</b>

former_member184386
Active Participant
0 Kudos

Hello,

Would you know how this can be implemented using Standard Text as well?

Thanks again.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, it probably would have been a better idea to implement as sapscript text. You can set up your text id and object via transaction SE75. Then you can save the text using the function module SAVE_TEXT and you can read it by using READ_TEXT.

Regards,

Rich Heilman

Answers (3)

Answers (3)

ferry_lianto
Active Contributor
0 Kudos

Hi Ricky,

Please use data element<b> TEXT300</b> or domain <b>CHAR300</b>. Hope this will help.

Which SAP version are you using?

Regards,

Ferry Lianto

Former Member
0 Kudos

in se11 goto >append structure >name of the append > and create ur fields there.

the fields will be created in the append structure

ferry_lianto
Active Contributor
0 Kudos

Hi Ricky,

You can add new field or append structure with data element <b>TEXT300</b> into your existing custom table.

Path: SE11 -> Database Table = your custom table.

Hope this will help.

Regards,

Ferry Lianto