DATA: BEGIN OF gs_lfa1,
lifnr LIKE lfa1-lifnr,
ebeln LIKE ekko-ebeln,
bukrs LIKE ekko-bukrs,
END OF gs_lfa1.
DATA: gt_lfa1 LIKE TABLE OF gs_lfa1,
gw_lfa1 LIKE gs_lfa1.
SELECT lifnr ebeln bukrs FROM ekko
INTO TABLE gt_lfa1
WHERE ebeln > 4500006374
AND ebeln 4500006390.
SORT gt_lfa1 BY lifnr.
LOOP AT gt_lfa1 INTO gw_lfa1.
AT NEW lifnr.
WRITE:/10 gw_lfa1-lifnr, 20 gw_lfa1-ebeln, 40 gw_lfa1-bukrs.
WRITE:/ 'The next is new lifnr.'.
ENDAT.
ENDLOOP.
这个程序运行出来字段变成*的。
下面的程序是在at new 之前用了move 的。这样运行出来就没有*了
DATA: BEGIN OF gs_lfa1,
lifnr LIKE lfa1-lifnr,
ebeln LIKE ekko-ebeln,
bukrs LIKE ekko-bukrs,
END OF gs_lfa1.
DATA: gt_lfa1 LIKE TABLE OF gs_lfa1,
gw_lfa1 LIKE gs_lfa1,
gw_output LIKE gs_lfa1.
SELECT lifnr ebeln bukrs FROM ekko
INTO TABLE gt_lfa1
WHERE ebeln > 4500006374
AND ebeln 4500006390.
SORT gt_lfa1 BY lifnr.
LOOP AT gt_lfa1 INTO gw_lfa1.
MOVE gw_lfa1 to gw_output. "这里用move
AT NEW lifnr.
WRITE:/10 gw_output-lifnr, 20 gw_output-ebeln, 40 gw_output-bukrs.
WRITE:/ 'The next is new lifnr.'.
ENDAT.
ENDLOOP.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13973563/viewspace-691275/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/13973563/viewspace-691275/