Application Development 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: 

Sorting a sorted table

Former Member
0 Kudos

Hi,

Iu2019m developing the invoice smartform. The used structure is u201CIS_BIL_INVOICE type LBBIL_INVOICEu201D. It is a sorted table (I need to sort it with different criteria, concretely its IT_GEN component). How can I sort it (I cannot use SORT command)? Do I have to modify the main program? Or does exist a different way?

Thanks in advance,

Ricard.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Naimesh,

When I try to run this code, appears the following message: u201Cu201CIS_BIL_INVOICE-IT_GENu201D is a table of the kind SORTED. You cannot use the SORT command with this type of tableu201D. So, is it impossible to sort a sorted table?

Thanks in advance,

Ricard.

4 REPLIES 4

Former Member
0 Kudos

You can copy the sorted table to a temporary internal table which is not of type sorted and sort it the way you want.

naimesh_patel
Active Contributor
0 Kudos

You can add progarm lines node in the Smartform in the very first window of the Smartform.

You can use the code like:


SORT LBBIL_INVOICE-IT_GEN BY BIL_NUMBER ITM_NUMBER

You can also use the "Form Routines" in the "Global Definitions" to write the code in the Smartforms.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi Naimesh,

When I try to run this code, appears the following message: u201Cu201CIS_BIL_INVOICE-IT_GENu201D is a table of the kind SORTED. You cannot use the SORT command with this type of tableu201D. So, is it impossible to sort a sorted table?

Thanks in advance,

Ricard.

matt
Active Contributor
0 Kudos

Yes it is impossible to sort a sorted table to a different sort order. You must copy the table to a sorted table (with or without a unique key) with the different sort order. Exactly as Aparna Shekhar already said.

If you control the definition of the internal table, then you can specify secondard indexes in later versions of Netweaver.

matt