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: 

move from 1 table to qther table

Former Member
0 Kudos

I HAVE A TWO TABLES (ONE WITH 10 FIELDS ERROR_ITAB AND ONE WITH 5 FIELDS E_ITAB ) WITH WA AND I WONT TO MOVE ERROR ITAB TO E_ITAB HOW CAN I DO THAT ? ERROR ITAB HAVE THE SAME FIELDS AND MORE LIKE E_ITAB .

8 REPLIES 8

suresh_datti
Active Contributor
0 Kudos

use MOVE-CORRESPONDING

~Suresh

0 Kudos

i try it didnt work

0 Kudos

To use MOVE-CORRESPONDING I believe you need to be using tables with header-lines.

You can try something like this:

LOOP AT ITAB1 INTO WA_ITAB1.
  MOVE WA_ITAB1-FIELD1 TO WA_ITAB2-FIELD1.
  MOVE WA_ITAB1-FIELD2 TO WA_ITAB2-FIELD2.
    ETC....
  APPEND WA_ITAB2 TO I_ITAB2.
ENDLOOP.

0 Kudos

Can you post your table definitions?

0 Kudos

this is my 2 table and i wont to move after the select error_itab into err_itab how can i do that ?

TYPES:BEGIN OF 5_itab,

action TYPE massn,

infty TYPE infotyp,

pernr TYPE persno,

orgeh TYPE orgeh,

plans TYPE plans,

stell TYPE stell,

begda TYPE begdatum,

endda TYPE enddatum,

action_2 TYPE massn,

reson_action TYPE massg,

begda_2 TYPE begdatum,

endda_2 TYPE enddatum,

personnel_area TYPE persa,

employee_group TYPE persg,

employee_subgroup TYPE persk,

personnel_subarea TYPE btrtl,

ansvh TYPE ansvh,

plans_2 TYPE plans,

description(40) TYPE c,

END OF 5_itab.

DATA: error_itab TYPE TABLE OF 5_itab,

wa_error_itab LIKE LINE OF error_itab.

*----


  • error table

*----


TYPES :BEGIN OF itab_5,

pernr TYPE persno,

plans TYPE plans,

ansvh TYPE ansvh,

werks TYPE persa,

btrtl TYPE btrtl_001p,

description(40) TYPE c,

END OF itab_5.

DATA: err_itab TYPE TABLE OF itab_5,

wa_err_itab LIKE LINE OF err_itab.

0 Kudos

Since the fields are out of order, you'll need to do it manually.


LOOP AT error_itab INTO wa_error_itab.
  MOVE-CORRESPONDING wa_error_itab TO wa_err_itab.
  MOVE: wa_error_itab-personnel_area TO wa_err_itab-werks,
        wa_error_itab-personnel_subarea TO wa_err_itab-btrtl.
  APPEND wa_err_itab.
ENDLOOP.

Message was edited by: Michael Malvey

Former Member
0 Kudos

If the first 5 fields of e_itab are defined exactly like the the first 5 of error_itab, and in the same order, you could move it directly:

e_itab[] = error_itab[].

The trailing fields will simply be truncated.

Message was edited by: Michael Malvey

Former Member
0 Kudos

Hi,

loop at error_tab.

move-corresponding error_tab to e_itab.

append e_itab.

clear e_itab.

endloop.

Regards

Amole