Application Development and Automation 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: 
Read only

Case: upper case

Former Member
0 Likes
883

i need to display the first character as uppercase and followed by lower case.

for eg: Sdn Sap Com

7 REPLIES 7
Read only

Former Member
0 Likes
847

Hi..

w_text(3) type c Value 'sdn'.

<b>translate w_text+0(1) to upper case.</b>

write: w_text.

Read only

0 Likes
847

Hi..

<b>data:

w_text(30) type c value 'sdn sap com',

w_len type i,

w_offset type i.

w_len = strlen( w_text ).

translate w_text+0(1) to upper case.

do w_len times.

w_offset = sy-index - 1.

if w_text+w_offset(1) eq SPACE.

translate w_text+sy-index(1) to upper case.

endif.

enddo.

write: w_text.</b>

Read only

Former Member
0 Likes
847

try the fm STRING_UPPER_LOWER_CASE

Read only

Former Member
0 Likes
847

Please, read my weblog -:)

<a href="/people/alvaro.tejadagalindo/blog/2006/12/21/does-abap-lacks-of-string-processing">Does ABAP lacks of String processing?</a>

Greetings,

Blag.

Read only

Former Member
0 Likes
847

hi sathish,

u can use Translate stmt.

Translate str to uppercase.

Regards...

Arun.

Reward points if useful.

Read only

Former Member
0 Likes
847

Hi..,

Execute this code.. its Working..

<b>parameters P_test(30) type c.

data w_word(30) type c.

data w_result(30) type c.

while P_test ne space.

split p_test at ' ' into w_word p_test.

translate w_word+1 to lower case.

translate w_word(1) to upper case.

condense w_word no-gaps.

concatenate w_result w_word into w_result separated by space.

endwhile.

WRITE W_RESULT.</b>

<i>****************************

Input : sai ramesh abap YASH

Output : Sai Ramesh Abap Yash

************************************</i>

regards,

sai ramesh

Read only

Former Member
0 Likes
847

Hi,

check this code.

data:text(30).

DATA:LEN(2) TYPE N.

DATA:N(2) TYPE N,M(2) TYPE N.

text = 'ghjgahgf sgjfdshj hsdfkgj'.

N = 0.

LEN = STRLEN( TEXT ).

LEN = LEN - 1.

TRANSLATE TEXT+1(LEN) TO LOWER CASE.

translate text+0(1) to upper case.

DO LEN TIMES.

IF TEXT+N(1) = SPACE."SEARCHING FOR SPACES AND MAKING NEXT CHAR CAPITAL

M = N + 1.

TRANSLATE TEXT+M(1) TO UPPER CASE.

ENDIF.

N = N + 1.

ENDDO.

write:/ text.

regards,

bharat.