2007 Mar 20 7:46 PM
Hi
Could some one help me with a standard code which will have following functionalities.
1. Move data from one table to other (structures might be same or diff)
Mapping fields will be stored in a seperate control table
2. Data might be moved between two systems by doing a RFC connection.
Thanks for your reply.
I would be happy if the point 1 is covered. we can go to point 2 later.
Regards, Mey
2007 Mar 20 8:08 PM
Hi
I don't know if there's a function to transfer the data, but you can create something like this:
TABLES: TAB1, TAB2.
DATA: BEGIN OF T_MAPPING OCCURS 0,
FROM_FIELD(30),
TO_FIELD(30),
END OF T_MAPPING.
FIELD-SYMBOLS: <FROM> TYPE ANY,
<TO> TYPE ANY.
DATA: ITAB1 LIKE STANDARD TABLE OF TAB1,
ITAB2 LIKE STANDARD TABLE OF TAB2.
SELECT * FROM TAB1 INTO TABLE ITAB1.
LOOP AT ITAB1 INTO TAB1.
LOOP AT T_MAPPING.
ASSIGN COMPONENT T_MAPPING-FROM_FIELD OF STRUCTURE TAB1 TO <FROM>.
IF SY-SUBRC = 0.
ASSIGN COMPONENT T_MAPPING-TO_FIELD OF STRUCTURE TAB2 TO <TO>.
IF SY-SUBRC = 0.
<TO> = <FROM>
ENDIF.
ENDIF.
ENDLOOP.
APPEND TAB2 TO ITAB2.
ENDLOOP.
INSERT TAB2 FROM TABLE ITAB2.
To transfer the data from two systems, it depends on the systems, in generally the RFC function module has to be in the called system.
Max