Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Sort Internal tbale with fiel;d values

Hi All

I have to sort an internal based on values of field . in the below order of value

CTP

HPL

SPL

ANC.

Wolud like know to if theres a better method of doing than what I did below in an user exit .

DATA : t_ltap_vb_temp TYPE  ltap_vb OCCURS 0 WITH HEADER LINE .

*Need to sort ltap_vb with letyp value in order of 'CTP' , 'HPL' ,'SPL' , 'ANC'
*could not find a better logic

break kollav.
LOOP AT t_ltap_vb WHERE letyp = 'CTP'.
  APPEND t_ltap_vb TO t_ltap_vb_temp.
  DELETE t_ltap_vb.
ENDLOOP.

LOOP AT t_ltap_vb WHERE letyp = 'HPL'.
  APPEND t_ltap_vb TO t_ltap_vb_temp.
  DELETE t_ltap_vb.
ENDLOOP.

LOOP AT t_ltap_vb WHERE letyp = 'SPL'.
  APPEND t_ltap_vb TO t_ltap_vb_temp.
  DELETE t_ltap_vb.
ENDLOOP.

LOOP AT t_ltap_vb WHERE letyp = 'ANC'.
  APPEND t_ltap_vb TO t_ltap_vb_temp.
  DELETE t_ltap_vb.
ENDLOOP.

LOOP AT t_ltap_vb.
  APPEND t_ltap_vb TO t_ltap_vb_temp.
ENDLOOP.

t_ltap_vb[] = t_ltap_vb_temp[].

Any alternative suggestions will be great .

Thanks

Vinay

Edited by: vinay kolla on May 20, 2009 11:21 AM

Former Member
Not what you were looking for? View more on this topic or Ask a question