Application Development 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: 

moving data from 1 internal tab to other using corresponding(including case statement to manipulate field) in abap 740

former_member445418
Discoverer
0 Kudos

Hi,

i have moved records from 1 internal table to other using corresponding statement like

it = corresponding#(field1 = field1)

along with this i need to manipulate 1 field like

above is working fine

it = corresponding#(field1 = field1 case field2

                                                 when '1'

                                                 field3 = 'good'

                                                 else

                                                 field3 = bad)

but this i cant able to achieve

pls help

1 REPLY 1

ThomasKruegl
Participant
0 Kudos

Unfortunately, CORRESPONDING is not capable of that unt il now, it just deals with field names, nothing about content.

You can do something like:

it = value #( for wa in it_old value #( base corresponding #(  wa [mapping if necessary] ) field3 =  cond #( when wa-field2 = '1' then 'good' else 'bad'  )  )  ).

edit: I think you could also turn it around, not sure what's better:

it = value #( for wa in it_old corresponding #(  base ( value #( field3 = cond #( when wa-field2 = '1' then 'good' else 'bad'  ) ) ) wa [mapping excluding special fields if necessary] ).

I just wrote this here in the editor to get the idea, maybe you have to fix the syntax.

In the end, it is nothing else than this:

-> loop at it_old into

-> move corresponding wa to new_wa

-> manipulate fields

-> add new_wa to new_table

kind regards,

Thomas