Skip to Content
avatar image
Former Member

Select

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Aug 21, 2007 at 06: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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 06: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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 06:38 PM

    Yes it will work

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      Make sure your it_header is not initiall.

      if Not it_header is initial..

      Select ...

      endif.

      Regards

      Venkat

  • Aug 21, 2007 at 07: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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 08: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.

    Add comment
    10|10000 characters needed characters exceeded