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: 

Is a Kind of a table sorted-Smartform

Former Member
0 Kudos

Hi Experts,

Im trying to sort an internal table in a smartform but im receiving the error:"itab is a table of the kind sorted.You cannot use the sort command with this type of table"

Could anyone help me with this error?

Thanks,

Michael

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi michael ,

Can u post the screen shot of the error and the declaration of the table.

Did you sort it in global definitions -> initialization part.

regards,

Ramya R

6 REPLIES 6

Former Member
0 Kudos

Hi michael ,

Can u post the screen shot of the error and the declaration of the table.

Did you sort it in global definitions -> initialization part.

regards,

Ramya R

0 Kudos

Hi Ramya,

Thanks for the reply.

The 1st jpeg shows the error message

The 2nd jpeg shows where its declared.

No i dont have it sorted anywhere else.

Thanks for any help Ramya. It would be really appreciated.

Michael

0 Kudos

Michael drill down into the structure of  is_bill_invoice-itgen and you will find it is declared as a sorted table. You cannot sort tables of type sorted, they are sorted for you at run time. So long as you use the INSERT command when building the table it will maintain the sort order.

If you want to change the sort order then copy table is_bill_invoice-itgen to an internal table of type STANDARD, and sort that instead.

Che

0 Kudos

Hi Michael,

It looks like you are using the structure LBBIL_INVOICE and you are trying to sort the IT_GEN component of the table.

If you look at the definition of IT_GEN, it is based on the table type LB_T_BIL_IT_GEN which is defined as a sorted table already and the data is pre sorted by BIL_NUMBER and ITM_NUMBER.

If you need to sort it differently, then you will have to move the data to your own internal table with line type LBBIL_IT_GEN and then use that subsequently.

- Puneet

Subhankar
Active Contributor
0 Kudos

Hi Michael,

If you check the structure LBBIL_INVOICE in SE11 you can see the field IT_GEN of table type LB_T_BIL_IT_GEN. Also table type LB_T_BIL_IT_GEN is declared as sorted table. So you can not sort the table. System will automatically sort the table based fields mention in the 'Primary Key' tab. Here you IT_GEN table is automatically sorted by these two fields.

BIL_NUMBER

ITM_NUMBER

Thanks

Subhankar

vamshi_mohan
Participant
0 Kudos

Hi Michael,

Please do not try to sort the IS_BIL_INVOICE or any other internal table of that deep structure. Because it is coming as an Import Parameter to your Smartform.

If you want to sort some table, first copy it into a local internal table and then sort.

Regards,

Vamshi.