Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to use protected method of a class in application

Hi,

will u please tell me how to use protected method of class in application. (class:cl_gui_textcontrol, method:limit_text)

Thanks in advance,

Praba.

Tags:
Former Member
Former Member replied

Hi Prabha,

You can set the maximum number of characters in a textedit control in the CREATE OBJECT statement itself.

Just see the first parameter in the method . I mean MAX_NUMBER_CHARS. Just set that value to the required number.

Eg:

data: edit type ref to CL_GUI_TEXTEDIT.

create object edit

exporting

MAX_NUMBER_CHARS = 10

  • STYLE = 0

  • WORDWRAP_MODE = WORDWRAP_AT_WINDOWBORDER

  • WORDWRAP_POSITION = -1

  • WORDWRAP_TO_LINEBREAK_MODE = FALSE

  • FILEDROP_MODE = DROPFILE_EVENT_OFF

parent = OBJ_CUSTOM_CONTAINER

  • LIFETIME =

  • NAME =

EXCEPTIONS

ERROR_CNTL_CREATE = 1

ERROR_CNTL_INIT = 2

ERROR_CNTL_LINK = 3

ERROR_DP_CREATE = 4

GUI_TYPE_NOT_SUPPORTED = 5

others = 6

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

In this case, the max: number of characters will be set to 10.

I hope your query is solved.

Regards,

SP.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question