[ABAP] MOVE-CORRESPONDING vs. CORRESPONDING #( )


🌝 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

Categories:

SAP/ABAP