2009 Oct 08 2:16 PM
HI,
I've this SELECT statement
SELECT com01 num01 com02 num02 com03 num03
com04 num04 com05 num05 com06 num06 FROM pa0006
INTO CORRESPONDING FIELDS OF TABLE lt_zgestor
WHERE pernr EQ l_pernr.
and I want delete select from LT_ZGESTOR , field num(xx) where com(xx) eq 'WORK'
How can I do this ?
Thanks,
2009 Oct 08 2:31 PM
Do you want to empty field num(xx) if corresponding field com(xx) eq 'WORK' ? Do I understand it correctly?
If so then you can use this code
field-symbols: <num>, <com>.
data: com(5) type c,
num(5) type c.
idx(2) type n.
Loop at LT_ZGESTOR.
do 6 times.
idx = sy-index. "01, 02, 03, ...
concatenate 'COM' idx into com. "COM01, COM02,....
concatenate 'NUM' idx into num. "NUM01, NUM02 ...
assign component: COM of structure LT_ZGESTOR to <com>,
NUM of structure LT_ZGESTOR to <num>.
if <com> = 'WORK'.
clear <num>.
endif.
enddo.
endloop.
or if you want to delete records where COM(XX) eq 'WORK'.
"just change this
...
if <com> = 'WORK'.
delete LT_ZGESTOR index sy-tabix.
exit. "exit DO loop and get next record
endif.
Regards
Marcin
Do you want to empty field num(xx) if corresponding field com(xx) eq 'WORK' ? Do I understand it correctly?
If so then you can use this code
field-symbols: <num>, <com>.
data: com(5) type c,
num(5) type c.
idx(2) type n.
Loop at LT_ZGESTOR.
do 6 times.
idx = sy-index. "01, 02, 03, ...
concatenate 'COM' idx into com. "COM01, COM02,....
concatenate 'NUM' idx into num. "NUM01, NUM02 ...
assign component: COM of structure LT_ZGESTOR to <com>,
NUM of structure LT_ZGESTOR to <num>.
if <com> = 'WORK'.
clear <num>.
endif.
enddo.
endloop.
or if you want to delete records where COM(XX) eq 'WORK'.
"just change this
...
if <com> = 'WORK'.
delete LT_ZGESTOR index sy-tabix.
exit. "exit DO loop and get next record
endif.
Regards
Marcin
2009 Oct 08 2:24 PM
Are you looking for something like this?
delete lt_zgestor where com01 = 'WORK' OR com02 = 'WORK' ......com05 = 'WORK'.
Vikranth
2009 Oct 08 2:31 PM
Do you want to empty field num(xx) if corresponding field com(xx) eq 'WORK' ? Do I understand it correctly?
If so then you can use this code
field-symbols: <num>, <com>.
data: com(5) type c,
num(5) type c.
idx(2) type n.
Loop at LT_ZGESTOR.
do 6 times.
idx = sy-index. "01, 02, 03, ...
concatenate 'COM' idx into com. "COM01, COM02,....
concatenate 'NUM' idx into num. "NUM01, NUM02 ...
assign component: COM of structure LT_ZGESTOR to <com>,
NUM of structure LT_ZGESTOR to <num>.
if <com> = 'WORK'.
clear <num>.
endif.
enddo.
endloop.
or if you want to delete records where COM(XX) eq 'WORK'.
"just change this
...
if <com> = 'WORK'.
delete LT_ZGESTOR index sy-tabix.
exit. "exit DO loop and get next record
endif.
Regards
Marcin
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |