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

I got the result.. it was in declaration of internal table.. Sorry

Dear friends,

I have an internal table as i have given below

X Y

-


AA3 A

CC1 C

AB1 A

BB1 B

BB2 B

AA2 B

I want it to sort according to X then want to Group according to Y. at end of Y a line is required.

What i have done:-

Select X Y into ... table itab order by Y.

sort itab by X Y.

on change of X.

write: X.

endon.

at end of Y.

Write: sy-uline.

endat.

but i am not getting the desired output.

Can anybody guide mw to the solution?

Regards,

Lijo Joseph

Message was edited by: lijo joseph

Message was edited by: lijo joseph

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 23, 2004 at 04:39 AM

    For the given input, can you show how your desired ouptut should be ?

    Regards,

    Subramanian V.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 23, 2004 at 05:56 AM

    Hi,

    Consider the following code example. I believe it is rather self-explanatory.

    tables mara.
    
    data itab type mara occurs 0 with header line.
    
    select matnr
           ernam
      from mara
      into corresponding fields of table itab
      group by ernam
               matnr
      order by ernam
               matnr.
    
    clear itab.
    
    loop at itab.
      at new matnr. 
        write : / itab-matnr.
      endat.
    
      on change of itab-ernam.
        check sy-tabix ne 1.
        write sy-uline.
      endon.
    
      at last.
        write sy-uline.
      endat.
    endloop.
    

    Please do get back if you have any doubts.

    By the way, the ORDER BY and GROUP BY clauses can be avoided, provided you are willing to sort your internal table as desired. But only one of the two needs to be used. Depends on whether you want the processing at the database or at the application server.

    Regards,

    Anand Mandalika.

    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.