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

Select query failing here ?

Hi,

Following is the flow chart of my data selction:

AUFNR

AUFPL (from TABLE AFKO using AUFNR)

ARBID (from Table V_QAPO using AUFPL)

ARBPL (from Table CRHD using ARBID )

REPORT ZTEST1.

TABLES: AFKO, V_QAPO, CRHD.

DATA: BEGIN OF INTERNAL OCCURS 100,

XARBPL LIKE CRHD-ARBPL,

XAUFPL LIKE AFKO-AUFPL,

XVORNR LIKE V_QAPO-VORNR,

XARBID LIKE V_QAPO-ARBID,

END OF INTERNAL.

SELECT CRHDARBPL AFKOAUFPL V_QAPOVORNR V_QAPOARBID

from AFKO

INNER JOIN V_QAPO ON V_QAPOAUFPL = AFKOAUFPL

INNER JOIN CRHD ON CRHDOBJID = V_QAPOARBID

into corresponding fields of table INTERNAL

WHERE AFKO~AUFNR = '007200000059'.

Can someone tell why my select query is failing ?

I am not getting any data in internal table..

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2005 at 12:40 AM

    Tushar,

    In your Internal Table definition, loose the "X" in the field names.

    You are using INTO CPRRESPONDING FIELDS. WHat this does is look for the EXACT field name in the internal table.

    ie.

    DATA: BEGIN OF INTERNAL OCCURS 100,
    ARBPL LIKE CRHD-ARBPL,
    AUFPL LIKE AFKO-AUFPL,
    VORNR LIKE V_QAPO-VORNR,
    ARBID LIKE V_QAPO-ARBID,
    END OF INTERNAL.
    
    
    SELECT CRHD~ARBPL AFKO~AUFPL V_QAPO~VORNR V_QAPO~ARBID
    from AFKO
    INNER JOIN V_QAPO ON V_QAPO~AUFPL = AFKO~AUFPL
    INNER JOIN CRHD ON CRHD~OBJID = V_QAPO~ARBID
    into corresponding fields of table INTERNAL
    WHERE AFKO~AUFNR = '007200000059'.
    

    If you want to use the "X" field names, then replace the INTO CORRESPONDING FIELDS OF TABLE... clause with INTO TABLE...

    If you use the INTO TABLE clause, make sure that the fields listed in the SELECT are in the SAME ORDER as the internal table definition.

    eg

    DATA: BEGIN OF INTERNAL OCCURS 100,
    XARBPL LIKE CRHD-ARBPL,
    XAUFPL LIKE AFKO-AUFPL,
    XVORNR LIKE V_QAPO-VORNR,
    XARBID LIKE V_QAPO-ARBID,
    END OF INTERNAL.
    
    
    SELECT CRHD~ARBPL AFKO~AUFPL V_QAPO~VORNR V_QAPO~ARBID
    from AFKO
    INNER JOIN V_QAPO ON V_QAPO~AUFPL = AFKO~AUFPL
    INNER JOIN CRHD ON CRHD~OBJID = V_QAPO~ARBID
    into table INTERNAL
    WHERE AFKO~AUFNR = '007200000059'.
    

    Hope this helps.

    Cheers,

    Pat.

    PS. Kindly assign Reward Points to the posts you find helpful.

    Message was edited by: Patrick Yee

    Message was edited by: Patrick Yee

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2005 at 03:02 AM

    Tushar - if you're moving on, why not close the other thread?

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2005 at 12:44 AM

    use like this

    REPORT ZTEST1.

    TABLES: AFKO, V_QAPO, CRHD.

    DATA: BEGIN OF INTERNAL OCCURS 100,

    ARBPL LIKE CRHD-ARBPL,

    AUFPL LIKE AFKO-AUFPL,

    VORNR LIKE V_QAPO-VORNR,

    ARBID LIKE V_QAPO-ARBID,

    END OF INTERNAL.

    SELECT CRHDARBPL AFKOAUFPL V_QAPOVORNR V_QAPOARBID

    from AFKO

    INNER JOIN V_QAPO ON V_QAPOAUFPL = AFKOAUFPL

    INNER JOIN CRHD ON CRHDOBJID = V_QAPOARBID

    into corresponding fields of table INTERNAL

    WHERE AFKO~AUFNR = '007200000059'.

    u hv used corresponding fields but did not declared it correctly...

    remove X from the variable declared.

    XARBPL LIKE CRHD-ARBPL,

    XAUFPL LIKE AFKO-AUFPL,

    XVORNR LIKE V_QAPO-VORNR,

    XARBID LIKE V_QAPO-ARBID

    regards

    gv

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2005 at 03:58 AM

    or use it like

    SELECT CRHDARBPL AFKOAUFPL V_QAPOVORNR V_QAPOARBID

    from AFKO

    INNER JOIN V_QAPO ON V_QAPOAUFPL = AFKOAUFPL

    INNER JOIN CRHD ON CRHDOBJID = V_QAPOARBID

    WHERE AFKO~AUFNR = '007200000059'.

    XARBPL = CRHD-ARBPL.

    XAUFPL = AFKO-AUFPL.

    XVORNR = V_QAPO-VORNR.

    XARBID = V_QAPO-ARBID.

    APPEND INTERNAL.

    CLEAR INTERNAL

    ENDSELECT.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 29, 2005 at 04:18 AM

    Hi,

    <b>U Check whether the table entries are there</b>.

    There is nothing wrong in the code

    TABLES: afko, v_qapo, crhd.

    DATA: BEGIN OF internal OCCURS 100,
    xarbpl LIKE crhd-arbpl,
    xaufpl LIKE afko-aufpl,
    xvornr LIKE v_qapo-vornr,
    xarbid LIKE v_qapo-arbid,
    END OF internal.
    
    SELECT crhd~arbpl afko~aufpl v_qapo~vornr v_qapo~arbid
           INTO CORRESPONDING FIELDS OF TABLE internal
           FROM afko
           INNER JOIN v_qapo ON v_qapo~aufpl = afko~aufpl
           INNER JOIN crhd ON crhd~objid = v_qapo~arbid
           WHERE afko~aufnr = '007200000059'.

    U can check in the debugging mode. Also see that whether the tables u have used have entries.

    Hope this helps.

    Kindly reward and close the thread.

    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.