Skip to Content
author's profile photo Former Member
Former Member

sql query error

Hi Everybody,

Im working on a smartform. Im having error in this join query...

SELECT T1~VBELN

T1~VKORG

T1~VTWEG

T1~SPART

T1~FKDAT

T1~KUNAG

T2~POSNR

T2~MATNR

T2~ARKTX

T2~FKLMG

T2~NETWR

INTO TABLE IT_TAB

FROM VBRK AS T1

INNER JOIN VBRP AS T2 ON T1~VBELN EQ T2~VBELN

WHERE T1~VBELN eq P_VBELN.

Im getting error as "IT_TAB is a table without a header line and therefore has no component called KUNAG". Please help...

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 31, 2012 at 01:19 PM

    Hi everyone,

    I have identified the error.

    SELECT T1~VBELN

    T1~VKORG

    T1~VTWEG

    T1~SPART

    T1~KUNAG

    T1~FKDAT

    T2~POSNR

    T2~MATNR

    T2~ARKTX

    T2~FKLMG

    T2~NETWR

    INTO TABLE IT_TAB

    FROM VBRK AS T1

    INNER JOIN VBRP AS T2 ON T1~VBELN EQ T2~VBELN

    WHERE T1~VBELN eq P_VBELN.

    SELECT SINGLE KUNNR NAME1 ORT01 LAND1 PSTLZ INTO FS_TAB

    FROM KNA1

    WHERE KUNNR = IT_TAB-KUNAG.

    The error comes from the second SELECT query. Please tell me how to correct it.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Raymond Giuseppi

      Hi Raymond,

      As you have mentioned I declared a workarea for KNA1 and used FOR ALL ENTRIES and checked it and it is now working...this is how i used the SELECT statement.

      SELECT POSNR MATNR ARKTX FKLMG NETWR INTO TABLE T_VBRP

      FROM VBRP

      WHERE VBELN = P_VBELN.

      SELECT VBELN VKORG VTWEG SPART FKDAT KUNAG INTO TABLE T_VBRK

      FROM VBRK WHERE VBELN = P_VBELN.

      IF SY-SUBRC = 0.

      SELECT KUNNR NAME1 ORT01 LAND1 PSTLZ INTO TABLE T_KNA1

      FROM KNA1

      FOR ALL ENTRIES IN T_VBRK

      WHERE KUNNR = T_VBRK-KUNAG.

      ENDIF.

      thx everyone for your suggestions.

  • Posted on May 31, 2012 at 08:25 AM

    Hi Vasantha,

    Please add the data declaration code of it_tab.

    Regards, Pranav.😊

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 31, 2012 at 08:39 AM

    Possible reason:

    1.) Check your TYPES declaration and DATA declaration of internal table IT_TAB.

    It looks like you miss out to include the field KUNAG.

    2.) Also, I suspect that it maybe not on your query, is there any READ TABLE statement or LOOP .. END LOOP process to table IT_TAB?

    3.) How you declare your IT_TAB table? Please check this. INTERNAL TABLE TYPES.

    Or please paste here your data declaration of it_tab.

    Regards,

    Jake

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 31, 2012 at 09:19 AM

    Did you declare a work-area to read the data, and did you use it in

    - abap code nodes

    look for LOOP AT and READ TABLE statements in abap nodes.

    - Loops in table nodes

    Look at data table of table nodes;

    Regards,

    Raymond


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.