2007 May 31 7:40 AM
Hi Experts,
My requirement is that to Diaplay Name like
Feroz Mehta if the input given is FEROZ MEHTA or feroz mehta.
I am using the Standard Function Module
STRING_UPPER_LOWER_CASE
But the out put which I am getting is FerozMehta, I am getting no space between the two names.
Can you please advice me how to get the desire output.
Thanks in Advance.
Regards,
Iff
Hi,
in FM
two import parameters are there one is string and one delimeter
YOU are passing only sring not delimeter
do like this
pass ' ' in delimeter
CALL FUNCTION 'STRING_UPPER_LOWER_CASE'
EXPORTING
delimiter = ' '
string1 =
IMPORTING
STRING =
regards,
sudha
rewrd points if useful
EXCEPTIONS
NOT_VALID = 1
TOO_LONG = 2
TOO_SMALL = 3
OTHERS = 4
2007 May 31 7:50 AM
try like this
data : text(30) value 'feroz mehta',
first(15),
last(15).
split text at space into first last.
CALL FUNCTION 'STRING_UPPER_LOWER_CASE'
EXPORTING
DELIMITER = space
STRING1 = first
IMPORTING
STRING = first
* EXCEPTIONS
* NOT_VALID = 1
* TOO_LONG = 2
* TOO_SMALL = 3
* OTHERS = 4
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'STRING_UPPER_LOWER_CASE'
EXPORTING
DELIMITER = space
STRING1 = last
IMPORTING
STRING = last
* EXCEPTIONS
* NOT_VALID = 1
* TOO_LONG = 2
* TOO_SMALL = 3
* OTHERS = 4
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
clear text.
concatenate first last into text separated by space.
write : / text.
regards
shiba dutta
2007 May 31 7:58 AM
use belwo piece of code and provide any name at selection screen, it wil change it to sentence case (as per ur requirement), just copy n paste this code.
REPORT ZGILL2 .
data: len type i,
len1 type i.
PARAMETER: name(35).
data: var1(35),
var2(35).
data count type i.
count = 1.
shift name left deleting leading space.
do 35 times.
if var2 = space and count ne 1.
exit.
endif.
count = count + 1.
split name+len1 at SPACE into
var1 var2.
len = strlen( var1 ).
translate var1 to lower case.
translate var1(1) to upper case.
if not len eq 0.
name+len1(len) = var1.
endif.
len1 = len1 + len + 1.
clear: var1, len.
enddo.
write: name.
2007 May 31 7:55 AM
Hi,
in FM
two import parameters are there one is string and one delimeter
YOU are passing only sring not delimeter
do like this
pass ' ' in delimeter
CALL FUNCTION 'STRING_UPPER_LOWER_CASE'
EXPORTING
delimiter = ' '
string1 =
IMPORTING
STRING =
regards,
sudha
rewrd points if useful
EXCEPTIONS
NOT_VALID = 1
TOO_LONG = 2
TOO_SMALL = 3
OTHERS = 4
2007 May 31 7:57 AM
Hi IFF,
You can use the FM <b>SWA_STRING_TO_UPPERCASE</b> when caliing the FM set the parameter PRESERVE_EXISTING_CAPITALS to blank.
Regards
Arun
2007 May 31 7:58 AM
HI,
just execute this code and see
parameters:text(20).
DATA:LEN(2) TYPE N.
DATA:NUMB(2) TYPE N,M(2) TYPE N.
NUMB = 0.
LEN = STRLEN( TEXT ).
LEN = LEN - 1.
TRANSLATE TEXT+1(LEN) TO LOWER CASE.
DO LEN TIMES.
IF TEXT+NUMB(1) = SPACE."SEARCHING FOR SPACES AND MAKING NEXT CHAR CAPITAL
M = NUMB + 1.
TRANSLATE TEXT+M(1) TO UPPER CASE.
ENDIF.
NUMB = NUMB + 1.
ENDDO.
write:/ text.
rgds,
bharat
2007 Jun 18 5:46 PM
Have you tried Fucntion Module: SWA_STRING_TO_UPPERCASE.
(be sure to un-check import parameter PRESERVE_EXISTING_CAPITALS.
Here is documentation on the function module:
Given a string, translate the first character of each alphapecical
substring to upper case. Every non-alphabetical character
is interpreted as a separator. Every alphabetical character that
immediately follows a separator is converted to upper case. The
first character is always converted to upper case.
Examples:
'abcde' -> 'Abcde'
'abc_001_def(xyz)->name01attr' -> 'Abc_001_Def->Name01Attr'
2007 Jun 18 6:29 PM
Hi jay,
forget it - can't be run under newer releases (not unicode-capable).
I'd try:
FORM ucase .
DATA:
lv_string TYPE text80 VALUE 'osama bin ladn',
lt_string TYPE TABLE OF text80 WITH HEADER LINE.
SPLIT lv_string AT space INTO TABLE lt_string.
CLEAR lv_string.
LOOP AT lt_string.
TRANSLATE lt_string(1) TO UPPER CASE.
IF sy-tabix = 1.
* avaoid preceding space in result
lv_string = lt_string.
ELSE.
CONCATENATE lv_string lt_string INTO lv_string SEPARATED BY space.
ENDIF.
ENDLOOP.
ENDFORM. " ucase
Excuse political incorrectness - it works.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |