2007 Mar 26 7:50 PM
select kunnr vbeln from zcitorderout into table itab1 where flag = space.For all rows selected above, I want to update the flag to 'I'
2007 Mar 26 8:33 PM
data: r_zcit type zcitorderout.
loop at tab1.
clear r_zcit- kunnr.
r_zcit-kunnr = tab1-kunnr.
r_zcit-vbeln = tab1-vblen.
r_zcit-flag = 'I'.
MODIFY zcitorderout FROM r_zcit.
endloop.
data: r_zcit type zcitorderout.
loop at tab1.
clear r_zcit- kunnr.
r_zcit-kunnr = tab1-kunnr.
r_zcit-vbeln = tab1-vblen.
r_zcit-flag = 'I'.
MODIFY zcitorderout FROM r_zcit.
endloop.
2007 Mar 26 7:54 PM
loop at itab1
move 'I' to itab1-flag. modify itab1 index sy-tabix.
endloop.
nodify zcitorderout from table itab1.
if sy-subrc eq 0.
commit work.
endif.
aRs
2007 Mar 26 8:36 PM
And stay away from using COMMIT WORK. This violates SAP's Logic Unit of Work concept.
Allow the successful conclusion of the program perform the COMMIT WORK for you. This prevents database inconsistencies. It is not a practice that is recommended without some more elegant form of error-handling.
2007 Mar 26 8:08 PM
Hi Megan,
Use<b> MODIFY</b> statement for your requirement.
LOOP AT ITAB1.
ITAB1-FLAG = 'I'.
MODIFY ITAB1 INDEX SY-TABIX.
ENDLOOP.
If you want to UPDATE the flag value from SPACE to I then use UPDATE statement on the table zcitorderout.
UPDATE zcitorderout
SET FLAG = 'I'
WHERE FLAG = SPACE.
If you want to UPDATE the flag value from SAPCE to I for all the entries in zcitorderout in the internal table then
LOOP AT ITAB1.
<b>UPDATE zcitorderout
SET FLAG = 'I'
WHERE KUNNR = ITAB1-KUNNR AND
VBELN = ITAB1-VBELN.</b>
ENDLOOP.
Thanks,
Vinay
2007 Mar 26 8:31 PM
Hi,
Please try this.
select kunnr vbeln
from zcitorderout
into table itab1
where flag = space.
loop at itab1.
update zcitorderout
set flag = 'I'
where kunnr = itab1-kunnr
and vbeln = itab1-vbeln.
endloop.
Regards,
Ferry Lianto
2007 Mar 26 8:33 PM
data: r_zcit type zcitorderout.
loop at tab1.
clear r_zcit- kunnr.
r_zcit-kunnr = tab1-kunnr.
r_zcit-vbeln = tab1-vblen.
r_zcit-flag = 'I'.
MODIFY zcitorderout FROM r_zcit.
endloop.
2007 Mar 26 9:00 PM
Hi Megan,
You really make me hard to earn points
Regards,
Ferry Lianto
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |