




免費(fèi)預(yù)覽已結(jié)束,剩余1頁可下載查看
下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
(一)ALV_GRID添加自定義的按鈕和響應(yīng)命令 2009-04-29 10:37 我們在ALV的工具條上增加一些按鈕來增加我們自定義的功能,當(dāng)然也可以在GUI狀態(tài)中增加,2種的處理方式是不一樣的. 我們通過toolbar事件來增加按鈕,然后通過user_command事件來實(shí)現(xiàn)我們自定義的功能. 在TOOLBAR事件里,我們把自定義的按鈕加到參數(shù)e_object的表屬性mt_toolbar中可以了.下面是一段示例代碼:FORM handle_toolbar USING i_object TYPE REF TO cl_alv_event_toolbar_set. DATA: ls_toolbar TYPE stb_button. CLEAR ls_toolbar. MOVE 3 TO ls_toolbar-butn_type. APPEND ls_toolbar TO i_object-mt_toolbar. CLEAR ls_toolbar. MOVE PER TO ls_toolbar-function. MOVE icon_display_text TO ls_toolbar-icon. MOVE Passenger Info(201) TO ls_toolbar-quickinfo.MOVE Passenger Info(201) TO ls_toolbar-text. MOVE TO ls_toolbar-disabled. APPEND ls_toolbar TO i_object-mt_toolbar. CLEAR ls_toolbar. MOVE EXCH TO ls_toolbar-function. MOVE 2 TO ls_toolbar-butn_type. MOVE icon_calculation TO ls_toolbar-icon. MOVE Payment in other Curencies(202) TO ls_toolbar-quickinfo. MOVE TO ls_toolbar-text. MOVE TO ls_toolbar-disapbled. APPEND ls_toolbar TO i_object-mt_toolbar.ENDFORM.增加自定義按鈕的結(jié)構(gòu)如下:FieldDescriptionFUNCTION功能代碼BUTN_TYPE按鈕類型可用的按鈕類型:0 Button(normal)1 Menu and default button2 Menu3 分割符4 Radio button5 Checkbox6 Menu entryICON按鈕圖標(biāo)(可選)TEXT按鈕文本(可選)QUICKINFO按鈕的懸停文本(可選)DISABLED灰化在上面的代碼例子里,我們增加了一個常規(guī)的按鈕和一個含有菜單的按鈕.通過把按鈕的類型設(shè)置為1或者2,我們可以增加一個含有菜單的按鈕,在事件menu_button還可以實(shí)現(xiàn)子菜單:FORM handle_menu_button USING i_object TYPE REF TO cl_ctmenuI_ucomm TYPE syucomm.CASE i_ucomm.WHEN EXCH.CALL METHOD i_object-add_function EXPORTING Fcode = EU Text = Euro.CALL METHOD i_object-add_function EXPORTING Fcode = TRL Text = Turkish Lira.ENDCASE.ENDFORM.為了實(shí)現(xiàn)這些自定義的按鈕的功能,我們使用USER_COMMAND事件來處理.FORM handle_user_command USING i_ucomm TYPE syucomm.DATA lt_selected_rows TYPE lvc_t_rowid.DATA ls_selected_row TYPE lvc_s_roid.CALL METHOD gr_alvgrid-get_selected_rows IMPORTING Et_row_no = lt_selected_rows.READ TABLE lt_selected_rows INTO ls_selected_row INDEX 1.If sy-subrc ne 0. MESSAGE S000(su) WITH Select a row(203).ENDIF.CASE i_ucomm.WHEN CAR. READ TABLE gt_list INDEX ls_selected_row-row_id. IF sy-subrc = 0. CALL FUNCTION ZDISPLAY_CARRIER_INFO EXPORTING carrid = gt_list-carrid EXCEPTIONS carrier_not_found = 1 Oters = 2. ENDIF.WHEN EU. READ TABLE gt_list INDEX ls_selected_row-row_id. IF sy-subrc = 0. CALL FUNCTION ZPOPUP_CONV_CURR_ADD_DISPLAY EXPORTING monun = EU Quant = gt_list-paymentsum. ENDIF.ENDCASE.ENDFORM.我們通過方法get_selected_rows來獲取選擇的行.功能EXCH有2個子功能,所以我們不需要實(shí)現(xiàn)它.為了能顯示ALV附加的一些功能,可以在ALV實(shí)例創(chuàng)建的時候調(diào)用set_toolbar_interactive方法. CALL METHOD gr_alv_grid-set_toolbar_interactive.(二)在alv_lst中加入按鈕Add Button to ALV Toolbar with REUSE_ALV_LIST_DISPLAY How to add button to ALV toolbar using REUSE_ALV_LIST_DISPLAY? In the program which calls ALV using REUSE_ALV_LIST_DISPLAY, I have to add a new button. I saw the demo program BCALV_GRID_08, which is written using ABAP-Controls. In that example, the button is added using TOOLBAR event of cl_gui_alv_grid. Could you help me to implement the same logic using REUSE_ALV_LIST_DISPLAY parameters. you should copy the STANDARD GUI status from program SAPLKKBL using transaction SE90 -Programming SubObjects- Gui Status. Execute this transaction to get to next screen. select status using checkbox. click on GUI Status - Copy. Enter your Z program name and the name you what for this status - you can keep it as STANDARD to be simple. Then you can edit the new status to add or delete buttons. This will also bring in the standard SAP ALV functionality such as sorting/subtotaling etc. When you call REUSE_ALV_GRID_DISPLAY make sure you pass it the new status name. an example of one of mine: call function REUSE_ALV_GRID_DISPLAY EXPORTING i_callback_program = ZSDBOLST_REPORT i_callback_pf_status_set = STANDARD - i_callback_user_command = USER_COMMAND i_structure_name = I_BOLACT i_grid_title = BOL Action Report(031) is_layout = gs_layout it_fieldcat = gt_fieldcat i_save = A is_variant = v_variant TABLES t_outtab = i_bolact EXCEPTIONS program_error = 1 others = 2. I just tried the same procedure ,but my entire application toolbar disappeared and a lock icon appears next to the application toolbar in my copied pf-status. Could you advice what might have gone wrong ? As identified with the FMs help you can do the following. 1). Using SE80 (I think) you can copy a GUI status from one program to another. It mentions which one in the FMs help. 2). Create a form named like so: Code: * * Form Set_pf_status * Notes: Called by FM REUSE_ALV_GRID_DISPLAY * FORM set_pf_status USING rt_extab TYPE slis_t_extab. SET PF-STATUS ZSTANDARD. ENDFORM. Set_pf_status In the above case the GUI status copied was named ZSTANDARD and adjusted accordingly, adding and removing the desired buttons. A button was added called %DELETE. 3). Create the following report: Code: * * Form User_command * Notes: Called by FM REUSE_ALV_GRID_DISPLAY * Detects whether the icon/button for * Return Tag Deletion has been pressed. If it has then * detect whether any rows have been highlighted and then * set the delete flag. * FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield. DATA: li_count TYPE I. IF r_ucomm EQ %DELETE. LOOP AT %g00 WHERE mark EQ X. ADD 1 TO li_count. ENDLOOP. IF li_count GT 0. gc_delete_flag = X. r_ucomm = &F03. Back arraow ELSE. MESSAGE W000 WITH Please highlight the rows to be deleted!. ENDIF. ENDIF. ENDFORM. User_command As Ive added an extra button to indicate which records should be deleted I need to identify a form to be called to process when this button is chosen. Then when you call the ALV function you to specify the following extra details: Code: call function REUSE_ALV_GRID_DISPLAY exporting i_callback_program = gc_repid I_CALLBACK_PF_STATUS_SET = SET_PF_STATUS I_CALLBACK_USER_COMMAND = US
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 護(hù)士在名師講座中的學(xué)習(xí)心得體會
- 中國市場營銷部工作總結(jié)和計(jì)劃
- 部編版三年級語文上自主檢測評估計(jì)劃
- 教師師德師風(fēng)與教學(xué)改革心得體會
- 新部編版一年級語文上冊教學(xué)進(jìn)度計(jì)劃
- 電商培訓(xùn)課程教學(xué)質(zhì)量的心得體會
- 應(yīng)用型本科高校學(xué)生返校心理疏導(dǎo)計(jì)劃
- 以實(shí)驗(yàn)為翼:高中自然地理教學(xué)中地理能力的培養(yǎng)與提升
- 裝飾裝修質(zhì)量檢查通病及防治措施
- 以學(xué)習(xí)為中心:ESP教材任務(wù)設(shè)置的創(chuàng)新與實(shí)踐探究
- (完整文本版)新概念英語第一冊單詞表默寫版1-144
- 醫(yī)師入職測考試試題答案(臨床)
- 鋼結(jié)構(gòu)門頭專項(xiàng)施工方案
- SOP標(biāo)準(zhǔn)作業(yè)指導(dǎo)書excel模板
- 染色作業(yè)指導(dǎo)書
- 空間機(jī)器人地面遙操作的關(guān)鍵技術(shù)研究
- 人工智能倫理規(guī)則
- 工程物探-第五章電法勘探課件
- 婦產(chǎn)科護(hù)理學(xué)教材(課后思考題參考答案)
- 二年級數(shù)學(xué)無紙化監(jiān)測試題
- 全同態(tài)加密算法概述
評論
0/150
提交評論