Hi Rama,
as you can see, we will determine the length of your data in the first Loop.
e.g. STRLEN( FIELD1 ) will deliver "4" for the value "B-BC".
Then we sort the related value/length-pairs by the length.
In the second Loop your data-table will be re-build in order of length, but only with your value.
with the requirement stated above, you just copy this code and change some variable-names.
it will work..
If your field1-component is not type string you can try to use SHIFT RIGHT on the component and then sort the internal table...
Regards,
Jan Martin