Application Development 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: 

Select

Former Member
0 Kudos

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

6 REPLIES 6

amit_khare
Active Contributor
0 Kudos

This code is fine just check it_header[] is not initial before passing it to this select.

Regards,

Amit

Rewards all helpful replies.

Former Member
0 Kudos

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

Former Member
0 Kudos

Yes it will work

0 Kudos

Hi,

Make sure your it_header is not initiall.

if Not it_header is initial..

Select ...

endif.

Regards

Venkat

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.