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 of internal tables

Former Member
0 Kudos

Dear All,

i have two internal tables itab1 & itab2.

ITAB1 is of strecture EBANX, and ITAB2 is declared as fallows:

TYPES: BEGIN OF gty_temp_stru,

BANFN TYPE eban-BANFN,

matnr TYPE eban-matnr,

werks TYPE eban-werks,

land1 TYPE t001w-land1,

taxim TYPE mlan-taxim,

END OF gty_temp_stru.

DATA: ITAB2 TYPE TABLE OF GTY_TEMP_STRU,

GWA_ITAB2 TYPE GTY_TEMP_STRU.

now once i fetch the data into ITAB2 i have to sort it based on ITAB2-TAXIM.

based on the result of ITAB2 i have to sort the data in ITAB1.

How to do this, plz help me in solving the issue.

Thanks,

Rama

6 REPLIES 6

Former Member
0 Kudos

ITAB1 is a structure ? how do u sort it? can u explain?

0 Kudos

Hi,

itab1 is an internal table of strecture EBANX, its not a strecture.

Former Member
0 Kudos

DATA: ITAB LIKE SORTED TABLE OF GTY_STR.

SORT ITAB2 BY TAXIM.

former_member386202
Active Contributor
0 Kudos

Hi,

sort itab2 by taxim.

sort itab1 by taxim.

Regards,

Prashant

0 Kudos

Hi Prashant ,

please go through the below explination

*************************************

sort itab2 by taxim.

sort itab1 by taxim.

this can not be done, because we don't have the field TAXIM in ITAB1.

****************************************

itab1 can have records as fallows

BANFN BNFPO NEW_PO NEW_ITEM

9000000011 | 00010 | X | space

9000000012 | 00010 | space | X

9000000013 | 00010 | space | X

9000000015 | 00010 | space | X

9000000014 | 00010 | X | space

9000000016 | 00010 | space | X

and based on the values that we fetch from EBAN, T001W and MLAN into itab2

we have to sort thouse itab2 results based on the values for TAXIM.

once the table itab2 is sorted, based on the result we have to sort the table itab1.

Regards,

Rama

Former Member
0 Kudos

hai friend do one thing...take a final internal table t_final and add all the fields of itab1 and itab2 now sort the final with first what u want ..

sort t_final by itab1-field itab2-field..

now first it will sort it by itab2-field and then itab1-field..

regrads points if usefull