cancel
Showing results for 
Search instead for 
Did you mean: 

display first letter as caps and rest in small

Former Member
0 Kudos

hi ,

this is the scenario...i have an internal table in which one field is a character...and the records in the internal table field has names in it..and i have to print in form in the way that first letter is capital and rest is small hear is am example.....

internal table....ITAB with fields...X X X Char.

records in Char...

ron

Tom

dany

aron....

these are retrieved from the data base...so there is no garnets that they are maintained in the way i required...

Records should be printed in this fashion in form...

<b>R</b>on

<b>T</b>om

<b>D</b>any

<b>A</b>ron

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

gopi_narendra
Active Contributor
0 Kudos

U can try it using the TRANSLATE statement

data : TEXT(10) type C.

data : T type C.

TEXT = 'gopi'.

move TEXT+0(1) to T.

translate T to upper case.

concatenate T TEXT+1(9) into TEXT.

write : TEXT.

Just try the above example.

Regards

- Gopi

Message was edited by:

Gopi Narendra

Former Member
0 Kudos

check the function module <b>SWA_STRING_TO_UPPERCASE</b> to convert uppercase to title case

for titlecase..

PARAMETER->PRESERVE_EXISTING_CAPITALS = SPACE.

Former Member
0 Kudos

Thanks...

Answers (1)

Answers (1)

dani_mn
Active Contributor
0 Kudos

HI,

look into this program.

report zwa_test2.

data: begin of itab occurs 0,

        name(10),

      end of itab.

data: a(1).

itab-name = 'ron'.
append itab.
itab-name = 'tom'.
append itab.
itab-name = 'dany'.
append itab.


LOOP AT ITAB.

  a = itab-name(1).
  translate a to upper case.
  itab-name(1) = a.
  write:/ itab-name.

ENDLOOP.

Regards,

Former Member
0 Kudos

It is tested workin fine just copy and paste it and run...

DATA: OUTPUT TYPE STRING.
CALL FUNCTION 'SWA_STRING_TO_UPPERCASE'
 EXPORTING
   INPUT_EXPRESSION                 = 'KISHAN'
*   INPUT_STRING                     =
   PRESERVE_EXISTING_CAPITALS       = ''
   CAPITALIZE_AFTER_SPACE           = 'X'
   LANGUAGE                         = SY-LANGU
 IMPORTING
   OUTPUT_STRING                    = OUTPUT
*   OUTPUT_EXPRESSION                =
 EXCEPTIONS
   EXPRESSION_TRUNCATED             = 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.

kishan negi