|
Posted by 皮皮熊 on 2008-06-09 05:00 下午
|
各位达达 我想将tableA中的field1的值由'x'变成'',该如何做呢? 是否采用 update tableA set fileld1 = '' where ... 这样 还是?? 谢谢
|
|
|
|
Posted by im0o海星 on 2008-06-10 02:32 下午
|
|
请说具体 ...
|
|
|
|
Posted by Apple1 on 2008-06-11 10:19 上午
|
data: wa1 like tablea.
select * from tablea into wa1.
wa1-field1 = ''.
update tablea from wa1.
|
|
|
|
Posted by 皮皮熊 on 2008-06-12 11:39 上午
|
|
谢谢
|
|
|
|
Posted by 皮皮熊 on 2008-06-12 11:40 上午
|
不用循环wa1吗?
data: wa1 like tablea.
select * from tablea into wa1.
wa1-field1 = ''.
update tablea from wa1.
还是
data: wa1 like tablea.
select * from tablea into wa1.
loop at wa1.
wa1-field1 = ''.
modify wa1.
endloop.
update tablea from wa1.
上面两种哪种正确啊?
|
|
|
|
Posted by im0o海星 on 2008-06-12 01:02 下午
|
皮皮熊 wrote: | 不用循环wa1吗?
data: wa1 like tablea. select * from tablea into wa1. wa1-field1 = ''. update tablea from wa1.
还是 data: wa1 like tablea. select * from tablea into wa1. loop at wa1. wa1-field1 = ''. modify wa1. endloop. update tablea from wa1.
上面两种哪种正确啊? |
|
2种都有错 第1种: 你声明的是一个 wa1的工作区域 不是内表 所以不能 select all to the 工作区域 wa1. data: wa1 like tablea. select single * from tablea into wa1. wa1-field1 = ''. update tablea from wa1. 第2种: data: wa1 like table of tablea with header line.. select * from tablea into wa1. loop at wa1. wa1-field1 = ''. modify wa1. endloop. update tablea from wa1.
|
|
|
|
Posted by 浪客 on 2008-06-12 02:36 下午
|
|
我用实际给你做了一下。目的是为了提高效率。代码如下: DATA : IT_WA TYPE STANDARD TABLE OF TABLEA, STR_WA TYPE TABLEA。 SELECT * FROM TABLE INTO TABLE IT_WA . STR_WA-field1 = ' '. MODIFY IT_WA FROM STR_WA TRANSPORTING field1 WHERE field1 = 'x'. 关键是where条件必须追加。否则你就只能用LOOP AT 。。。。。。ENDLOOP了。
|
|
|
|
Posted by thinklong on 2008-06-13 10:49 下午
|
|
楼上的正解
|
|
|
|
Posted by xiebinren on 2008-07-04 03:09 下午
|
|
MODIFY 好像是里面没有记录,他还会添加上去吧
|
|
|
|
Posted by im0o海星 on 2008-07-05 09:02 上午
|
|
modify = insert + update
|
|