Skip to Content
avatar image
Former Member

SELECT statement with WHERE clause results in an ERROR

Hi All,

I am using following select statement in a program line within a SmartForm which results in an error.

SELECT *

FROM VBPA

INTO CORRESPONDING FIELDS OF TABLE T_KUNNR1

WHERE VBELN = '220'

AND PARVW = 'SP'.

If I modify this statement as below then it is working fine.

SELECT *

FROM VBPA

INTO CORRESPONDING FIELDS OF TABLE T_KUNNR1.

Can anyone please suggest me what is the problem with above statement.

Regards,

Avaneet

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 17, 2008 at 12:24 PM

    Hi

    you should use the leading zeros before 220

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 17, 2008 at 12:24 PM

    No, my telepathy skills are weak this afternoon. You'll have to tell me.

    What error are you getting? ( Though srinivasu bv is probably correct ).

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 17, 2008 at 12:30 PM

    Hi,

    Here VBELN is char 10 and store with leading zero , so for the retriving this we need to add the leading zeros.

    Try this way

    SELECT *

    FROM VBPA

    INTO CORRESPONDING FIELDS OF TABLE T_KUNNR1

    WHERE VBELN = '0000000220'

    AND PARVW = 'SP'.

    the second one dont have the where clause so it will work fine.

    regards,

    Bharani

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 17, 2008 at 12:30 PM

    Hi avaneet,

    Try holding the values 220 and SP in a local variables and use that local variables in the select statement probably it may work.

    Cheers!!

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 17, 2008 at 12:36 PM

    Hi,

    Use this...

    Data: v_vbeln like VBPA-VBELN,

    v_parvw like VBPA-PARVW.

    v_vbeln = '220'.

    v_parvw = 'SP'.

    SELECT *

    FROM VBPA

    INTO CORRESPONDING FIELDS OF TABLE T_KUNNR1

    WHERE VBELN = v_vbeln

    AND PARVW = v_parvw.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 17, 2008 at 01:14 PM

    Try

    SELECT * 
      FROM VBPA 
      INTO CORRESPONDING FIELDS OF TABLE T_KUNNR1
      WHERE VBELN = '0000000220' AND PARVW = 'AG'.

    Respect the field definitions and conversion-exits.

    Regards

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 17, 2008 at 01:17 PM

    Hi Avannet

    What about the error ?

    still you are getting same errror or what??

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 17, 2008 at 01:17 PM

    Thanks Matt.

    I used conversion routines suggested by you and now it starts working.

    Again thanks a lot.

    Add comment
    10|10000 characters needed characters exceeded