on 06-01-2011 5:30 AM
Hi all,
How to make an input field automatically capitalized after user enters a value? Thanks.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
it depends on the data element of the attribute to which you bind the input field.
regards,
sahai.s
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Siong,
If you want to convert the first character in to the Uppercase you have to write a logic by your own. It is very simple.
You can try out following code:
data : in_str(50) value 'sample test'.
data : itab(50) occurs 0 with header line.
data : out_str(50).
split in_str at space into table itab.
loop at itab.
translate itab+0(1) to upper case.
concatenate out_str itab into out_str separated by space.
endloop.
write : / out_str.
It will return the sample test as Sample Test. You can use this code in your application and can change the case of the context attribute
Regards
Abhinav
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.