‎2014 Nov 25 6:25 AM
Hi,
In my requirement i need to delete the entries when values is equal to DELE and to run the loop with trade number.
LOOP AT Y_VVT INTO YS_VVT WHERE ITEM_STAT NE 'DELE'.
READ TABLE Y_VVT INTO YS_VVT WITH KEY TRADE_NUM = '0000'.
Is my coding is correct. Since i dont have the test case to test , i am searching for help.
‎2014 Nov 25 6:39 AM
Hi,
Before starting the processing of loop, use DELETE statement. This can be done if you don't want the deleted entries further.
DELETE Y_VVT WHERE ITEM_STAT EQ 'DELE'.
Then if you want to execute the loop with TRADE_NUM = '0000' , specify that in the loop.
LOOP AT Y_VVT INTO YS_VVT where trade_num = '0000'.
...
endloop.
‎2014 Nov 25 6:35 AM
hi bharani,
what actually you wish to do?
if you wish to delete entries having TRADE_NUM = '0000' then use DELETE statement.
‎2014 Nov 25 6:39 AM
Hi,
Before starting the processing of loop, use DELETE statement. This can be done if you don't want the deleted entries further.
DELETE Y_VVT WHERE ITEM_STAT EQ 'DELE'.
Then if you want to execute the loop with TRADE_NUM = '0000' , specify that in the loop.
LOOP AT Y_VVT INTO YS_VVT where trade_num = '0000'.
...
endloop.
‎2014 Nov 25 6:58 AM
Bharani G wrote:
Hi,
In my requirement i need to delete the entries when values is equal to DELE and to run the loop with trade number.
LOOP AT Y_VVT INTO YS_VVT WHERE ITEM_STAT NE 'DELE'.
READ TABLE Y_VVT INTO YS_VVT WITH KEY TRADE_NUM = '0000'.
Is my coding is correct. Since i dont have the test case to test , i am searching for help.
According to your code, the program will consider only the records having ITEM_STAT NE 'DELE' within your LOOP, thereby ignoring the records with ITEM_STAT EQ 'DELE' in your process.
If you wanna delete the entries equal to DELE, then u can directly do it using the DELETE statement. i.e
DELETE Y_VVT WHERE ITEM_STAT = 'DELE'.
The above statement delete all the records with ITEM_STAT = 'DELE'.
Regards,
Mayur Priyan. S
‎2014 Nov 25 7:45 AM
Can any one tell me how to declare a constant for 'DELE' and '00000'
‎2014 Nov 25 7:56 AM
Hi,
For declaring constants, it is best practise to refer their datatype.
For example,
constants c_dele type dbtablename followed by ITEM_STAT will help
similarly if you can check the data type for ITEM_STAT field,
you can also declare
constants c_dele type <datatype directly here>.
Same is true for '0000' as well, you need to refer trade_num field in the database table.
For simple ABAP help, you can do F1 on keyword which will show F1 Help.