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

Re:select statement

Hi when I writing the following select statement

SELECT SUM( menge )

INTO sumgood

FROM aufm

WHERE ( bwart EQ '101' or bwart EQ 'X01' )

AND matnr EQ it_afpo-matnr

AND aufnr EQ t_prodbom-aufnr.

It gives me a error message the statement is not accesible,

Pls send the modified statement, give u full points.

regards

Sasi

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 09:53 AM

    If you are written it in a REPORT program,

    try to insert 'START-OF-SELECTION' before the query.

    ie,

    START-OF-SELECTION.

    QUERY.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 09:53 AM

    sumgood should be the same type of menge

    u need to use for all entries

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 09:55 AM

    Hi,

    SELECT SINGLE SUM( menge )

    INTO sumgood

    FROM aufm

    WHERE ( bwart EQ '101' or bwart EQ 'X01' )

    AND matnr EQ it_afpo-matnr

    AND aufnr EQ t_prodbom-aufnr.

    Cheers,

    Will.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 09:55 AM

    Hi,

    can u give me u r entire code so that i can try to coreect it.

    Regards

    sunil

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 31, 2008 at 09:56 AM

    If i remove the two following lines,

    AND matnr EQ it_afpo-matnr
    AND aufnr EQ t_prodbom-aufnr.

    and define

    sumgood LIKE aufm-menge

    the program works well. so, the question is :

    Are it_afpo and t_prodbom internal table with header line?

    , if not use explicit work area, or use a SELECT FOR ALL ENTRIES syntax.

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 09:57 AM

    sashi,

    Use GROUP BY caluse in your select statement.

    Ex:

    SELECT SUM( menge )

    INTO sumgood

    FROM aufm

    WHERE ( bwart EQ '101' or bwart EQ 'X01' )

    AND matnr EQ it_afpo-matnr

    AND aufnr EQ t_prodbom-aufnr

    GROUP BY matnr." Here on which field base you are summing the merge"

    Don't forget to reward if useful....

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 10:01 AM

    Sashi,

    TRY like this also.

    WHERE bwart IN ( '101' , 'X01' ).

    SELECT SUM( menge )

    INTO sumgood

    FROM aufm

    WHERE bwart IN ( '101' , 'X01' )

    AND matnr EQ it_afpo-matnr

    AND aufnr EQ t_prodbom-aufnr.

    Don't forget to reward if useful....

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 10:09 AM

    Hi,

    Check the syntax of SUM:

    SUM( [DISTINCT] col ) Determines the sum of the content of the column col in the resulting set or in the current group. The data type of the column has to be numerical.

    Regards,

    Bhaskar

    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.