2007 Sep 04 10:56 AM
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
2007 Sep 04 10:59 AM
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
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.
2007 Sep 04 10:59 AM
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
2007 Sep 04 11:02 AM
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
2007 Sep 04 11:17 AM
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.
2007 Sep 04 11:41 AM
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
2007 Sep 04 11:50 AM
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>
2007 Sep 04 11:52 AM
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.
2007 Sep 04 11:57 AM
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.
2007 Sep 04 11:01 AM
hi,
data: text type string.
text = 'SEP'.
translate text to lower case.
write:/ text.
reward if helpful.
2007 Sep 04 11:02 AM
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>
2007 Sep 04 11:02 AM
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.
2007 Sep 04 11:03 AM
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
2007 Sep 04 11:12 AM
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.
2007 Sep 04 11:13 AM
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.
2007 Sep 04 11:15 AM
Hi Raja,
Try this
Use the function module : STRING_UPPER_LOWER_CASE
Thanks
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |