Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Sort issue with an Internal table

Former Member
0 Likes
440

Hi All,

I have an internal table with following format.

Invoice Item Amount

951 <Blank> 450.00

951 0010 1200.00

951 0020 1300.00

Now i need to display this internal table in such a way that,

Invoice Item Amount

951 0010 1200.00

951 0020 1300.00

951 <Blank> 450.00

How to sort for such requirements?

Basically, the item value is blank for Tax amount.

Hence in the report, the layout should show the details as above.... (Line item 1, 2...and at last Total Tax of all line items Amount).

Please Help me.....

Regards

Pavan

1 ACCEPTED SOLUTION
Read only

christine_evans
Active Contributor
0 Likes
421

>

> Hi All,

>

> I have an internal table with following format.

>

> Invoice Item Amount

> 951 <Blank> 450.00

> 951 0010 1200.00

> 951 0020 1300.00

>

> Now i need to display this internal table in such a way that,

>

> Invoice Item Amount

> 951 0010 1200.00

> 951 0020 1300.00

> 951 <Blank> 450.00

>

>

> How to sort for such requirements?

>

> Basically, the item value is blank for Tax amount.

>

> Hence in the report, the layout should show the details as above.... (Line item 1, 2...and at last Total Tax of all line items Amount).

>

>

> Please Help me.....

>

> Regards

> Pavan

Add another column to the table, copy the item values into this column setting the tax line value to 9999, sort by this column.

Hi All,

I have an internal table with following format.

Invoice Item Amount

951 <Blank> 450.00

951 0010 1200.00

951 0020 1300.00

Now i need to display this internal table in such a way that,

Invoice Item Amount

951 0010 1200.00

951 0020 1300.00

951 <Blank> 450.00

How to sort for such requirements?

Basically, the item value is blank for Tax amount.

Hence in the report, the layout should show the details as above.... (Line item 1, 2...and at last Total Tax of all line items Amount).

Please Help me.....

Regards

Pavan

2 REPLIES 2
Read only

christine_evans
Active Contributor
0 Likes
422

>

> Hi All,

>

> I have an internal table with following format.

>

> Invoice Item Amount

> 951 <Blank> 450.00

> 951 0010 1200.00

> 951 0020 1300.00

>

> Now i need to display this internal table in such a way that,

>

> Invoice Item Amount

> 951 0010 1200.00

> 951 0020 1300.00

> 951 <Blank> 450.00

>

>

> How to sort for such requirements?

>

> Basically, the item value is blank for Tax amount.

>

> Hence in the report, the layout should show the details as above.... (Line item 1, 2...and at last Total Tax of all line items Amount).

>

>

> Please Help me.....

>

> Regards

> Pavan

Add another column to the table, copy the item values into this column setting the tax line value to 9999, sort by this column.

Read only

Former Member
0 Likes
421

Hi,

First move the blank item values of the internal table to the other internal table.

Let the internal table 1 be :

Invoice Item Amount

951 <Blank> 450.00

951 0010 1200.00

951 0020 1300.00

Now loop at the above internal table where item = ' ' and populate the internal table 2.

Now delete the records from internal table 1 where item equals to blank and then sort the internal table 1 as your wish..

Now follow the code as below:

data: v_tabix type sy-tabix.

Loop at table 2.

Loop at table 1 where invoice = table2-invoice.

Endloop.

v_tabix = sy-tabix + 1.

Insert table 1 record index v_tabix.

Endloop.