‎2006 Sep 14 3:36 PM
Hi ,
My Program case code in which the data is passed automatically in upper case through the importing parameter.The table data is like every first character of each word in the string is upper and remaining lower .
How should I convert This code?
‎2006 Sep 14 4:23 PM
Hi Sri,
Try following code.
v1 = 'String'.
v2 = 'string'.
v3 = v2.
translate v2 to upper case.
concatenate v20(1) v31(9) into v4.
write:/ v4.
-Anu
‎2006 Sep 14 3:39 PM
It would be easier to translate your table data using the below to upper case.
TRANSLATE lfield to upper case.
Message was edited by: Anurag Bankley
‎2006 Sep 14 3:41 PM
Use Fm STRING_UPPER_LOWER_CASE to convert first char of a word ina string to upper case.
Regards
Sridhar
‎2006 Sep 14 3:45 PM
Thanks Sridhar,
How should I fill in the parameters Can U please help me?
Message was edited by: Sri Y
‎2006 Sep 14 3:51 PM
exporting
delimiter = ' '
String1 = v_string1
IMPORTING
string = v_string
where v_string1 and v_string is of type string or C.
Regards
Sridhar
‎2006 Sep 14 4:12 PM
I get a dump.
<b> Function parameter "STRING" is unknown.</b>
I checked for parameters they are char
‎2006 Sep 14 3:44 PM
Hello,
Use the function module STRING_UPPER_LOWER_CASE and specify the delimiter as SPACE.
OR
If u wanna to convert the entire statement in to CAPITAL letters, then use the statement TRANSLATE.
Regs,
Venkat Ramanan N
‎2006 Sep 14 4:23 PM
Hi Sri,
Try following code.
v1 = 'String'.
v2 = 'string'.
v3 = v2.
translate v2 to upper case.
concatenate v20(1) v31(9) into v4.
write:/ v4.
-Anu
‎2006 Sep 14 4:29 PM
I can't guess how many parts of string are going to be passed.
‎2006 Sep 14 4:51 PM
REPORT ZSRIM_TEMP14.
data : v1 type string,
v2(500) type c.
v1 = 'abcd def ghi'.
v2 = v1.
call function 'STRING_UPPER_LOWER_CASE'
exporting
delimiter = ' '
string1 = v2
IMPORTING
STRING = v2
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.
write :/ v2.
‎2006 Sep 14 4:28 PM
Hi Sri,
Please check this sample code.
DATA: DELIM(40) TYPE C VALUE ' '.
DATA: CON_ANREX LIKE Q0002-ANREX.
CALL FUNCTION 'STRING_UPPER_LOWER_CASE'
EXPORTING
DELIMITER = DELIM
STRING1 = RECORD-ANREX
IMPORTING
STRING = CON_ANREX
EXCEPTIONS
NOT_VALID = 1
TOO_LONG = 2
TOO_SMALL = 3.
IF SY-SUBRC EQ 0.
RECORD-ANREX = CON_ANREX.
ENDIF.Regards,
Ferry Lianto
‎2006 Sep 14 5:07 PM
Hi Ferry,
I didnot use DELIM but used ' ' and the output is correct but without spaces in between the words like this..
ThisIsMyCountry.
How do I split it this?
‎2006 Sep 14 5:07 PM
Try the following code:
data: v_str1 type string,
v_str type string.
v_str1 = 'convert upper lower case'.
call function 'SWA_STRING_TO_UPPERCASE'
exporting
* INPUT_EXPRESSION =
input_string = v_str1
* PRESERVE_EXISTING_CAPITALS = ' '
* CAPITALIZE_AFTER_SPACE = 'X'
* LANGUAGE = SY-LANGU
importing
output_string = v_str
* OUTPUT_EXPRESSION =
exceptions
expression_truncated = 1
others = 2
.
write:/ v_str.REgards
Sridhar
Message was edited by: Sridhar K
‎2006 Sep 14 5:49 PM
I get a dump
<b>Type conflict when calling a function module.</b>
‎2006 Sep 14 6:33 PM
Hey Sridhar,
I cleared the dump but when I debug I get the output as all upper case why?
when I run the FM in se37 ,it shows the exact output I want.
data: v_str1 type string,
v_str type string.
v_str1 = 'convert upper lower case'.
call function 'SWA_STRING_TO_UPPERCASE'
exporting
input_string = v_str1
CAPITALIZE_AFTER_SPACE = 'X'
LANGUAGE = SY-LANGU
importing
output_string = v_str
expression_truncated = 1 others = 2
Message was edited by: Sri Y
‎2006 Sep 14 9:26 PM
set fm parameter PRESERVE_EXISTING_CAPITALS = ' '.
or before calling the fm , convert the string to lower case using.
translate v_str1 to lower case.
Regards
sridhar