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: 

ITAB to WA

Former Member
0 Kudos

Hi,

I have an ITAB that have the following Header:

First_Name

Last_Name

Contact

I have an WA that only have component:

Contact

Is it possible to Loop at ITAB and assgin the corresponding field into WA ?

What the code look like?

Regards,

Rayden

6 REPLIES 6

former_member386202
Active Contributor
0 Kudos

Hi,

I think no becoz work area conatins only one record at a time.

Regards,

Prashant

Former Member
0 Kudos

hi,

whenever you read the content from the ITAB, the WA structure should be same as the ITAB header. you cannot corresponding fields from itab into WA.

Regards,

former_member387317
Active Contributor
0 Kudos

Hi Rayden,

Declare WA as another internal table lets say itab2.

itab1 contains FNAME LNAME and Contact.

itab2 contains only contact...

then

Loop at itab1.

*clear itab2-contact.

itab2-contact = itab1-contact

append itab2.

Endloop.

Hope it will solve ur problem

<b>Reward points if useful</b>

Thanks & Regards

ilesh 24x7

Former Member
0 Kudos

Hi,

U can try to concatenate First_Name

Last_Name INTO CONTACT .

U can just have contact field in the internal table .

Regards,

Subha

Former Member
0 Kudos

if you internal table is having header line...then

you can do like below...

loop at itab.

wa-contact = itab-contact.

endloop.

Otherwise use wa as field symbol with casting keyword.

field-symbols: <fs> like wa.

loop at itab assigning <fs> casting.

endloop.

Former Member
0 Kudos

HI

it is not possible for the above requirement

You need to creat a work area of same size or same fields