Skip to Content
author's profile photo Former Member
Former Member

Using the METHOD textnote_editor->limit_text

Hi guys,

I'm trying to use the method "textnote_editor->limit_text" to limit the rows in the text box, but there is an error message that this method is "Protected or Private". How can I use it or limit the rows in my text box ?

Best Regards.

Carlos Lima.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Feb 09, 2010 at 01:31 PM

    Hi Carlos,

    if you are talking about SAP standard class CL_GUI_TEXTEDIT, then you could create a new class INHERITED FROM CL_GUI_TEXTEDIT. Then you can use the protected method LIMIT_TEXT inside any new method.

    CLASS LCL_TEXTEDIT DEFINITION INHERITING FROM CL_GUI_TEXTEDIT.
    PUBLIC SECTION.
      methods MY_LIMIT_TEXT
        importing
          MAX_NUMBER_CHARS type I
        exceptions
          ERROR_CNTL_CALL_METHOD .
    
    ENDCLASS.
    CLASS LCL_TEXTEDIT IMPLEMENTATION.
      method my_limit_text.
        limit_text( MAX_NUMBER_CHARS ).
      endmethod.
    ENDCLASS.

    Now you have a public method. But as you do not describe your questions details, i have doubts that this solution works for you.

    Regards,

    Clemens

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Carlos,

      what ever you did.

      I just copied my code to a test program - no syntax error. That means I can use method MY_LIMIT_TEXT.

      BUT: TXW_TEXTNOTE_EDIT can not save a text.

      You can count the characters in the table returned and issue an error message instead of saving if there are too many.

      * before saving...
      field-symbols:
       <TXW_NOTE> type TXW_NOTE.
      data:
        lv_charcount type sy-tleng.
      loop at lT_TXWNOTE assigning <TXW_NOTE>,
         lv_charcount  =  lv_charcount  + strlen( <TXW_NOTE>-LINE ).
      endloop.
      if  lv_charcount  > lv_maxchars.
      ... MESSAGE Ennn(ZXY) with ...
      endif.

      Something like that.

      Regards,

      Clemens

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.