03-31-2006 9:03 AM
Hello,
What I want to do is to delete the whole row if a specific field is empty. If it helps this is an ALV_GRID report
I have seen that there are a couple of topics about this but I haven't been able to solv it. My attempts are in bold.
wa_rec-sek_norm_sal = wa_rec-norm_sal - wa_rec-bet01.
<b>if wa_rec-sek_norm_sal is initial.
delete wa_rec.</b>
endif.
append wa_rec to lt_rec.
<b>loop at lt_rec.
if lt_rec-sek_norm_sal is initial.
delete lt_rec.
endif.
endloop.</b>
Error from <b>first</b> attempt:
"WA_REC" is not an internal table - the "OCCURS n" specification is missing"
Error from <b>second</b> attempt:
The internal table "LT_REC" has no Header line - explicit specification of an output area with "INTO wa" or "ASSIGNING <fs>" is required.
Thank you all.
Best Regards Claes
03-31-2006 9:06 AM
Hi claes,
1. how is your internal table defined ?
wa_rec
(is it work area or internal table ?
if internal table, then
it should be declared someting like this :
dat a: wa_rec like table of
T001 <b>WITH HEADER LINE.</b>
2. same is the case with 2.
lt_rec-sek_norm_sal
(it does not have header line)
regards,
amit m.
03-31-2006 9:06 AM
Hi claes,
1. how is your internal table defined ?
wa_rec
(is it work area or internal table ?
if internal table, then
it should be declared someting like this :
dat a: wa_rec like table of
T001 <b>WITH HEADER LINE.</b>
2. same is the case with 2.
lt_rec-sek_norm_sal
(it does not have header line)
regards,
amit m.
03-31-2006 9:18 AM
03-31-2006 9:07 AM
create it_rec with header line.
let me know if u need any assistance.
Raja.
03-31-2006 9:09 AM
1. The first part of the code must be running in a loop.. right??
If I am not wrong, your code looks like this:
loop at it_rec into wa_rec.
.....
wa_rec-sek_norm_sal = wa_rec-norm_sal - wa_rec-bet01.
if wa_rec-sek_norm_sal is initial.
*delete wa_rec.
DELETE <IT_REC> index sy-tabix.
endif.
endloop.
2.
Create a workarea for lt_rec.
For ex:
data: wa_rec like lt_rec.
data: v_tabix like sy-tabix.
loop at lt_rec into wa_rec.
v_tabix = sy-tabix.
if wa_rec-sek_norm_sal is initial.
delete lt_rec index v_tabix.
endif.
endloop.
Hope this helps
03-31-2006 9:10 AM
hi,
data: x_rec like line of lt_rec.
loop at lt_rec into x_rec.
if x_rec-sek_norm_sal is initial.
delete lt_rec index sy-tabix.
endif.
endloop.
this will solve .
Regards
Vijay