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

sort of type c field

I am making a report for qm module. In report while I sort a field of type c (but having numbers) I face a problem. I describe briefly as this.

The contents of field are like this as

10, 12, 10, 8, 10, 12, 14, 8, 13.

When I sort it ascending it should be

8, 8, 10, 10, 12, 12, 13, 14 like this.

But result is coming 10, 10, 12, 12, 13, 14, 8, 8 as this. I think the problem occurred when it detects only 8 , because when the field kept different contents for different operation it sort correctly.

Here is my code.

Loop at itab.

…..

….

….

SORT COMP_TAB BY FINAL_VAL ASCENDING.

LOOP AT COMP_TAB.

READ TABLE COMP_TAB INDEX 1 INTO MIN.

ENDLOOP.

…..

…..

Clear COMP_TAB.

Refresh COMP_TAB.

Endloop.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 01, 2007 at 01:36 PM

    Hi,

    Remove this statement

    Refresh COMP_TAB

    Why are you reading the same table inside the same table loop?

    LOOP AT COMP_TAB.

    READ TABLE COMP_TAB INDEX 1 INTO MIN.

    ENDLOOP.

    Regards,

    Satish

    Message was edited by:

    Satish Panakala

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 01, 2007 at 02:03 PM

    Try changing the field from C to N.

    Since its a character field and sap takes 1 as a lower number than 8 ... that is why the sorting is coming in that way

    if your data is stored as

    10, 12, 10, <b>08</b>, 10, 12, 14, <b>08</b>, 13 then i think the sort will be proper.

    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.