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

changing itab to char type

Former Member
0 Likes
1,268

hi mates,

im having an itab which has int, char, decimal types fields in it. now i need to translate the itab to uppercase. when i use the statement " translate itab to uppercase." im getting error stating itab should be of type char.

how can i make the itab of type char. any help will be appreciated...

regards

mano

hi mates,

im having an itab which has int, char, decimal types fields in it. now i need to translate the itab to uppercase. when i use the statement " translate itab to uppercase." im getting error stating itab should be of type char.

how can i make the itab of type char. any help will be appreciated...

regards

mano

10 REPLIES 10
Read only

Former Member
0 Likes
1,232

Hi,

In your case define another internal table of type char having the same structure as itab.Then move the records from itab to new internal table and then apply the statement "translate itab_new to uppercase".

Read only

0 Likes
1,232

hi mate,

thanks for ur reply but still im getting the same error as before.

can u guide me ...

regards

mano

Read only

Former Member
0 Likes
1,232

Hi,

Translate the field only which has type char.

if the field f2 in itab has the type c, use the following syntax before the append statement.

***

translate itab-f2 to upper case.

append itab.

********

Regards,

Bhanu

Read only

Former Member
0 Likes
1,232

hi,

take a internal table of single character field of length that equal to other table length

then using loop amd move statemnts populate the new table

regards

mahesh

Read only

0 Likes
1,232

hi,

can u just elaborate ur solution with some sample code...

bcoz im not getting the clear picture...

regards

mano

Read only

0 Likes
1,232

Hi,

consider you have the workarea of you output table structure.

after assigning all the field value u will do append to internal table.

declare a string type variable

l_string type string.

clear l_string.

l_string = 'abcd'.

translate l_string to uppercase.

wa_output -field1 = l_string.

append wa_output to t_output.

clear wa_output.

Read only

Former Member
0 Likes
1,232

DATA text TYPE string.

text = `Careful with that Axe, Eugene`.

TRANSLATE text TO UPPER CASE

u cant translate a hole itab using this statement...

i think u have go each and every line.....to translate

Reward IF...........

Regards

Anbu

Read only

Former Member
0 Likes
1,232

Hi,

You cannot translate the internal table as a whole to upper case. But you can translate each field in the internal table provided the field is of type Char.


Loop at itab.
 translate itab-field to uppercase.
 modify itab.
Endloop.

Thanks and Regards,

Lakshmi.

Read only

Former Member
0 Likes
1,232

hi ,

in your case you only need to convert the character field to upper case.

So do this,

loop at itab into wtab.

translate wtab-<char field> to upper case.

modify itab from wtab index sy-tabix transporting <charfield>.

endloop.

If u put this chunk of code i think ur problem will be solved.

Read only

Former Member
0 Likes
1,232

Before appending use one temporary string type variable and do the translation, and assign it back