2011年5月11日 星期三

[Code] Put Data into Range Object with Macro


Put data into ranges table.
首先是先定義好資料:
TABLES: tvfk.
RANGES: gr_fkart FOR vbrk-fkart.
最重要的 萬用巨集
* -------------
* Define Macro
* -------------
DEFINE put_ranges.
  &1-sign   = &2.
  &1-option = &3.
  &1-low    = &4.
  &1-high   = &5.
  APPEND &1.
END-OF-DEFINITION.
或者是這個「假猴」的 :p
DEFINE put_ranges.
  FIELD-SYMBOLS <PT> LIKE &1.
  ASSIGN &1 TO <PT>.
  <PT>-sign   = &2.
  <PT>-option = &3.
  <PT>-low    = &4.
  <PT>-high   = &5.
  APPEND <PT> TO &1.
END-OF-DEFINITION.
然後是運用的方式:
SELECT fkarts INTO tvfk-fkarts
    FROM tvfk
   WHERE kappl = 'V3'.
  put_ranges gr_fkart 'E' 'EQ' tvfk-fkarts ''.
ENDSELECT.