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

Select Max problem

Hi currently i have this sql error problem which i do not know how to solve. below are my codes. I think there is something wrong with my sql statement.

DATA: M_TABLE TYPE TABNAME,

COLUMN_FIELD(14) TYPE C,

VALUE2 TYPE P DECIMAL 1.

M_TABLE = 'ZTABLE'.

COLUMN_FIELD = 'GPA'."example 2.1

SELECT MAX( COLUMN_FIELD ) FROM (M_TABLE) INTO VALUE2.

============================================

After solving this problem, i have another problem. Now my column_field 'GPA' is to decimal 1 as i have declared. But if i need to do it in dynamic example if another column field is money which i do not know the decimal will be placing at where, how should i declare it?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 27, 2007 at 07:42 AM

    HI,

    do like this.

    DATA: M_TABLE TYPE TABNAME,

    COLUMN_FIELD(14) TYPE C,

    VALUE2(10)." TYPE P DECIMALs 1.

    M_TABLE = 'MARA'.

    COLUMN_FIELD = 'MATNR'."example 2.1

    SELECT MAX( MATNR ) FROM (M_TABLE) INTO VALUE2.

    write:/ value2.

    rgds,

    bharat.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 27, 2007 at 08:53 AM

    I have this error message when i execute my program.

    SAPSQL_INVALID_FIELDNAME

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi,

      Check this code. It might help you to solve the problem.

      DATA: itab TYPE STANDARD TABLE OF spfli,

      wa LIKE LINE OF itab.

      DATA: line(72) TYPE c,

      list LIKE TABLE OF line(72).

      START-OF-SELECTION.

      line = ' AIRPFROM AIRPTO '.

      APPEND line TO list.

      SELECT DISTINCT (list)

      INTO CORRESPONDING FIELDS OF TABLE itab

      FROM spfli.

      IF sy-subrc EQ 0.

      LOOP AT itab INTO wa.

      WRITE :/ wa-airpfrom,wa-airpto.

      ENDLOOP.

      ENDIF.

      Reward Points, if useful.

      Regards,

      Manoj Kumar

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2008 at 07:22 AM

    SOLVED. THANKS =)

    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.