使用oo alv方式動(dòng)態(tài)的創(chuàng)建、修改和刪除自定義_第1頁(yè)
使用oo alv方式動(dòng)態(tài)的創(chuàng)建、修改和刪除自定義_第2頁(yè)
使用oo alv方式動(dòng)態(tài)的創(chuàng)建、修改和刪除自定義_第3頁(yè)
使用oo alv方式動(dòng)態(tài)的創(chuàng)建、修改和刪除自定義_第4頁(yè)
使用oo alv方式動(dòng)態(tài)的創(chuàng)建、修改和刪除自定義_第5頁(yè)
已閱讀5頁(yè),還剩10頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.程序代碼:TYPE-POOLS:vimty.TYPES:BEGINOFty_mod,rowTYPEi,ENDOFty_mod.DATA:g_containergrid1TYPEscrfnameVALUE'CUSTOM_CONTAINERTYPEREFTOcl_gui_alv_grid,g_custom_containerTYPEREFTOcl_gui_custom_container.DATA:i_tableTYPEREFTOdata,wa_allTYPEREFTOdata.DATA:org_crit_instTYPEvimty_oc_type,old_rcLIKEsy-subrc,act_levelLIKEauthb-actvt,only_show_allowedTYPEc,i_excludeTYPEui_functions.DATA:i_modTYPESTANDARDTABLEOFty_mod,i_delTYPESTANDARDTABLEOFty_mod.FIELD-SYMBOLS:<i_itab>TYPEtable,<wa_tab>TYPEANY.DATA:BEGINOFheaderOCCURS1.INCLUDESTRUCTUREvimdesc.DATA:ENDOFheader.DATA:BEGINOFnamtabOCCURS50.INCLUDESTRUCTUREvimnamtabDATA:ENDOFnamtab.

DATA:vim_wheretabLIKEvimwheretbOCCURS10.DATA:dba_sellistLIKEvimsellistOCCURS10.SELECTION-SCREENBEGINOFBLOCKbbWITHFRAMETITLEtext-100PARAMETER:viewnameTYPEtvdir-tabname.SELECTION-SCREENSKIP2.SELECTION-SCREENBEGINOFLINE."Display"Change"Display"ChangeSELECTION-SCREEN PUSHBUTTON36(10) text-102 USER-COMMAND b2.SELECTION-SCREEN ENDOFLINE.SELECTION-SCREEN ENDOFBLOCKbb.42.ATSELECTION-SCREEN.CASEsy-ucomm.WHEN'B1'.SETPF-STATUS'ALV'.CALLSCREEN9001.WHEN'B2'.SETPF-STATUS'ALV1'.CALLSCREEN9001.ENDCASE.*ClassusedtogetchangeddataCLASSlcleventhandlerDEFINITION.PUBLICSECTION.METHODS:handle_data_changedFOREVENTdata_changedOFcl_gui_alv_gridIMPORTINGer_data_changed.ENDCLASS. "lcl_event_handlerDEFINITION*ClassusedtogetchangeddataCLASSlcl_event_handlerIMPLEMENTATION.*HandleDataChangedMETHODhandle_data_changed.63.PERFORMhandle_data_changedUSINGer_data_changed.63.64.65.66.67.68.69.70.71.72.73.74.75.76.77.78.79.80.81.82.83.84.85.86.87.88.89.90.91.92.93.94.95.ENDCLASS."lcleventhandlerIMPLEMENTATIONENDCLASS.*&*&*&ModuleSTATUS9001OUTPUT*&textMODULEstatus9001OUTPUT.DATA:lifieldcatTYPElvctfcat.DATA:lwafieldcatTYPElvcsfcat.DATA:lh_flag(1).DATA:gr_event_handlerTYPEREFTOlcl_event_handler.handlerCreatinganinstancefortheeventhandlerCREATEOBJECTgr_event_handler.TRY.CREATEDATAitableTYPETABLEOF(viewname).ASSIGNitable-CREATEDATAitableTYPETABLEOF(viewname).ASSIGNitable-〉*TO<iitab>.CREATEDATAwaallLIKELINEOF<iitab>.CREATEDATAwaallLIKELINEOF<iitab>.ASSIGNwaall->*TO<watab>.ASSIGNwaall->*TO<watab>.SelectingdatadynamicallySELECT*FROM(viewname)INTOTABLE<i_itab>.BuildingthefieldcatelogCALLFUNCTION'LVCFIELDCATALOGMERGE'EXPORTINGistructurename=viewnameistructurename=viewnameCHANGINGctfieldcat=lifieldcatEXCEPTIONSinconsistentinterface=1program_error3.OTHERS3.96.IFsy-subrc<>0.97.MESSAGEIDsy-msgidTYPEsy-msgtyNUMBERsy-msgno98.WITHsy-msgv1sy-msgv2sy-msgv3sy-msgv4.99.ENDIF.100.*Makingfieldseditableexceptkeyfields101.IFsy-ucomm='UPD'ORsy-ucomm='CHANGE'.102.LOOPATli_fieldcatINTOlwa_fieldcat.103.IFlwa_fieldcat-key=space.104.lwa_fieldcat-edit='X'.105.MODIFYli_fieldcatFROMlwa_fieldcat.106.ENDIF.107.ENDLOOP.108.ENDIF.109.*Makingfieldseditable110.IFsy-ucomm='NEW'.111.LOOPATli_fieldcatINTOlwa_fieldcat.112.lwa_fieldcat-edit='X'.113.MODIFYli_fieldcatFROMlwa_fieldcat.114.ENDLOOP.115.lh_flag='X'.116.CLEAR:<i_itab>.117.DO100TIMES.118.APPEND<wa_tab>TO<i_itab>.119.ENDDO.120.ENDIF.121.*Excludebuttons122.PERFORMexclude_tb_functionsCHANGINGi_exclude.123.IFg_custom_containerISINITIAL.124.CREATEOBJECTg_custom_container125.EXPORTING126.container_name=g_container.127.CREATEOBJECTgrid1

128.EXPORTING129.i_parent=g_custom_container.130.ENDIF.131.*Makingallfieldsnon-editableifdisplaymode132.IFsy-ucomm='SHOW'.133.LOOPATli_fieldcatINTOlwa_fieldcat.134.lwa_fieldcat-edit=''.135.MODIFYli_fieldcatFROMlwa_fieldcat.136.ENDLOOP.137.ENDIF.138.IFsy-ucomm='SAVE'.139.LOOPATli_fieldcatINTOlwa_fieldcat.140.IFlwa_fieldcat-keyNEspace.141.lwa_fieldcat-edit=space.142.MODIFYli_fieldcatFROMlwa_fieldcat.143.ENDIF.144.ENDLOOP.145.ENDIF.146.*DisplayingALVGrid147.CALLMETHODgrid1->set_table_for_first_display148.EXPORTING149.i_structure_name =viewname150.it_toolbar_excluding=i_exclude151.CHANGING152.it_outtab =<i_itab>153.it_fieldcatalog =li_fieldcat.154.IFsy-subrcNE0.155.EXIT.156.ENDIF.157.*Gettingthechangeddata158.SETHANDLERgr_event_handler->handle_data_changedFORgrid1.159.CATCHcx_sy_create_data_error.ENDTRY.ENDMODULE.*&"STATUS9001OUTPUT160.161.162.163.164.165.166.167.168.169.170.171.172.173.174.175.176.177.178.179.180.181.182.183.184.185.186.187.188.189.190.191.*&*&ModuleUSERCOMMAND9001INPUT*&textMODULEusercommand9001INPUT.DATA:lhnorecTYPEi,lh_total(5)TYPEc,lh_succ(40)TYPEc,lwadelTYPEty_mod,lhnorecTYPEi,lh_total(5)TYPEc,lh_succ(40)TYPEc,lwadelTYPEty_mod,lh_totdelTYPEi.*lh_flagTYPEc,*li_fieldcatTYPElvc_t_fcat,*lwa_fieldcatTYPElvc_s_fcat.lwamodty_mod,TYPECASEsy-ucomm.WHEN'CHANGE'.SETPF-STATUS'ALV1'.WHEN'SAVE'.LockthetableCALLFUNCTION'ENQUEUE_E_TABLE'EXPORTINGmoderstable'E'tabname=viewnameEXCEPTIONSforeign_locksystem_failure=23.OTHERS3.IFsy-subrc<>0.

192.193.192.193.194.195.196.197.198.199.200.201.202.*204.205.206.207.208.209.210.211.212.*214.215.216.217.218.*220.221.*222.WITHsy-msgv1sy-msgv2sy-msgv3sy-msgv4.ENDIF.IFNOTgrid1ISINITIAL.CALLMETHODgrid1->check_changed_data.ENDIF.SORTi_modBYrow.DELETEADJACENTDUPLICATESFROMi_modCOMPARINGrow.lh_norec=LINES(i_mod).lh_total=lh_norec.SHIFTlh_totalLEFTDELETINGLEADINGspace.StandardTableUpdateIFi_mod[]ISNOTINITIAL.LOOPATi_modINTOlwa_mod.READTABLE<i_itab>INTO<wa_tab>INDEXlwa_mod-row.IFsy-subrc=0.IFlh_flagNE'X'.MODIFY(viewname)FROM<wa_tab>.ELSE.INSERT(viewname)FROM<wa_tab>.IFsy-subrcNE0.MESSAGEe009.ENDIF.ENDIF.ENDIF.ENDLOOP.CONCATENATElh_total' 'text-S01INTOlh_succSEPARATEDBYMESSAGEi000WITHlh_succ.ELSE.MESSAGEi000WITHtext-S02.space.ENDIF.space.223.*Unlockthetable224.225.226.227.228.229.230.231.232.233.234.235.236.237.238.239.240.241.242.243.244.245.246.247.248.249.250.251.252.253.254.255.CALLFUNCTION'DEQUEUE_E_TABLE'EXPORTINGmode_rstable='E'tabname =viewname.CLEAR:i_mod[],lh_flag.WHEN'DELETE'.SelectingSelectedRowsPERFORMhandle_user_commandUSINGsy-ucomm.IFi_del[]ISNOTINITIAL.LOOPATi_delINTOlwa_del.del-row.READTABLE<i_itab>INTO<wa_tab>INDEXlwadel-row.IFsy-subrc=0.DELETE(viewname)FROM<wa_tab>.ENDIF.ENDLOOP.lh_totdel=LINES(i_del).MESSAGEi011WITHlh_totdel.CLEAR:i_del[],lh_totdel.ELSE.MESSAGEi000WITHtext-S03.ENDIF.WHEN'EXIT'OR'BACK'OR'CANCEL'.CLEAR:li_fieldcat[],i_exclude[],i_del[],lh_totdel.LEAVETOSCREEN0.ENDCASE.ENDMODULE."USERCOMMAND9001INPUT*& **& Formhandle_data_changed*& *FORMhandle_data_changedUSING p_er_data_changedTYPEREFTOcl_alv_changed_data_protocol.DATA:lwa_mod_cell TYPE lvc_s_modi,lwa_mod TYPE ty_mod.LOOPATp_er_data_changed->mt_good_cellsINTOlwa_mod_cell.lwa_mod-row =lwa_mod_cell-row_id.APPENDlwa_modTO i_mod.ENDLOOP.ENDFORM. "handle_data_changed*& **& Formexclude_tb_functions*& *FORMexclude_tb_functionsCHANGINGpt_excludeTYPEui_functions.DATA:lwa_excludeTYPEui_func.lwa_exclude=cl_gui_alv_grid=>mc_fc_loc_append_row.APPENDlwa_excludeTOpt_exclude.lwa_exclude=cl_gui_alv_grid=>mc_fc_loc_copy.APPENDlwa_excludeTOpt_exclude.lwa_exclude=cl_gui_alv_grid=>mc_fc_loc_copy_row.APPENDlwa_excludeTOpt_exclude.lwa_exclude=cl_gui_alv_grid=>mc_fc_loc_cut.APPENDlwa_excludeTOpt_exclude.lwa_exclude=cl_gui_alv_grid=>mc_fc_loc_delete_row.APPENDlwa_excludeTOpt_exclude.lwa_exclude=cl_gui_alv_grid=>mc_fc_loc_insert_row.APPENDlwa_excludeTOpt_exclude.lwa_exclude=cl_gui_alv_grid=>mc_fc_loc_move_row.

APPENDlwa_excludeTOpt_exclude.lwa_exclude=cl_gui_alv_grid=>mc_fc_loc_paste.APPENDlwa_excludeTOpt_exclude.lwa_exclude=cl_gui_alv_grid=>mc_fc_loc_paste_new_row.APPENDlwa_excludeTOpt_exclude.ENDFORM. "exclude_tb_functions*& **& Formhandle_user_command*& *FORMhandle_user_commandUSINGp_ucommTYPEsyucomm.DATA:i_selected_rows TYPE lvc_t_roid.DATA:lwa_selected_row TYPE lvc_s_roid,lwa_del TYPE ty_mod.CALLMETHODgrid1->get_selected_rowsIMPORTINGet_row_no=i_selected_rows.LOOPATi_selected_rowsINTOlwa_selected_row.lwa_del-row=lwa_selected_row-row_id.APPENDlwa_delTOi_del.ENDLOOP.ENDFORM. "handle_user_command復(fù)制代碼PS:1、 container名稱:CUSTOM_CONTAINER2、 創(chuàng)建PFStatus——“ALV”“ALVT

Textsymbols 5已I已ctioritExfcs 'LjtHeadings4、創(chuàng)建4、創(chuàng)建T-code-SE93Textd...m…H100OMhJ5 *101Lusplay17 ■102Change66SOIRazord(S)Saved1

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論