02-18-2005 11:24 AM
Howdy,
I have an internal table (itab_knvh) that contains all the entries from table KNVH for a specified sales area.
Now I have another internal table (itab_kunnr) that contains all the customers that I need data for.
How can I read all the entries from itab_knvh where the 'date from' value (datab) is greater than today's date?
At the moment I have:
<b> LOOP AT itab_kunnr.
<i>READ TABLE itab_knvh WITH KEY kunnr = itab_kunnr-kunnr.</i>
IF sy-subrc = 0.
IF itab_knvh-datab GE p_validh.
WRITE:/ itab_kunnr.
ENDIF.
ENDIF.
ENDLOOP.</b>
but I don't think this will work if more than one customer entry exists in itab_knvh.
So is there a way of writing:
READ TABLE itab_knvh WITH KEY kunnr = itab_kunnr-kunnr
datab GE sy-datum.
Any ideas???
02-18-2005 12:31 PM
Thansk for the help.
Unfortuantely the logic routines that you stated caused duplicate entries to appear - but his is mostly due to me not explainging my problem properly.
anyhow If someone could explain how to do the following then that would be really great:
I just need to pass the values from a select into fields of an internal table (whose names i am not allowed to chnage):
currently I have :
<b>if sy-subrc ne 0.
select single hkunnr datab hzuor from knvh
(itab_hier_output-old_datab
itab_hier_output-old_kunnr
itab_hier_output-old_hzuor)
where kunnr = itab_kunnr-kunnr
and datbi = itab_hier_output-new_datab.
endif.</b>
but this doesn't work...
Anyone got any ideas....
02-18-2005 11:30 AM
Hi Steve,
You can use this instead of the read statement.
loop at itab_knvh where kunnr = itab_kunnr
datab gt sy-datum.
exit.
endloop.
if sy-subrc eq 0.
write itab_kunnr.
endif.
Regards,
Anand Mandalika.
02-18-2005 11:40 AM
Hey Steve,
I guess you could choose to reverse the loops as well.
loop at itab_knvh where datab gt sy-datum.
read table itab_kunnr with key itab_kunnr eq itab_knvh-kunnr
transporting no fields.
if sy-subrc eq 0.
write: / itab_knvh-kunnr.
endif.
endloop.
What say ?
Regards,
Anand Mandalika.
02-18-2005 12:31 PM
Thansk for the help.
Unfortuantely the logic routines that you stated caused duplicate entries to appear - but his is mostly due to me not explainging my problem properly.
anyhow If someone could explain how to do the following then that would be really great:
I just need to pass the values from a select into fields of an internal table (whose names i am not allowed to chnage):
currently I have :
<b>if sy-subrc ne 0.
select single hkunnr datab hzuor from knvh
(itab_hier_output-old_datab
itab_hier_output-old_kunnr
itab_hier_output-old_hzuor)
where kunnr = itab_kunnr-kunnr
and datbi = itab_hier_output-new_datab.
endif.</b>
but this doesn't work...
Anyone got any ideas....
02-18-2005 12:40 PM
Hi Steve,
If you have written <i>exactly</i> the same SELECT statement as you have posted here, then it is in error.
Try this one out, instead.
select single hkunnr
datab
hzuor
from knvh
into (itab_hier_output-old_kunnr,
itab_hier_output-old_datab,
itab_hier_output-old_hzuor)
where kunnr = itab_kunnr-kunnr
and datbi = itab_hier_output-new_datab.
Regards,
Anand Mandalika.