Application Development 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: 

pls tell fun module

Former Member
0 Kudos

hi friends

pls tell fun module to convert the first character of the word into upper case and tell the parameters to be passed

pls give one example

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Sunil,

Check this info.

Change characters within a string (TRANSLATE)

The translate command allows you to convert characters within a string from one character to another.

i.e. Convert 28.10.1979 to 28-10-1979

Convert to UPPER/LOWER CASE

*Code to Replace one char with another using TRANSLATE command

*----


DATA: ld_date(10) type c.

ld_date = '28.10.1979'.

*Finds all occurences of first char(.) & replaces them with second(-)

TRANSLATE ld_date using '.-'.

*ld_date will now contain '28-10-1979'

*Code to demonstrate TRANSLATE to UPPER/LOWER CASE command

*----


DATA: ld_char(20) type c.

ld_char = 'Hello World'.

TRANSLATE ld_char TO UPPER CASE. "Result: ld_char = 'HELLO WORLD'

TRANSLATE ld_char TO LOWER CASE. "Result: ld_char = 'hello world'

Hope this resolves your query.

<b>Reward all the helpful answers.</b>

Regards

6 REPLIES 6

Former Member
0 Kudos
No need of FM , just use this..

Data : v_char(5) value 'abcde'.

TRANSLATE V_CHAR+0(1) TO UPPER CASe.

WRITE : V_CHAR.

Former Member
0 Kudos

Use the FM STRING_UPPER_LOWER_CASE and pass the below parameters:

Import parameters Value

DELIMITER 0

STRING1 ESWAR

Export parameters Value

STRING Eswar

Thanks

Eswar

former_member181962
Active Contributor
0 Kudos

If you want that to happen for each word in your sentence, then yo can use

STRING_UPPER_LOWER_CASE.

Regards,

Ravi

Former Member
0 Kudos

Use Translate Statement

Converting to Upper or Lower Case or Replacing Characters

The TRANSLATE statement converts characters into upper or lower case, or uses substitution rules to convert all occurrences of one character to another character.

Converting to Upper or Lower Case

TRANSLATE <c> TO UPPER CASE.

TRANSLATE <c> TO LOWER CASE.

These statements convert all lower case letters in the field <c> to upper case or vice versa.

Substituting Characters

TRANSLATE <c> USING <r>.

This statement replaces all characters in field <c> according to the substitution rule stored in field <r> . <r> contains pairs of letters, where the first letter of each pair is replaced by the second letter. <r> can be a variable.

For more variants of the TRANSLATE statement with more complex substitution rules, see the keyword documentation in the ABAP Editor.

DATA: T(10) VALUE 'AbCdEfGhIj',

STRING LIKE T,

RULE(20) VALUE 'AxbXCydYEzfZ'.

STRING = T.

WRITE STRING.

TRANSLATE STRING TO UPPER CASE.

WRITE / STRING.

STRING = T.

TRANSLATE STRING TO LOWER CASE.

WRITE / STRING.

STRING = T.

TRANSLATE STRING USING RULE.

WRITE / STRING.

Output:

AbCdEfGhIj

ABCDEFGHIJ

abcdefghij

xXyYzZGhIj

http://help.sap.com/saphelp_erp2005/helpdata/en/fc/eb33a5358411d1829f0000e829fbfe/frameset.htm

Regards,

navjot

Note: Please Mark the Helpful Answers

Former Member
0 Kudos

Hi Sunil,

Check this info.

Change characters within a string (TRANSLATE)

The translate command allows you to convert characters within a string from one character to another.

i.e. Convert 28.10.1979 to 28-10-1979

Convert to UPPER/LOWER CASE

*Code to Replace one char with another using TRANSLATE command

*----


DATA: ld_date(10) type c.

ld_date = '28.10.1979'.

*Finds all occurences of first char(.) & replaces them with second(-)

TRANSLATE ld_date using '.-'.

*ld_date will now contain '28-10-1979'

*Code to demonstrate TRANSLATE to UPPER/LOWER CASE command

*----


DATA: ld_char(20) type c.

ld_char = 'Hello World'.

TRANSLATE ld_char TO UPPER CASE. "Result: ld_char = 'HELLO WORLD'

TRANSLATE ld_char TO LOWER CASE. "Result: ld_char = 'hello world'

Hope this resolves your query.

<b>Reward all the helpful answers.</b>

Regards

former_member673464
Active Contributor
0 Kudos

hi..

check the function module SWA_STRING_TO_UPPERCASE to convert uppercase to title case

for titlecase..

PARAMETER->PRESERVE_EXISTING_CAPITALS = SPACE.

regards,

veeresh