Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

internal table

Former Member
0 Likes
1,029

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,013

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

12 REPLIES 12
Read only

Former Member
0 Likes
1,013

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,.

Read only

Former Member
0 Likes
1,014

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

Read only

matt
Active Contributor
0 Likes
1,013

Or DELETE.. WHERE...

matt

Read only

0 Likes
1,013

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..

Read only

0 Likes
1,013

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.

Read only

Former Member
0 Likes
1,013

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.

Read only

Former Member
0 Likes
1,013

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

Read only

Former Member
0 Likes
1,013

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

Read only

0 Likes
1,013

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....

Read only

0 Likes
1,013

Can't you just include the screen number in the internal table?

... or am I missing something?

Ta ... JR

Read only

0 Likes
1,013

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.

Read only

peter_ruiz2
Active Contributor
0 Likes
1,013

hi satish,

try this on each of your screen.


SET PF-STATUS 'STATUS' EXCLUDING 'NAME'.

regards,

Peter