DATA: BEGIN OF text,
word1(4) TYPE c VALUE ‘This’,
word2(4) TYPE c VALUE ‘is’,
word3(4) TYPE c VALUE ‘a’,
word4(4) TYPE c VALUE ‘loop’,
END OF text.
DATA: string1(4) TYPE c, string2(4) TYPE c.
DO 4 TIMES VARYING string1 FROM text-word1 NEXT text-word2.
WRITE string1.
IF string1 = ‘a’.
string1 = ‘an’.
ENDIF.
ENDDO.
SKIP.
write: ‘text-word3 = ‘ , text-word3.
skip.
DO 3 TIMES VARYING string1 FROM text-word1 NEXT text-word2
VARYING string2 FROM text-word2 NEXT text-word3.
WRITE: string1, string2.
ENDDO.
说明:
需要说明的是,对于string1的值更改,实际上是修改了text中组件的值,这里的string1和string2引用了text中组件的值
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/19662.html