版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
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復制代碼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. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- JJF(陜) 068-2021 礦用風速傳感器校準規(guī)范
- 《馬兜鈴科蓼科》課件
- 藝術課程與學生心理健康的關系計劃
- 應急管理與保安工作的整合計劃
- 功能輸注裝置相關行業(yè)投資規(guī)劃報告
- 基礎研究與科學創(chuàng)新投資合同三篇
- 水環(huán)境管理與區(qū)域協(xié)調發(fā)展計劃
- 《液壓與氣動》課件 1油箱
- 生物知識點微課制作計劃
- 醫(yī)院修繕科工作總結計劃
- 體育賽事合作終止協(xié)議模板
- 電工四級題庫+答案
- 天津市河東區(qū)2022-2023學年七年級上學期期末地理試題
- DL-748.7-2001火力發(fā)電廠鍋爐機組檢修導則第7部分:除灰渣系統(tǒng)檢修
- 商業(yè)物業(yè)消防控制室操作規(guī)程
- 江蘇開放大學本科財務管理專業(yè)060111馬克思主義基本原理期末試卷
- 2024年4月自考00155中級財務會計試題及答案
- 商務英語寫作1(山東聯(lián)盟)智慧樹知到期末考試答案章節(jié)答案2024年山東管理學院
- 2024年遼寧農(nóng)業(yè)職業(yè)技術學院單招職業(yè)適應性測試題庫審定版
- 遇見朗讀者智慧樹知到期末考試答案章節(jié)答案2024年哈爾濱師范大學
- 中班音樂《小看戲》課件
評論
0/150
提交評論