Skip to Content

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

how to make first character of an input field capitalized?

Hi all,

How to make an input field automatically capitalized after user enters a value? Thanks.

Former Member
Former Member replied

Hi,

you can do this by using FM.. 'SWA_STRING_TO_UPPERCASE'

DATA: OUTPUT TYPE STRING.
CALL FUNCTION 'SWA_STRING_TO_UPPERCASE'
 EXPORTING
   INPUT_EXPRESSION                 = 'WEBDYNPRO'
*   INPUT_STRING                     =
   PRESERVE_EXISTING_CAPITALS       = ''
   CAPITALIZE_AFTER_SPACE           = 'X'
   LANGUAGE                         = SY-LANGU
 IMPORTING
   OUTPUT_STRING                    = OUTPUT
*   OUTPUT_EXPRESSION                =
 EXCEPTIONS
   EXPRESSION_TRUNCATED             = 1
  OTHERS                           = 2
          .
IF sy-subrc  0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

OR

You can do by using TRANSLATE Command, you need to use some logic.

data : TEXT(10) type C.

data : T type C.

TEXT = kris'.

move TEXT+0(1) to T.

translate T to upper case.

concatenate T TEXT+1(9) into TEXT.

write : TEXT.

Cheers,

Kris.

Edited by: kissnas on Jun 1, 2011 7:06 AM

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question