Popular Posts
ListSelectionListener & ItemListener import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Toolkit; import java.awt.event.ItemEvent; import java.awt.event.ItemL... netbean shortcut Ctrl + F:尋找 F3:尋找下一個字串 Ctrl + G:跳到第 N 行 Ctrl + H:取代 Tab:增加縮排 Shift + Tab:減少縮排 Ctrl + E:刪除一行 Ctrl + Shift + I:修正 import 項目 Alt + Ent... Capture response output stream using HttpModule using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Web; namespace TestWebA...
Stats
Flow control : loop (do)
data: N1(1),
      N2(1),
      N3(2).

do 9 times.
  N1 = SY-INDEX.
  do 9 times.
    N2 = SY-INDEX.
    N3 = N1 * N2.
    write: N1, 'x', N2, '=', N3, '|'.
  enddo.
  write SY-ULINE.
enddo.
data: begin of TEXT,
        WORD1(4) value 'This',
        WORD2(4) value 'is',
        WORD3(4) value 'a',
        WORD4(4) value 'loop',
      end of TEXT.

data: STRING1(4), STRING2(4).

do 4 times varying STRING1 from TEXT-WORD1 next TEXT-WORD2.
  write STRING1.
  if STRING1 = 'is'.
    STRING1 = 'was'.       " TEXT-WORD2的值也會變更
  endif.
enddo.
    skip.

skip.

do 2 times varying STRING1 from TEXT-WORD1 next TEXT-WORD3
           varying STRING2 from TEXT-WORD2 next TEXT-WORD4.
  write: STRING1, STRING2.
enddo.
This is   a    loop

This was  a    loop
data: begin of WORD,
        W1(1) value 'a',
        W2(1) value 'b',
        W3(2) value 'c',
        W4(3) value 'd',
        W5(4) value 'e',
      end of WORD.

data LEN type I.
describe field WORD length LEN in character mode.       " 以文字模式計算物件長度

data STR2(1).
do len times varying STR2 from WORD-W1 next WORD-W2.    " STR2, WORD-W1, WORD-W2的類型及長度需相同
  write: '(' no-gap,  STR2 no-gap, ')'.
enddo.
(a) (b) (c) ( ) (d) ( ) ( ) (e) ( ) ( ) ( )