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

Sort issue with ALV on Material number field

Hi,

I have an ALV grid developed which displays Material number and other related information. My internal table for ALV contains Material number in internal format. When I am preparing my Field catalog I give the Conversion exit so that when the report is displayed it displays the external material number.

However now when user hits on the ALV grid toolbar's Sort button, the system is sorting the ALV grid for Material number in internal format.

Please let me know how I can have the ALV sort the material number column by considering the external format.

Thanks in advance.

SAC.

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 Feb 24, 2009 at 03:01 PM

    Hi,

    I'm not clear about your logic, but I think you have to convert the material number before you pass it to the display function. Try to convert the data before you pass it for alv displaying or fieldcat or layout modification.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 24, 2009 at 06:15 PM

    hi ,

    you can take one more char field in internal table and store your external format. i think you are trying to remove leading zero from the material number. so remove the leading zero from the space using SHIFT RIGHT and 'TRANSPORTING' and store it in on field of internal table and display it. it will solve your problem.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 24, 2009 at 08:51 PM

    Hi Saleem

    while preparing the field catalog ,hide the internal format material number field and also

    create the field catalog for the external material number field.

    Now pass this field catalog to your method SET_TABLE_FOR_FIRST_DISPLAY.

    This will solve your problem.

    Also have a look at this link.It shows you how to sort

    in alv with example program ans screen shots.

    [https://wiki.sdn.sap.com/wiki/display/ABAP/SORTinALV]

    [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/eac1fa0b-0e01-0010-0990-8530de4908a6]

    Regards

    Hareesh

    Edited by: Hareesh Menon on Feb 24, 2009 9:56 PM

    Edited by: Hareesh Menon on Feb 24, 2009 10:02 PM

    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.