Application Development and Automation 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: 
Read only

ALV Sort

Former Member
0 Likes
464

hi,

this is my code for my alv sorting,

w_sortinfo_alv-tabname = 'I_RESULTS_SORTED'. " Internal

w_sortinfo_alv-fieldname = 'KOSTL'. " Give Fieldname

w_sortinfo_alv-GROUP = '*'.

w_sortinfo_alv-subtot = 'X'.

append w_sortinfo_alv to i_sortinfo_alv.

is there anyway I can sort by khinr ascending then by

kostl ascending, and total by kostl.

thanks.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
349

Sure, it should be as easy as adding it to the table.




w_sortinfo_alv-tabname = 'I_RESULTS_SORTED'. " Internal
w_sortinfo_alv-fieldname = 'KHINR'. " Give Fieldname
w_sortinfo_alv-up        = 'X'.
append w_sortinfo_alv to i_sortinfo_alv.

w_sortinfo_alv-tabname = 'I_RESULTS_SORTED'. " Internal
w_sortinfo_alv-fieldname = 'KOSTL'. " Give Fieldname
w_sortinfo_alv-up        = 'X'.
w_sortinfo_alv-GROUP = '*'.
w_sortinfo_alv-subtot = 'X'.
append w_sortinfo_alv to i_sortinfo_alv.

Regards,

Rich Heilman

2 REPLIES 2
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
350

Sure, it should be as easy as adding it to the table.




w_sortinfo_alv-tabname = 'I_RESULTS_SORTED'. " Internal
w_sortinfo_alv-fieldname = 'KHINR'. " Give Fieldname
w_sortinfo_alv-up        = 'X'.
append w_sortinfo_alv to i_sortinfo_alv.

w_sortinfo_alv-tabname = 'I_RESULTS_SORTED'. " Internal
w_sortinfo_alv-fieldname = 'KOSTL'. " Give Fieldname
w_sortinfo_alv-up        = 'X'.
w_sortinfo_alv-GROUP = '*'.
w_sortinfo_alv-subtot = 'X'.
append w_sortinfo_alv to i_sortinfo_alv.

Regards,

Rich Heilman

Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
349

Hi Jamie

Rich's answer should solve your problem. For your further work related with the ALV Grid control you can refer to the tutorial <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an%20easy%20reference%20for%20alv%20grid%20control.pdf">"An Easy Reference for ALV Grid Control"</a>.

Regards

*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>