VA01/VA02/VA03/VA05 销售订单隐藏价格
阅读原文时间:2023年08月24日阅读:14

1、业务需求

针对用户使用销售订单时,判断是否有权限,没有权限时隐藏销售订单抬头和行项目的价格相关字段

2、增强实现

隐藏抬头和行项目表格中的净值和净价字段

在程序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.
"--------------------@斌将军--------------------

效果如下

还需要隐藏抬头和行项目的条件页签中的价格数据

在程序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

Arabic

Hebrew

Polish

Bulgarian

Hindi

Portuguese

Catalan

Hmong Daw

Romanian

Chinese Simplified

Hungarian

Russian

Chinese Traditional

Indonesian

Slovak

Czech

Italian

Slovenian

Danish

Japanese

Spanish

Dutch

Klingon

Swedish

English

Korean

Thai

Estonian

Latvian

Turkish

Finnish

Lithuanian

Ukrainian

French

Malay

Urdu

German

Maltese

Vietnamese

Greek

Norwegian

Welsh

Haitian Creole

Persian

 

TRANSLATE with

COPY THE URL BELOW

Back

EMBED THE SNIPPET BELOW IN YOUR SITE

Enable collaborative features and customize widget: Bing Webmaster Portal

Back

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章