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 values in internal table

Former Member
0 Likes
1,445

Hi All!

I am having a internal table and the column <b>version</b> in the int. table will have the following fixed values.

1) Y-1

2) Y-2

3) Y-3

4) Y-4

5) Y-5

Now if the column value is Y-1 than i have to changes it to Y-2 ,if y-2 then to Y-3 and so on...Please advise,

Regards

Praneeth

<b></b>

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
562

Hi praneeth,

1. this is one way.

2. just copy paste, and it will do this.

3.

report abc.

data : begin of itab occurs 0,

abc(5) type c,

end of itab.

data : myval type c.

*----


itab-abc = 'Y-1'.

append itab.

itab-abc = 'Y-2'.

append itab.

itab-abc = 'Y-3'.

append itab.

itab-abc = 'Y-4'.

append itab.

itab-abc = 'Y-5'.

append itab.

*----


loop at itab.

myval = itab-abc+2(1).

myval = myval + 1.

concatenate itab-abc(2) myval into itab-abc.

modify itab.

endloop.

break-point.

regards,

amit m.

4 REPLIES 4
Read only

Former Member
0 Likes
562

i dont think you should do direc increment (will give undesired results).

you can however-

split (field) at - into vara varb.

store varb into varc ( varc is of type i ).

increment varc.

concatenate vara varc into (field) separated by '-'.

modify this value in internal table using MODIFY statement.

Read only

LucianoBentiveg
Active Contributor
0 Likes
562

Use a new column, VERSION_AUX, and make the changes in this new column. After that refresh values from column VERSION with values from column VERSIN_AUX.

Regards.

Read only

Former Member
0 Likes
562

Hi can you add one more field to your internal table.

if yes use a flag bit.

loop at i_tab.

if i_tab-flag ne 'X'.

case i_tab-value.

when 'Y1'

i_tab-value = 'Y2'.

i_tab-flag = 'X'.

modify i_tab.

when 'Y2'.

and so on...

reward if you find this hlpful.

Regards,

Sumit.

Read only

Former Member
0 Likes
563

Hi praneeth,

1. this is one way.

2. just copy paste, and it will do this.

3.

report abc.

data : begin of itab occurs 0,

abc(5) type c,

end of itab.

data : myval type c.

*----


itab-abc = 'Y-1'.

append itab.

itab-abc = 'Y-2'.

append itab.

itab-abc = 'Y-3'.

append itab.

itab-abc = 'Y-4'.

append itab.

itab-abc = 'Y-5'.

append itab.

*----


loop at itab.

myval = itab-abc+2(1).

myval = myval + 1.

concatenate itab-abc(2) myval into itab-abc.

modify itab.

endloop.

break-point.

regards,

amit m.