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 problem

Former Member
0 Likes
1,365

hi abapers

how to change the SEP(upper case to) to Sep (sentence case).

can we use translate stmt if so, pls explain how to do.

Thanks in advance

Regards

rajaram

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,340

Hi,

you can use translate st to change the string to either upper or lower case

translate variable to upper case.

translate variable to lower case.

thanks & regards,

Venkatesh

14 REPLIES 14
Read only

Former Member
0 Likes
1,341

Hi,

you can use translate st to change the string to either upper or lower case

translate variable to upper case.

translate variable to lower case.

thanks & regards,

Venkatesh

Read only

0 Likes
1,340

we can convert upper to lower using translate,

but how to convert upper or lower to sentence case.

for example,

SEP -> Sep

sep -> Sep

Regards

Rajaram

Read only

0 Likes
1,340

Hi,

data:str(10) value 'number'.

translate str to lower case.

translate str+0(1) to upper case.

write:/ str.

(or)

data:str(10) value 'number'.

CALL FUNCTION 'STRING_UPPER_LOWER_CASE'

EXPORTING

DELIMITER = ' '

STRING1 = str

IMPORTING

STRING = str.

write:/ str.

<b>reward if helpful</b>

rgds,

bharat.

Read only

0 Likes
1,340

hi everyone

please understand my case, i want to convert as follows

SEPTEMBER -> September (first letter upper remaining lower)

september -> September (first letter upper remaining lower)

Not for upper to lower, or lower to upper. give me a way.

Regards

Rajaram

Read only

0 Likes
1,340

Hi Rajaram..

There is no direct command or FM for this...as of my idea..

So you can use this code to get the Same functionality .. Try it first..

Data v_str(20) value 'HOW ARE YOU'.

Translate V_STR to lower case.

Tranlate v_str(1) to Upper case.

Write : v_str.

<b>Reward if Helpful</b>

Read only

0 Likes
1,340

Hi Raja,

Use the below code.

DATA: v_text(20) TYPE c,

v_length TYPE i,

v_diff TYPE i,

v_text_new(20) TYPE c.

v_text = 'SEPTEMBER'.

v_length = STRLEN( v_text ).

v_text_new = v_text.

IF v_length > 1.

v_diff = v_length - 1.

TRANSLATE v_text_new+0(1) TO UPPER CASE.

TRANSLATE v_text_new+1(v_diff) TO LOWER CASE.

ELSE.

TRANSLATE v_text_new+0(1) TO UPPER CASE.

ENDIF.

write:/ v_text_new.

Read only

0 Likes
1,340
hi Raja,

 Hope u had checked my solution above,

try this it will work for both cases

REPORT YCHATEST2.


DATA : V_STR1(250) VALUE 'september',
       V_STR2(250).

CALL FUNCTION 'STRING_UPPER_LOWER_CASE'
  EXPORTING
    DELIMITER = ' '
    STRING1   = V_STR1
  IMPORTING
    STRING    = V_STR1
  EXCEPTIONS
    NOT_VALID = 1
    TOO_LONG  = 2
    TOO_SMALL = 3
    OTHERS    = 4.

WRITE : V_STR1.
Read only

Former Member
0 Likes
1,340

hi,

data: text type string.

text = 'SEP'.

translate text to lower case.

write:/ text.

reward if helpful.

Read only

varma_narayana
Active Contributor
0 Likes
1,340

Hi rajaram..

Try this way..

Data v_str(20) value 'HOW ARE YOU'.

Translate V_STR to lower case.

Tranlate v_str(1) to Upper case.

Write : v_str.

<b>reward if Helpful</b>

Read only

Former Member
0 Likes
1,340

Hi,

Use the below code.

data: v_month like t247-ltx,

month_names like t247 occurs 0 with header line.

CALL FUNCTION 'MONTH_NAMES_GET'

EXPORTING

LANGUAGE = SY-LANGU

  • IMPORTING

  • RETURN_CODE = RETURN_CODE

TABLES

MONTH_NAMES = MONTH_NAMES

EXCEPTIONS

MONTH_NAMES_NOT_FOUND = 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.

read table month_names with key spras = sy-langu

mnr = sy-datum+4(2).

if sy-subrc = 0.

v_month+0(3) = month_names-ltx.

endif.

write:/ 'Month = ', v_month.

Read only

Former Member
0 Likes
1,340

Hi,

try this:

data: str(25).

data: le type i.

*

str = 'MUSTER'.

le = strlen( str ).

le = le - 1.

*

write: / str.

translate str+1(le) to lower case.

write: / str.

Regards, Dieter

Read only

Former Member
0 Likes
1,340

Using Transalate you can do this.

Translate strng to lower case.

Translate Strng+(1) to Upper case.

Will solve.

Note: Before using translate statement. Use stement ; SET language "EN".

Reward If helpful.

Cheers,

Jaleel.

Read only

Former Member
0 Likes
1,340
Hi Raja,

 you can also try this in addition to above solutions

REPORT YCHATEST2.

DATA : V_STR1(250) VALUE 'mark',
       V_STR2(250).

CALL FUNCTION 'STRING_UPPER_LOWER_CASE'
  EXPORTING
    DELIMITER = ' '
    STRING1   = V_STR1
  IMPORTING
    STRING    = V_STR1
  EXCEPTIONS
    NOT_VALID = 1
    TOO_LONG  = 2
    TOO_SMALL = 3
    OTHERS    = 4.

WRITE : V_STR1.
Read only

Former Member
0 Likes
1,340

Hi Raja,

Try this

Use the function module : STRING_UPPER_LOWER_CASE

Thanks