‎2008 Apr 15 6:11 PM
Hi friends,
I have few records in the internal table.
My requirement is i want to clear only few records of my interanl table but not all the records.
how can i do that.
can anybdy help me.?
<REMOVED BY MODERATOR>
Regards
SATISH
Edited by: Alvaro Tejada Galindo on Apr 15, 2008 3:31 PM
‎2008 Apr 15 6:18 PM
Hi
U need to do a loop using a WHERE condition in according to find out the records to be cleared.
LOOP AT ITAB WHERE ......
CLEAR ITAB.
* or
DELETE ITAB.
ENDLOOP.Max
‎2008 Apr 15 6:17 PM
hi satish,
could please mention the condition for deletion of few records in ur requirement. So that it will be for us to answer ur question,.
‎2008 Apr 15 6:18 PM
Hi
U need to do a loop using a WHERE condition in according to find out the records to be cleared.
LOOP AT ITAB WHERE ......
CLEAR ITAB.
* or
DELETE ITAB.
ENDLOOP.Max
‎2008 Apr 15 6:25 PM
‎2008 Apr 15 6:38 PM
hi max i will tell u my full requirement.
i have an itab.
data :
begin of it_exclude occurs 0,
fcode like sy-ucomm,
end of it_exclude.
( i have some function in my pf-status which iam taking into
this internal table )
it_exclude-fcode = 'save'.
append it_exclude.
it_exclude-fcode = 'delete'.
append it_exclude.
it_exclude-fcode = 'modify'.
append it_exclude.
it_exclude-fcode = 'new'.
append it_exclude.
now i have all those function codes in my it_exclude and now i want only fucntion codes save and delete on my ist screen and fuction codes new and save on next screen
how can i do that..
‎2008 Apr 16 7:14 AM
Hi Satish,
Rather than collecting all the fcode into the internal table before, based on the screen just push those fcodes into the internal table it_exclude[] which u do not want in the screen and then later clear the internal table for the next screen.
Eg.
In pbo of screen one
Append fcodes modify & new.
In pbo of screen two
Clear it_exclude[].
Then append delete & modify.
Hope this of help.
Regards,
Christina.
‎2008 Apr 15 6:27 PM
Hi,
You can do as below:
loop at itab.
if condition "On condition to delete
delete itab.
clear itab.
continue.
endif.
endloop.
Thanks,
Sriram POnna.
‎2008 Apr 15 6:52 PM
Hi
For deleting particular entries from your internal table...Add one more field in your internal table say flag. Loop the table and mark the flag X for the entries you want to delete depending upon your requirement.
Once loop ends delete those lines where flag is checked.
I hope this will help you.
LOOP AT i_fnl_loc INTO wa_fnl_loc.
l_indx = sy-tabix.
READ TABLE i_air_craft INTO wa_air_craft WITH KEY
aircr_ser = wa_fnl_loc-aircr_ser
BINARY SEARCH.
IF sy-subrc = 0 AND wa_air_craft IS NOT INITIAL.
wa_fnl_loc-flag = c_x.
MODIFY i_fnl_loc FROM wa_fnl_loc INDEX l_indx TRANSPORTING flag.
CLEAR wa_air_craft.
ENDIF.
CLEAR wa_fnl_loc.
ENDLOOP.
DELETE i_fnl_loc WHERE flag = space.
This will delete only those entries where flag is space. <REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 15, 2008 3:33 PM
‎2008 Apr 15 7:00 PM
Hi, Satish.
Try creating another internal table. Example:
*** Itab used on first screen
begin of it_exclude1 occurs 0,
fcode like sy-ucomm,
end of it_exclude1.
*** Itab used on another screens
begin of it_exclude2 occurs 0,
fcode like sy-ucomm,
end of it_exclude2.
it_exclude1-fcode = 'save'.
append it_exclude1.
it_exclude1-fcode = 'delete'.
append it_exclude1.
it_exclude2-fcode = 'new'.
append it_exclude2.
it_exclude2-fcode = 'save'.
append it_exclude2.
Then you can use it_exclude1 on your first screen, and it_exclude2 on the next screens.
Kind Regards,
Brian Gonsales
‎2008 Apr 15 7:03 PM
hi yaar....
i have some 6 screens and i cant create 6 internal tables for that na.....
i need a good logic with only 1 itab....
‎2008 Apr 15 10:44 PM
Can't you just include the screen number in the internal table?
... or am I missing something?
Ta ... JR
‎2008 Apr 15 10:55 PM
Rudd's answer is the way to go in the end.
But you will need two internal tables for this.
One with type of IT_EXCLUDE and another one with additional field SCREEN.
on every new screen (pf-status), clear the IT_EXCLUDE and read the table holding the current screen and add all function codes from this internal table to IT_EXCLUDE.
‎2008 Apr 16 6:44 AM
hi satish,
try this on each of your screen.
SET PF-STATUS 'STATUS' EXCLUDING 'NAME'.
regards,
Peter