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

internal table and work area!

Former Member
0 Likes
817

hello,

i have a little q...

trough SELECT i get data into my it_1. Can you tell me how to put that data to my itab_custdata (structure) trough work area wa_it and wa_custdata and not to put one by one.

eg.

...

SELECT mkpf~xblnr

mkpf~frath

mkpf~awsys

...

mseg~matnr

mseg~werks

mseg~lgort

...

INTO CORRESPONDING FIELDS OF TABLE it_1

FROM

mkpf AS mkpf

INNER JOIN

mseg AS mseg

ON mkpfmandt = msegmandt AND

...

WHERE

mkpf~cpudt >= '20060301' AND

...

LOOP AT it_1 INTO wa_it.

...

<b>NEED CODE HERE!</b>

APPEND wa_custdata TO itab_custdata.

ENDLOOP.

so i don't need to put one by one like this:

wa_custdata-xblnr = wa_it-xblnr.

wa_custdata-werks = wa_it-werks.

NOTE: other parts of Code is missing, 'cause it's too large...

Message was edited by: Maja Zugaj

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
790

If you keep the field structure(names of the fields) of wa_custdata and wa_it similar than you can use MOVE-CORRESPONDING command instead of individual moves.

MOVE-CORRESPONDING wa_it into wa_custdata.

Regards

Anurag

hello,

i have a little q...

trough SELECT i get data into my it_1. Can you tell me how to put that data to my itab_custdata (structure) trough work area wa_it and wa_custdata and not to put one by one.

eg.

...

SELECT mkpf~xblnr

mkpf~frath

mkpf~awsys

...

mseg~matnr

mseg~werks

mseg~lgort

...

INTO CORRESPONDING FIELDS OF TABLE it_1

FROM

mkpf AS mkpf

INNER JOIN

mseg AS mseg

ON mkpfmandt = msegmandt AND

...

WHERE

mkpf~cpudt >= '20060301' AND

...

LOOP AT it_1 INTO wa_it.

...

<b>NEED CODE HERE!</b>

APPEND wa_custdata TO itab_custdata.

ENDLOOP.

so i don't need to put one by one like this:

wa_custdata-xblnr = wa_it-xblnr.

wa_custdata-werks = wa_it-werks.

NOTE: other parts of Code is missing, 'cause it's too large...

Message was edited by: Maja Zugaj

7 REPLIES 7
Read only

Former Member
0 Likes
790

you can use MOVE CORRESPONDING

MOVE CORRESPONDING wa_it TO ITAB_CUSTDATA

MOVE CORRESPONDING wa_custdata TO ITAB_CUSTDATA

and use APPEND ITAB_CUSTDATA.

clarify bit more about ITAB_CUSTAREA ???

Regards

srikanth

Message was edited by: Srikanth Kidambi

Message was edited by: Srikanth Kidambi

Read only

Former Member
0 Likes
791

If you keep the field structure(names of the fields) of wa_custdata and wa_it similar than you can use MOVE-CORRESPONDING command instead of individual moves.

MOVE-CORRESPONDING wa_it into wa_custdata.

Regards

Anurag

Read only

Former Member
0 Likes
790

Hi,

You can assign it directly provided both work areas have same structure else you have to assign it one by one ( field by field ).

wa_custdata = wa_it.

Best regards,

Prashant

Read only

dani_mn
Active Contributor
0 Likes
790

HI use this to move all fields at once.

<b>MOVE-CORRESPONDING wa_it TO wa_custdata.</b>

Regards,

HRA

Read only

Former Member
0 Likes
790

O.K. I've managed to do that but now when i run my program to check did the alv imported all fields in itab_custdata table i get next error:

...

Field symbol has not yet been assigned.

...

please help!

Read only

Former Member
0 Likes
790

If both the structure of it_1 and itab_custdata are same u can directly use the command:

APPEND lines of it_1 to itab_custdata.

If the both the structure are different:

loop at it_1 into wa_it.

Move corresponding wa_it to wa_custdata.

Append wa_custdata to itab_custdata.

Endloop.

Regards,

Prakash.

Read only

0 Likes
790

O.K. I've managed to do that but now when i run my program to check did the alv imported all fields in itab_custdata table i get next error:

...

Field symbol has not yet been assigned.

...

please help!