Difference between MOVE ... TO and WRITE ... TO in ABAP/4

See Example

DATA: gv_char1(20) TYPE c,
      gv_char2(20) TYPE c,
      dec1(10) TYPE p DECIMALS 2 VALUE ’122345.89’.

START-OF-SELECTION.
* Date *
  WRITE:/ ’Date variable’.
  WRITE sy-datum to gv_char1.
  WRITE:/ ’WRITE TO ’, gv_char1.

  MOVE sy-datum to gv_char2.
  WRITE:/ ’MOVE TO ’, gv_char2.

SKIP 1.

* Decimal *
  WRITE:/ ’Decimal variable’.
  WRITE dec1 to gv_char1.
  WRITE:/ ’WRITE TO ’, gv_char1.

  MOVE dec1 to gv_char2.
  WRITE:/ ’MOVE TO ’, gv_char2.

The output is:
img142

MOVE ... TO collect result of value like structure in SAP but WRITE ... TO collect result of value as output display.

As above:
TYPE          Structure in SAP Output Display
D YYYYMMDD DD.MM.YYYY
P 999999.99 999.999,99
Technorati Tags: ,

Post new comment