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

LONG TEXT in DATA DICTIONARY.

Former Member
0 Likes
4,940

Have ZGDES table.

I have to add one field ( for writing comments ) with text of unlimited length ?

I mean is there a practical way to make this 'Comments' field more like an extra text/long text field that is unlimited or at least a few hundred characters long?

If you have done this Kindly help me out.

you help will be APPRECIATED.

9 REPLIES 9
Read only

Former Member
0 Likes
2,453

Hi Sam,

U can use String Data Type for Variable lenght.

Hope this helps.

Regards

-


Sachin Dhingra

Read only

0 Likes
2,453

hi,

Use <b>String</b> Data Type for long text

Read only

Former Member
0 Likes
2,453

Hi Sam,

Just use string for long text.because it can store sring data in it .

Regards.

Ankur Garg.

Read only

dani_mn
Active Contributor
2,453

Hi,

create a field in your table with data type 'LCHR' with length of your choice.

this field should be the last field in table and there must be integer field before this to store the size of ths field string.

Use Text Editor in module pool program to display, create and edit long text and save them in this field.

here is sample code. of creating text editor.

insert a custom control area in the screen and create a object of the text editor.

check this code for PBO and PAI.

here TEDITOR is the custom contorl area name on screen

<b>MODULE PBO OUTPUT.
  IF EDITOR IS INITIAL.

    CREATE OBJECT TextEdit_Custom_Container
        EXPORTING
            CONTAINER_NAME = 'TEDITOR'
        EXCEPTIONS
            CNTL_ERROR = 1
            CNTL_SYSTEM_ERROR = 2
            CREATE_ERROR = 3
            LIFETIME_ERROR = 4
            LIFETIME_DYNPRO_DYNPRO_LINK = 5.
    if sy-subrc ne 0.

    ENDif.
    mycontainer = 'TEDITOR'.

    create object editor
          exporting
           parent = TextEdit_Custom_Container
           WORDWRAP_MODE =
              cl_gui_textedit=>wordwrap_at_fixed_position
           WORDWRAP_POSITION = line_length
           wordwrap_to_linebreak_mode = cl_gui_textedit=>true.

    container_linked = 1.

    refresh mytable.

  ENDIF.



ENDMODULE.                 


MODULE pai INPUT.
case ok_code.

WHEN 'SAVE'.
clear: txt.
      call method editor->get_text_as_r3table
              importing table = mytable.

      loop at mytable into wa.

         concatenate txt wa into txt
         separated by '|'.
      endloop.

      shift txt left.
      length = strlen( txt ).


      ztext-CLUSTR = length.
      ztext-text   = txt.

      modify ztext.

      clear: ztext.
      refresh: mytable.
        call method editor->set_text_as_r3table
              exporting table = mytable.
      Message s000(zwa).

when 'DISP'.


      select single * from
      ztext
      where fund = ztext-fund.



     SPLIT ztext-text AT '|' INTO TABLE mytable.




        call method editor->set_text_as_r3table
              exporting table = mytable.






endcase.

clear: ok_code.

ENDMODULE.  </b>

Regards,

Wasim Ahmed

Read only

Former Member
0 Likes
2,453

Hi Sam

You have to use long text.

Read only

Laxmana_Appana_
Active Contributor
0 Likes
2,453

Hi,

if the field length is unlimited .

1.you need to create text object and link this object

with key fields of the table and reading this text and storing this text you need to use SAVE_TEXT and READ_TEXT fm's.

Or

2. Create a field with data type 'LCHR' and specify length 1000 characters , (if you can estimate the maximum possible length), whenever you are creating 'LCHAR' field , before to this field you need to create 'INT2' data type field.

Regards

Appana

Read only

0 Likes
2,453

1.you need to create text object and link this object

with key fields of the table and reading this text and storing this text you need to use SAVE_TEXT and READ_TEXT fm's.

<b>How to link the text object with key fields ? could you please explain little clear.</b>

Create a field with data type 'LCHR' and specify length 1000 characters , (if you can estimate the maximum possible length), whenever you are creating 'LCHAR' field , before to this field you need to create 'INT2' data type field.

when ever i am creating 'LCHAR' , before to that field how to create 'INT2' data type field ?

Could you please explain ion detail. I am using this table in my report and alsoI need to create TMG for this table. YOUR ARE APPRECIATED FOR YOUR HELP!

Waiting for ur reply .

Read only

0 Likes
2,453

Hi,

1.create a text object using SE75 transaction .

2.Use FM : SAVE_TEXT to save this data with text object id.(data will be stored into STXH table).

3.Use READ_TEXT to retrive data.

sample code :

DATA: ws_thead LIKE thead,

i_tline LIKE TABLE OF tline WITH HEADER LINE.

data : x_matnr like mara-matnr.

c_mara(4) type c value 'MARA',

c_zid(4) type c value 'Z001'.

MOVE : x_matnr TO ws_thead-tdname, <b><-moving MATNR to store data</b>

c_mara TO ws_thead-tdobject,

sy-langu TO ws_thead-tdspras,

c_zid TO ws_thead-tdid.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

client = sy-mandt

header = ws_thead

savemode_direct = 'X'

TABLES

lines = i_tline

EXCEPTIONS

id = 1

language = 2

name = 3

object = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

  • WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

DATA: lws_id LIKE thead-tdid,

lws_name LIKE thead-tdname,

lws_object LIKE thead-tdobject.

lws_id = c_zid.

lws_name = x_matnr. <b><- reading data using key field(MATNR)</b>

lws_object = c_mara.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = lws_id

language = sy-langu

name = lws_name

object = lws_object

TABLES

lines = li_tline

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

IF sy-subrc <> 0.

  • MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

  • WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Regards

Appana

*Reward points for useful answers

Message was edited by: L Appana

Read only

0 Likes
2,453

in you suggestion :

"Create a field with data type 'LCHR' and specify length 1000 characters , (if you can estimate the maximum possible length), whenever you are creating 'LCHAR' field , before to this field you need to create 'INT2' data type field."

when ever i am creating 'LCHAR' , <b>before to that field how to create 'INT2' data type field</b> ?

Could you please explain in detail. I am using this table in my report and alsoI need to create TMG for this table. If i do as u said , my table maintenance generator will work ? YOUR HELP IS APPRECIATED. PLEASE HELP ME TO SOLVE MY PROBLEM!

Waiting for ur reply .