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 Sensitive

Former Member
0 Likes
1,627

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?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,459

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

15 REPLIES 15
Read only

Former Member
0 Likes
1,459

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

Read only

sridhar_k1
Active Contributor
0 Likes
1,459

Use Fm STRING_UPPER_LOWER_CASE to convert first char of a word ina string to upper case.

Regards

Sridhar

Read only

0 Likes
1,459

Thanks Sridhar,

How should I fill in the parameters Can U please help me?

Message was edited by: Sri Y

Read only

0 Likes
1,459

exporting

delimiter = ' '

String1 = v_string1

IMPORTING

string = v_string

where v_string1 and v_string is of type string or C.

Regards

Sridhar

Read only

0 Likes
1,459

I get a dump.

<b> Function parameter "STRING" is unknown.</b>

I checked for parameters they are char

Read only

Former Member
0 Likes
1,459

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

Read only

Former Member
0 Likes
1,460

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

Read only

0 Likes
1,459

I can't guess how many parts of string are going to be passed.

Read only

0 Likes
1,459
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.
Read only

Former Member
0 Likes
1,459

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

Read only

0 Likes
1,459

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?

Read only

0 Likes
1,459

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

Read only

0 Likes
1,459

I get a dump

<b>Type conflict when calling a function module.</b>

Read only

0 Likes
1,459

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

Read only

0 Likes
1,459

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