08-21-2007 7:27 PM
Hi Gurus,
I have a condition where I need to subtract n days from the current date and then I need to collect billing document from vbrp where the prsdt equals to the date we calculated
For this I ahve written the following code:
v_date = syst-datum - v_n (n no. of days).
select vbeln into table it_vbrp
from vbrp
for all entries in it_header
where prsdt = v_date.
I just want to make sure whether this code will work for me or not and if not then please tell me right one.
Thanks
Rajeev Gupta
08-21-2007 7:33 PM
This code is fine just check it_header[] is not initial before passing it to this select.
Regards,
Amit
Rewards all helpful replies.
08-21-2007 7:33 PM
Looks like below logic should work.
<b>try to keep sy-datum instead of syst-datum.</b>
v_date = sy-datum - v_n (n no. of days).
select vbeln into table it_vbrp
from vbrp
for all entries in it_header
where prsdt = v_date.
Thanks
Seshu
08-21-2007 7:38 PM
08-21-2007 7:42 PM
Hi,
Make sure your it_header is not initiall.
if Not it_header is initial..
Select ...
endif.
Regards
Venkat
08-21-2007 8:14 PM
It will give you a syntax error unless you use at least one field of the internal table it_header in your WHERE clause. Other than that it looks ok.
08-21-2007 9:17 PM
Hi,
why are u using 'for all entries' when no field from it_header
is used in where condition. Remove for all entries.
<b>Example to use for all entries:</b>
if it_header[] is not intial.
select vbeln into table it_vbrp
from vbrp
for all entries in it_header
where abc eq it_header-xyz and "(abc and xyz are used for example)
prsdt eq v_date.
endif.