Friday, November 9, 2012

ABAP study ,copy entries from 1 company to others.

Copy record from 1 company code to others.
*&---------------------------------------------------------------------*
*& Report  ZMM_TEXT1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZMM_TEXT1.

TABLES:
  ZMM85TMM01.

DATA:
  LT_TAB1 TYPE STANDARD TABLE OF ZMM85TMM01,
  LT_TAB2 TYPE STANDARD TABLE OF ZMM85TMM01.

FIELD-SYMBOLS:
 <FS_1> TYPE ZMM85TMM01.

SELECT *
  INTO CORRESPONDING FIELDS OF TABLE LT_TAB1
  FROM ZMM85TMM01
  WHERE BUKRS = '0080'.

CLEAR: LT_TAB2.
  LT_TAB2  = LT_TAB1.
LOOP AT LT_TAB2 ASSIGNING <FS_1>.
  <FS_1>-BUKRS = '0049'.
ENDLOOP.

MODIFY ZMM85TMM01 FROM TABLE LT_TAB2.

CLEAR: LT_TAB2.
  LT_TAB2  = LT_TAB1.
LOOP AT LT_TAB2 ASSIGNING <FS_1>.
  <FS_1>-BUKRS = '0050'.
ENDLOOP.

MODIFY ZMM85TMM01 FROM TABLE LT_TAB2.

CLEAR: LT_TAB2.
  LT_TAB2  = LT_TAB1.
LOOP AT LT_TAB2 ASSIGNING <FS_1>.
  <FS_1>-BUKRS = '0051'.
ENDLOOP.

MODIFY ZMM85TMM01 FROM TABLE LT_TAB2.


No comments:

Post a Comment