[ABAP] MOVE-CORRESPONDING vs. CORRESPONDING #( )
26 Sep 2022 -
Less than 1 minute read
π MOVE-CORRESPONDING
νλλͺ κ³Ό λ°μ΄ν°νμ μ΄ κ°μ κ²λ§ μ°Ύμ κ° Assign, λ€λ₯΄λ©΄ κ·Έλλ‘ μ μ§
ex)
DATA : BEGIN OF STR1,
COL1 TYPE C VALUE 'A',
COL2 TYPE C VALUE 'B',
END OF STR1.
DATA : BEGIN OF STR2,
COL1 TYPE C VALUE 'C',
COL3 TYPE C VALUE 'D',
END OF STR2.
MOVE-CORRESPONDING STR1 TO STR2.
WRITE : STR1-COL1, STR1-COL2.
WRITE : / STR2-COL2, STR2-COL3.
* κ²°κ³Ό
A B
B D
π CORRESPONDING #( )
νλλͺ μ΄ κ°μΌλ©΄ Mapping ν΄ κ° ν λΉ, λ€λ₯΄λ©΄ μ΄κΈ°ν
ex)
DATA : BEGIN OF STR1,
COL1 TYPE C VALUE 'A',
COL2 TYPE C VALUE 'B',
END OF STR1.
DATA : BEGIN OF STR2,
COL1 TYPE C VALUE 'C',
COL3 TYPE C VALUE 'D',
END OF STR2.
STR2 = CORRESPONDING #( STR1 ).
WRITE : STR1-COL1, STR1-COL2.
WRITE : / STR2-COL2, STR2-COL3.
* κ²°κ³Ό
A B
B