sap Status状态栏设计
生活随笔
收集整理的這篇文章主要介紹了
sap Status状态栏设计
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
(1). 用TCODE:se41,se80,se90(Programming Library-->Programming SubObjects--> Gui Status.)等都可以,拷貝一個標準的GUI status( 拷貝程序SAPLKKBL中的'STANDARD' GUI status)到你的程序.
然后寫PBO寫代碼:
DATA: I_QMEL LIKE MAKT OCCURS 0.
DATA V_REPID TYPE REPID.
SELECT * FROM MAKT INTO TABLE I_QMEL.
V_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_STRUCTURE_NAME = 'MAKT'
TABLES
T_OUTTAB = I_QMEL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
然后可以通過修改gui_status刪除按扭或著增加按扭
在 'REUSE_ALV_GRID_DISPLAY' 中有
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
。這里的I_CALLBACK_PF_STATUS_SET 是否是類似語句:SET PF_STATUS ‘STATUS1’ ?
如果是的話,那么自己創建一個用戶STATUS1,不就可以替代那個標準的狀態欄了嗎?
(2).通過代碼寫,要自己建類和方法.可以通過示例代碼學習.BCALV_GRID_08.
然后要在pbo里調用下再激活下gui_status就可以了.
*&-------------------------------------------------------------------
*& Form set_pf_status
*&-------------------------------------------------------------------
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ALV_PF_STATUS'.
ENDFORM. "Set_pf_status
此FORM的作用是在標準的ALV工具欄上添加自定義的按鈕
該名稱必須和FUNCTION 參數I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'對應起來,即FORM的名稱和變量名稱要一樣.
GUI STATUS 'ALV_PF_STATUS'是自己定義的,因為自定義后會把標準的ALV工具欄覆蓋,所以還要把標準工具欄復制過來.
方法如下:
T-CODE :SE90 Program Library-- GUI Status
program name:SAPLKKBL GUI Status:STANDARD_FULLSCREEN 標準的ALV工具欄名稱,F8運行,選擇菜單欄GUI Status---COPY,最后輸入你的程序名以及你自定義的GUI Status名,此例即為ALV_PF_STATUS,再添加按鈕.
范例:
*&-------------------------------------------------------------------
*& Form ALV_USER_COMMAND
*&-------------------------------------------------------------------
* -->R_UCOMM text
* -->RS_SELFIELD text
*----------------------------------------------------------------------*
form ALV_USER_COMMAND using r_ucomm like sy-ucomm
rs_selfield type slis_selfield. "響應ALV點擊自定義按鈕之后的事件
case r_ucomm.
when 'EXIT2'. "在set pf-status '9100'.的屏幕狀態里面自定義的按鈕名稱
LEAVE TO SCREEN 0.
WHEN '&DATA_SAVE'. "修改屏幕字段物料描述MAKTX,此時的&DATA_SAVE是標準GUI的參數,I_CALLBACK_PF_STATUS_SET 不要進行設置
LOOP AT IT_MATNR.
READ TABLE IT_MATNR_OLD ASSIGNING <MATNR>?
WITH KEY MATNR = IT_MATNR-MATNR.
CHECK IT_MATNR-MAKTX <> <matnr>-MAKTX.
UPDATE MAKT SET MAKTX = IT_MATNR-MAKTX WHERE MATNR = IT_MATNR-MATNR
AND SPRAS = 'M'.
ENDLOOP.
WHEN '&IC1'."表示雙擊
CHECK rs_selfield-tabindex > 0.
READ TABLE IT_MATNR INDEX rs_selfield-tabindex.
SET PARAMETER ID : 'MAT' FIELD IT_MATNR-MATNR.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
endcase.
rs_selfield-fieldname表示雙擊的字段名,有時候有用.
endform. "ALV_USER_COMMAND
然后寫PBO寫代碼:
DATA: I_QMEL LIKE MAKT OCCURS 0.
DATA V_REPID TYPE REPID.
SELECT * FROM MAKT INTO TABLE I_QMEL.
V_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_STRUCTURE_NAME = 'MAKT'
TABLES
T_OUTTAB = I_QMEL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
然后可以通過修改gui_status刪除按扭或著增加按扭
在 'REUSE_ALV_GRID_DISPLAY' 中有
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
。這里的I_CALLBACK_PF_STATUS_SET 是否是類似語句:SET PF_STATUS ‘STATUS1’ ?
如果是的話,那么自己創建一個用戶STATUS1,不就可以替代那個標準的狀態欄了嗎?
(2).通過代碼寫,要自己建類和方法.可以通過示例代碼學習.BCALV_GRID_08.
然后要在pbo里調用下再激活下gui_status就可以了.
*&-------------------------------------------------------------------
*& Form set_pf_status
*&-------------------------------------------------------------------
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ALV_PF_STATUS'.
ENDFORM. "Set_pf_status
此FORM的作用是在標準的ALV工具欄上添加自定義的按鈕
該名稱必須和FUNCTION 參數I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'對應起來,即FORM的名稱和變量名稱要一樣.
GUI STATUS 'ALV_PF_STATUS'是自己定義的,因為自定義后會把標準的ALV工具欄覆蓋,所以還要把標準工具欄復制過來.
方法如下:
T-CODE :SE90 Program Library-- GUI Status
program name:SAPLKKBL GUI Status:STANDARD_FULLSCREEN 標準的ALV工具欄名稱,F8運行,選擇菜單欄GUI Status---COPY,最后輸入你的程序名以及你自定義的GUI Status名,此例即為ALV_PF_STATUS,再添加按鈕.
范例:
*&-------------------------------------------------------------------
*& Form ALV_USER_COMMAND
*&-------------------------------------------------------------------
* -->R_UCOMM text
* -->RS_SELFIELD text
*----------------------------------------------------------------------*
form ALV_USER_COMMAND using r_ucomm like sy-ucomm
rs_selfield type slis_selfield. "響應ALV點擊自定義按鈕之后的事件
case r_ucomm.
when 'EXIT2'. "在set pf-status '9100'.的屏幕狀態里面自定義的按鈕名稱
LEAVE TO SCREEN 0.
WHEN '&DATA_SAVE'. "修改屏幕字段物料描述MAKTX,此時的&DATA_SAVE是標準GUI的參數,I_CALLBACK_PF_STATUS_SET 不要進行設置
LOOP AT IT_MATNR.
READ TABLE IT_MATNR_OLD ASSIGNING <MATNR>?
WITH KEY MATNR = IT_MATNR-MATNR.
CHECK IT_MATNR-MAKTX <> <matnr>-MAKTX.
UPDATE MAKT SET MAKTX = IT_MATNR-MAKTX WHERE MATNR = IT_MATNR-MATNR
AND SPRAS = 'M'.
ENDLOOP.
WHEN '&IC1'."表示雙擊
CHECK rs_selfield-tabindex > 0.
READ TABLE IT_MATNR INDEX rs_selfield-tabindex.
SET PARAMETER ID : 'MAT' FIELD IT_MATNR-MATNR.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
endcase.
rs_selfield-fieldname表示雙擊的字段名,有時候有用.
endform. "ALV_USER_COMMAND
總結
以上是生活随笔為你收集整理的sap Status状态栏设计的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: VL09增强-冲销
- 下一篇: SAP物料主数据采购视图采购价值代码设置