对应it_sort可以在SE37中看到参考了SLIS_T_SORTINFO_ALV。 见如下程序(可执行的)。 TYPES:BEGINOFWA_TAB,CHX(1),FIELD1(20),FIELD2(20),FIELD3(20),ENDOFWA_TAB.DATA:IT_TABTYPETABLEOFWA_TABWITHHEADERLINE.DO20TIMES.IT_TAB-FIELD1=SY-INDEX.IT_TAB-FIELD2='BBB'.IT_TAB-FIELD3='CCC'.APPENDIT_TAB.ENDDO.***ALVDISPLAYTYPE-POOLS:slis."alvDATA:f_repidLIKEsy-repid,"programnamef_titleTYPElvc_title."alvtitleDATA:gs_layoutTYPEslis_layout_alv,it_fieldsTYPEslis_t_fieldcat_alv,wa_fieldsTYPELINEOFslis_t_fieldcat_alv.f_repid=sy-repid.f_title='TESTALV'.gs_layout-colwidth_optimize='X'.gs_layout-box_fieldname='CHX'."selectcolumngs_layout-coltab_fieldname='COLOUR'.gs_layout-zebra='X'.REFRESHit_fields.CLEARwa_fields.wa_fields-fieldname='FIELD1'.wa_fields-seltext_l='FIELD1'.APPENDwa_fieldsTOit_fields.CLEARwa_fields.wa_fields-fieldname='FIELD2'.wa_fields-seltext_l='FIELD2'.APPENDwa_fieldsTOit_fields.CLEARwa_fields.wa_fields-fieldname='FIELD3'.wa_fields-seltext_l='FIELD3'.APPENDwa_fieldsTOit_fields.CLEARwa_fields.*types:beginofslis_sortinfo_alv,**spos(2)typen,*sposlikealvdynp-sortpos,*fieldnametypeslis_fieldname,*tabnametypeslis_fieldname,**up(1)typec,**down(1)typec,**group(2)typec,**subtot(1)typec,*uplikealvdynp-sortup,*downlikealvdynp-sortdown,*grouplikealvdynp-grouplevel,*subtotlikealvdynp-subtotals,*comp(1)typec,*expa(1)typec,*obligatory(1)typec,*endofslis_sortinfo_alv.datait_sortableTYPETABLEOFslis_sortinfo_alvwithHEADERLINE.it_sortable-fieldname='FIELD1'.it_sortable-down='X'. "分别试试DOWN 和 UP的区别APPENDIT_SORTABLE.CALLFUNCTION'REUSE_ALV_GRID_DISPLAY'EXPORTINGi_callback_program=f_repidi_callback_pf_status_set='SET_PF'i_callback_user_command='USER_COM'i_grid_title=f_titleis_layout=gs_layoutit_fieldcat=it_fieldsi_save='A'it_sort=IT_SORTABLE[]"排序设置TABLESt_outtab=it_TABEXCEPTIONSPROGRAM_ERROR=1.IFSY-SUBRC0.MESSAGEIDSY-MSGIDTYPESY-MSGTYNUMBERSY-MSGNOWITHSY-MSGV1SY-MSGV2SY-MSGV3SY-MSGV4.ENDIF.*&--------------------------------------------------------------------**&Formset_pf_client*&--------------------------------------------------------------------**text:ALVstatus*---------------------------------------------------------------------**-->EXTABtext*---------------------------------------------------------------------*FORMset_pfUSINGextabTYPEslis_t_extab.SETPF-STATUS'Z001'.ENDFORM."SET_PF*&--------------------------------------------------------------------**&Formuser_com*&--------------------------------------------------------------------**text:button'sfunction*---------------------------------------------------------------------**-->R_UCOMMtext*-->RS_SELFIELDtext*---------------------------------------------------------------------*FORMuser_comUSINGr_ucommLIKEsy-ucommrs_selfieldTYPEslis_selfield.CASEr_ucomm.WHEN:'BACK'OR'EXIT'OR'CANCEL'.LEAVETOSCREEN0.ENDCASE.rs_selfield-refresh='X'.rs_selfield-col_stable='X'.rs_selfield-row_stable='X'.ENDFORM."user_com_second
在SE37中查看IMPORT中I_SAVE对应的长文本说明。 Value range ' ' = Display variants cannot be saved Defined display variants (such as delivered display variants) can be selected for presentation regardless of this indicator. However, changes cannot be saved. 'X' = Standard save mode Display variants can be saved as standard display variants. Saving display variants as user-specific is not possible. 'U' = User-specific save mode Display variants can only be saved as user-specific. 'A' = Standard and user-specific save mode Display variants can be saved both as user-specific and as standard variants. Users make their choice on the dialog box for saving the display variant. 在ALV中操作用户可以自己设置ALV的显示格式,比如列的位置,当有权限设置user-specific 可以保存为某用户自己特有的格式。比如‘U’和‘A’
点保存布局按钮,在弹出框中有哥特定用户的选项,当为‘A’或'U'的时候是可操作的,‘X'的时候则不可操作。sapfans_2.jpg [此贴子已经被作者于2009-4-13 22:32:38编辑过]