首页 > 其他分享 >VA01/VA02/VA03/VA05 销售订单隐藏价格

VA01/VA02/VA03/VA05 销售订单隐藏价格

时间:2023-08-23 18:45:50浏览次数:43  
标签:sy name screen SCREEN tcode ENDIF VA05 VA03 VA02

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
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

标签:sy,name,screen,SCREEN,tcode,ENDIF,VA05,VA03,VA02
From: https://www.cnblogs.com/BinGeneral/p/17652505.html

相关文章

  • JAVA02
    基本运算符算数运算符:+-*/%++--赋值运算符:=关系运算符:><>=<===!=(instanceof)逻辑运算符:&&||!位运算符:&|^~>><<>>>条件运算符:?:扩......
  • ABAP:VA02销售订单保存前增强
    VA02销售订单保存前增强:SE38:MV45AFZZENHANCEMENT2ZCD_SO_SAVE_CHECK."activeversion*****ADDBYZJ20221026START检查非源头订单禁止修改DATA:ls_zs......
  • ABAP:VA02销售订单修改BAPI
    VA02销售订单修改BAPIFUNCTIONzsdfu016.*"----------------------------------------------------------------------*"*"本地接口:*"IMPORTING*"VALUE(I_ID)......
  • Java03 标注语句
    标注语句就是有名称的语句。命名方法是,在语句前加上一个标识符和一个冒号。break和continue语句会用到标注。例如:rowLoop:for(intr=0;r<rows.length;r++){......
  • Java02 前递增(减)和后递增(减)运算的区别
    ++运算符把它的单个操作数增加1,这个操作数必须是变量、数组中的元素或对象的字段。这个运算符的行为取决于它相对于操作数的位置。放在操作数之前,是前递增运算符,递增操作......