SAP技术文档byLuffy2012-04-2409:52:35E-mail:yunfei686@126.com第1页版权所有,仅供交流reportzibmwj_test06nostandardpageheading.type-pools:slis.*-Fieldcatalogdata:it_fieldcattypelvc_t_fcat.data:x_fieldcattypelvc_s_fcat.data:x_layouttypelvc_s_layo.第1步:用操作具体单元的是否可编辑的内表和工作区data:ls_edittypelvc_s_styl,lt_edittypelvc_t_styl,gr_alvgridtypereftocl_gui_alv_grid.第2步:在内表定义添加字段,用于控制具体行的具体单元是否可编辑data:beginofit_vbapoccurs0,vbelntypeebeln,posnrlikevbap-posnr,styletypelvc_t_styl,FORDISABLEendofit_vbap.data:ls_outtablikelineofit_vbap.selectvbelnposnrSAP技术文档byLuffy2012-04-2409:52:35E-mail:yunfei686@126.com第2页版权所有,仅供交流upto100rowsintocorrespondingfieldsoftableit_vbapfromvbap.data:l_postypeivalue1.clear:l_pos.l_pos=l_pos+1.x_fieldcat-seltext='VBELN'.x_fieldcat-fieldname='VBELN'.x_fieldcat-tabname='ITAB'.x_fieldcat-col_pos=l_pos.x_fieldcat-edit='X'.x_fieldcat-outputlen='10'.*x_fieldcat-ref_field='VBELN'.*x_fieldcat-ref_table='VBAK'.appendx_fieldcattoit_fieldcat.clearx_fieldcat.l_pos=l_pos+1.x_fieldcat-seltext='POSNR'.x_fieldcat-fieldname='POSNR'.x_fieldcat-tabname='ITAB'.x_fieldcat-col_pos=l_pos.x_fieldcat-edit='X'.x_fieldcat-outputlen='5'.appendx_fieldcattoit_fieldcat.clearx_fieldcat.l_pos=l_pos+1.第3步:设置第六行两个单元都不能输入sy-tabix=6.ls_edit-fieldname='VBELN'.ls_edit-style=cl_gui_alv_grid=mc_style_disabled.ls_edit-style2=space.ls_edit-style3=space.ls_edit-style4=space.ls_edit-maxlen=10.insertls_editintotablelt_edit.ls_edit-fieldname='POSNR'.ls_edit-style=cl_gui_alv_grid=mc_style_disabled.ls_edit-style2=space.ls_edit-style3=space.ls_edit-style4=space.SAP技术文档byLuffy2012-04-2409:52:35E-mail:yunfei686@126.com第3页版权所有,仅供交流ls_edit-maxlen=6.insertls_editintotablelt_edit.insertlinesoflt_editintotablels_outtab-style.第4步:将控制数据写到内表modifyit_vbapindexsy-tabixfromls_outtabtransportingstyle.设置第10行只有项目不能输入clearls_outtab.refreshlt_edit.ls_edit-fieldname='POSNR'.ls_edit-style=cl_gui_alv_grid=mc_style_disabled.ls_edit-style2=space.ls_edit-style3=space.ls_edit-style4=space.ls_edit-maxlen=6.insertls_editintotablelt_edit.insertlinesoflt_editintotablels_outtab-style.sy-tabix=10.将控制数据写到内表modifyit_vbapindexsy-tabixfromls_outtabtransportingstyle.第5步:设置控制字段x_layout-stylefname='STYLE'.callfunction'REUSE_ALV_GRID_DISPLAY_LVC'exportingi_callback_program=sy-repidis_layout_lvc=x_layoutit_fieldcat_lvc=it_fieldcattablest_outtab=it_vbap[]exceptionsSAP技术文档byLuffy2012-04-2409:52:35E-mail:yunfei686@126.com第4页版权所有,仅供交流program_error=1others=2.ifsy-subrcne0.messageidsy-msgidtypesy-msgtynumbersy-msgnowithsy-msgv1sy-msgv2sy-msgv3sy-msgv4.endif.