11-07-2006 2:49 PM
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 .
11-07-2006 2:51 PM
11-07-2006 2:55 PM
11-07-2006 3:00 PM
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.
11-07-2006 3:01 PM
11-07-2006 3:09 PM
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.
11-07-2006 3:12 PM
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
11-07-2006 2:51 PM
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
11-07-2006 4:05 PM
Hi,
loop at error_tab.
move-corresponding error_tab to e_itab.
append e_itab.
clear e_itab.
endloop.
Regards
Amole