1、业务需求
针对用户使用销售订单时,判断是否有权限,没有权限时隐藏销售订单抬头和行项目的价格相关字段
2、增强实现
2.1、隐藏抬头和行项目价格
隐藏抬头和行项目表格中的净值和净价字段
在程序MV45AFZZ→USEREXIT_FIELD_MODIFICATION中写隐式增强
"--------------------@斌将军-------------------- FORM USEREXIT_FIELD_MODIFICATION. * CASE SCREEN-GROUP3. * WHEN '900'. * IF VBAK-VBTYP NE IF_SD_DOC_CATEGORY=>INQUIRY. * SCREEN-ACTIVE = 0. * ENDIF. * ENDCASE. * CASE SCREEN-NAME. * WHEN 'VBAK-VBELN'. * SCREEN-ACTIVE = 0. * ENDCASE. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) *$*$-Start: (1)---------------------------------------------------------------------------------$*$* ENHANCEMENT 1 ZSD_VA01_PRICE. "active version IF sy-tcode = 'VA01' OR sy-tcode = 'VA02' OR sy-tcode = 'VA03' OR sy-tcode = 'VA05'. IF ( screen-name = 'VBAK-NETWR' OR "抬头 净值 screen-name = 'VBAK-WAERK' OR "抬头 货币 * screen-name = 'RV45A-KOEIN' OR "项目 货币 screen-name = 'VBAP-NETPR' OR "项目 净价 screen-name = 'VBAP-NETWR' "OR "项目 净值 * screen-name = 'VBAP-WAERK' OR "项目 SD 凭证货币 ). AUTHORITY-CHECK OBJECT 'ZCONDMANT' ID 'ZCHECK' FIELD 'M'. IF sy-subrc <> 0."没有权限 screen-active = 0. MODIFY SCREEN. ENDIF. ENDIF. ENDIF. ENDENHANCEMENT. *$*$-End: (1)---------------------------------------------------------------------------------$*$* ENDFORM. "--------------------@斌将军--------------------
效果如下
2.2、隐藏条件页签价格
还需要隐藏抬头和行项目的条件页签中的价格数据
在程序LV69AF01→TCTRL_KONDITIONEN_INIT中写隐式增强。
此处的隐式增强必须写在FORM的末尾隐式增强点处,不能写在FORM开头的隐式增强点处。
因为抬头和行项目的条件页签都是调用了这段相同的代码,在第一次进入会对tctrl_konditionen进行重置,导致增强代码不起作用,所以要将增强代码写在FORM末尾
参考代码
"--------------------@斌将军-------------------- FORM tctrl_konditionen_init. DATA: da_tfill LIKE sy-tabix. * Refresh table control if screen number has changed STATICS: last_dynnr TYPE dynnr. IF sy-dynnr NE last_dynnr AND gf_called_by_lord IS INITIAL. last_dynnr = sy-dynnr. REFRESH CONTROL 'tctrl_konditionen' FROM SCREEN sy-dynnr. ENDIF. DESCRIBE TABLE xkomv LINES da_tfill. ...... """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) *$*$-Start: (1)---------------------------------------------------------------------------------$*$* ENHANCEMENT 1 ZSD_VA01_ITEM_PRICE. "active version IF sy-tcode = 'VA01' OR sy-tcode = 'VA02' OR sy-tcode = 'VA03' OR sy-tcode = 'VA05'. AUTHORITY-CHECK OBJECT 'ZCONDMANT' ID 'ZCHECK' FIELD 'M'. IF sy-subrc <> 0."没有权限 "隐藏净值、税收字段 LOOP AT SCREEN. IF screen-name = 'KOMP-NETWR' OR screen-name = 'KOMP-MWSBP'. screen-active = 0. MODIFY SCREEN. ENDIF. ENDLOOP. "隐藏表格中金额、定价值字段 LOOP AT tctrl_konditionen-cols INTO DATA(lv_acol). IF lv_acol-screen-name EQ 'KOMV-KBETR' OR lv_acol-screen-name EQ 'KOMV-KWERT'. lv_acol-invisible = 1. MODIFY tctrl_konditionen-cols FROM lv_acol INDEX sy-tabix. ENDIF. ENDLOOP. ENDIF. ENDIF. ENDENHANCEMENT. *$*$-End: (1)---------------------------------------------------------------------------------$*$* ENDFORM. "tctrl_konditionen_init "--------------------@斌将军--------------------
效果如下
抬头条件页签
行项目条件页签
TRANSLATE with x English TRANSLATE with COPY THE URL BELOW Back EMBED THE SNIPPET BELOW IN YOUR SITE Enable collaborative features and customize widget: Bing Webmaster Portal Back 标签:sy,name,screen,SCREEN,tcode,ENDIF,VA05,VA03,VA02 From: https://www.cnblogs.com/BinGeneral/p/17652505.html