Chinaunix首页 | 论坛 | 博客
  • 博客访问: 685069
  • 博文数量: 194
  • 博客积分: 7067
  • 博客等级: 少将
  • 技术积分: 2008
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-09 14:48
个人简介

我很好

文章分类

全部博文(194)

文章存档

2019年(1)

2018年(1)

2017年(3)

2015年(2)

2012年(2)

2011年(1)

2010年(27)

2009年(15)

2008年(142)

分类: WINDOWS

2008-05-06 09:45:51

研究一下:此增强加老师有在程序中实现(附后)

程序目的说明:

1、   SAP标准程序不能在销售订单(va01 va02  va03)中根据权限显示或不显示有些订单定价过程的敏感数据。
2、   由于公司需要对销售订单定价过程的敏感数据(如成本数据)进行控制,因此需要增强系统功能,使系统能根据用户权限和定价敏感数据的设置来决定显示或不显示定价过程中的订单定价过程的敏感数据。
3、   修改了LV69AFZZ的userexit_field_modific_leer
userexit_field_modific_kzwi
userexit_field_modific_kopf
userexit_field_modification
四个用户出口。

程序代码: 

源程序:红色为新增代码
*----------------------------------------------------------------------*
***INCLUDE LV69AFZZ .
*----------------------------------------------------------------------*
*{   INSERT         DEVK901084                                        1
data: OLD_KOMV like komv.
data: OLD_KOMk like komk.
data: z_auth_subrc like sy-subrc.
DATA : i_zauthprice TYPE STANDARD TABLE OF zauthprice
   WITH HEADER LINE.
data: Z_S(60) type c,
      z_s1(10) type c.
*}   INSERT
*&---------------------------------------------------------------------*
*&      Form USEREXIT_FIELD_MODIFIC_LEER
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
* --> p1        text
* <-- p2       text
*----------------------------------------------------------------------*
form userexit_field_modific_leer.
*{   INSERT         DEVK901084                                        1
 z_auth_subrc = 4.
 IF screen-name = 'FCODE'.
    CLEAR old_komk.
 ENDIF.
 AUTHORITY-CHECK OBJECT 'K_ZKALSM'
               ID 'KALSM' FIELD komk-kalsm
               ID 'ACTVT' DUMMY.
 z_auth_subrc = sy-subrc.
 if sy-TCODE ='VA03'.
    z_auth_subrc = 4.
 endif.
 old_komk = komk.
 old_komv = komv.
 REFRESH i_zauthprice.
 CLEAR i_zauthprice.
 SELECT * FROM zauthprice
    INTO CORRESPONDING FIELDS OF TABLE i_zauthprice
   WHERE zauthprice~kalsm = komk-kalsm.
 
 IF z_auth_subrc NE 0.
    READ TABLE i_zauthprice WITH KEY stunr = komv-stunr BINARY SEARCH.
    IF sy-subrc = 0.
      IF ( screen-name = 'RV61A-SELKZ'
        OR   screen-name = 'KOMV-KAWRT'
            OR   screen-name = 'RV61A-AWEIN'
            OR   screen-name = 'KOMV-KBETR'
            OR   screen-name = 'RV61A-KOEIN'
            OR   screen-name = 'KOMV-KPEIN'
            OR   screen-name = 'KOMV-KMEIN'
            OR   screen-name = 'KOMV-KWERT' ).
        screen-active = 0.
      ENDIF.
    ENDIF.
 ENDIF.
 move z_auth_subrc to Z_S1.
 CONCATENATE 'userexit_field_modific_leer Control:' z_s1 into Z_S.
 MESSAGE Z_S TYPE 'W'.
 MODIFY SCREEN.
*}   INSERT
 
endform.                               " USEREXIT_FIELD_MODIFIC_LEER
*&---------------------------------------------------------------------*
*&      Form USEREXIT_FIELD_MODIFIC_KZWI
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
* --> p1        text
* <-- p2        text
*----------------------------------------------------------------------*
form userexit_field_modific_kzwi.
*{   INSERT         DEVK901084                                        1
 z_auth_subrc = 4.
 IF screen-name = 'FCODE'.
    CLEAR old_komk.
 ENDIF.
 AUTHORITY-CHECK OBJECT 'K_ZKALSM'
               ID 'KALSM' FIELD komk-kalsm
               ID 'ACTVT' DUMMY.
 z_auth_subrc = sy-subrc.
 if sy-TCODE ='VA03'.
    z_auth_subrc = 4.
 endif.
 old_komk = komk.
 old_komv = komv.
 REFRESH i_zauthprice.
 CLEAR i_zauthprice.
 SELECT * FROM zauthprice
    INTO CORRESPONDING FIELDS OF TABLE i_zauthprice
   WHERE zauthprice~kalsm = komk-kalsm.
 
 IF z_auth_subrc NE 0.
    READ TABLE i_zauthprice WITH KEY stunr = komv-stunr BINARY SEARCH.
    IF sy-subrc = 0.
      IF ( screen-name = 'RV61A-SELKZ'
        OR   screen-name = 'KOMV-KAWRT'
            OR   screen-name = 'RV61A-AWEIN'
            OR   screen-name = 'KOMV-KBETR'
            OR   screen-name = 'RV61A-KOEIN'
            OR   screen-name = 'KOMV-KPEIN'
            OR   screen-name = 'KOMV-KMEIN'
            OR   screen-name = 'KOMV-KWERT' ).
        screen-active = 0.
      ENDIF.
    ENDIF.
 ENDIF.
 move z_auth_subrc to Z_S1.
 CONCATENATE 'userexit_field_modific_kzwi Control:' z_s1 into Z_S.
 MESSAGE Z_S TYPE 'W'.
 MODIFY SCREEN.
*}   INSERT
 
endform.                               " USEREXIT_FIELD_MODIFIC_KZWI
*&---------------------------------------------------------------------*
*&      Form USEREXIT_FIELD_MODIFIC_KOPF
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
* --> p1        text
* <-- p2        text
*----------------------------------------------------------------------*
form userexit_field_modific_kopf.
*{   INSERT         DEVK901084                                        1
 z_auth_subrc = 4.
 IF screen-name = 'FCODE'.
    CLEAR old_komk.
 ENDIF.
 AUTHORITY-CHECK OBJECT 'K_ZKALSM'
               ID 'KALSM' FIELD komk-kalsm
               ID 'ACTVT' DUMMY.
 z_auth_subrc = sy-subrc.
 if sy-TCODE ='VA03'.
    z_auth_subrc = 4.
 endif.
 old_komk = komk.
 old_komv = komv.
 REFRESH i_zauthprice.
 CLEAR i_zauthprice.
 SELECT * FROM zauthprice
    INTO CORRESPONDING FIELDS OF TABLE i_zauthprice
   WHERE zauthprice~kalsm = komk-kalsm.
 
 IF z_auth_subrc NE 0.
    READ TABLE i_zauthprice WITH KEY stunr = komv-stunr BINARY SEARCH.
    IF sy-subrc = 0.
      IF ( screen-name = 'RV61A-SELKZ'
        OR   screen-name = 'KOMV-KAWRT'
            OR   screen-name = 'RV61A-AWEIN'
            OR   screen-name = 'KOMV-KBETR'
            OR   screen-name = 'RV61A-KOEIN'
            OR   screen-name = 'KOMV-KPEIN'
            OR   screen-name = 'KOMV-KMEIN'
            OR   screen-name = 'KOMV-KWERT' ).
        screen-active = 0.
      ENDIF.
    ENDIF.
 ENDIF.
 move z_auth_subrc to Z_S1.
 CONCATENATE 'userexit_field_modific_kopf Control:' z_s1 into Z_S.
 MESSAGE Z_S TYPE 'W'.
 MODIFY SCREEN.
*}   INSERT
 
endform.                               " USEREXIT_FIELD_MODIFIC_KOPF
*&---------------------------------------------------------------------*
*&      Form USEREXIT_FIELD_MODIFICATION
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
* --> p1        text
* <-- p2        text
*----------------------------------------------------------------------*
form userexit_field_modification.
 
*{   INSERT         DEVK901084                                        1
 z_auth_subrc = 4.
 IF screen-name = 'FCODE'.
    CLEAR old_komk.
 ENDIF.
 AUTHORITY-CHECK OBJECT 'K_ZKALSM'
               ID 'KALSM' FIELD komk-kalsm
               ID 'ACTVT' DUMMY.
 z_auth_subrc = sy-subrc.
 if sy-TCODE ='VA03'.
    z_auth_subrc = 4.
 endif.
 old_komk = komk.
 old_komv = komv.
 REFRESH i_zauthprice.
 CLEAR i_zauthprice.
 SELECT * FROM zauthprice
    INTO CORRESPONDING FIELDS OF TABLE i_zauthprice
   WHERE zauthprice~kalsm = komk-kalsm.
 
 IF z_auth_subrc NE 0.
    READ TABLE i_zauthprice WITH KEY stunr = komv-stunr BINARY SEARCH.
    IF sy-subrc = 0.
      IF ( screen-name = 'RV61A-SELKZ'
        OR   screen-name = 'KOMV-KAWRT'
            OR   screen-name = 'RV61A-AWEIN'
            OR   screen-name = 'KOMV-KBETR'
            OR   screen-name = 'RV61A-KOEIN'
            OR   screen-name = 'KOMV-KPEIN'
            OR   screen-name = 'KOMV-KMEIN'
            OR   screen-name = 'KOMV-KWERT' ).
        screen-active = 0.
      ENDIF.
    ENDIF.
 ENDIF.
 move z_auth_subrc to Z_S1.
 CONCATENATE 'userexit_field_modification Control:' z_s1 into Z_S.
 MESSAGE Z_S TYPE 'W'.
 MODIFY SCREEN.
*}   INSERT
endform.                               " USEREXIT_FIELD_MODIFICATION
*&---------------------------------------------------------------------*
*&      Form USEREXIT_PRICING_CHECK
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
* --> p1        text
* <-- p2        text
*----------------------------------------------------------------------*
form userexit_pricing_check.
*{   INSERT         DEVK901084                                        1
include zsde0002.
*}   INSERT
 
endform.                               " USEREXIT_PRICING_CHECK
*&---------------------------------------------------------------------*
*&      Form USEREXIT_CHANGE_PRICING_RULE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_RV61A_KSTEU text
*----------------------------------------------------------------------*
form userexit_change_pricing_rule using    p_rv61a_ksteu.
 
endform.                               " USEREXIT_CHANGE_PRICING_RULE
 
 
下面程序为加老师实现
  *----------------------------------------------------------------------*
***INCLUDE LV69AFZZ .
*----------------------------------------------------------------------*
*{   INSERT         DEVK900696                                        1
* Wilson Jia 2007-12-01
DATA: OLD_KOMV LIKE KOMV,
      OLD_KOMK LIKE KOMK.
DATA: AUTH_SUBRC LIKE SY-SUBRC.

*}   INSERT
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_FIELD_MODIFIC_LEER
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form userexit_field_modific_leer.
*{   INSERT         DEVK900696                                        1
* Wilson Jia 2007-12-01
  INCLUDE ZZAUTH01.

*}   INSERT

endform.                               " USEREXIT_FIELD_MODIFIC_LEER
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_FIELD_MODIFIC_KZWI
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form userexit_field_modific_kzwi.
*{   INSERT         DEVK900696                                        1
* Wilson Jia 2007-12-01
  INCLUDE ZZAUTH01.
*}   INSERT

endform.                               " USEREXIT_FIELD_MODIFIC_KZWI
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_FIELD_MODIFIC_KOPF
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form userexit_field_modific_kopf.
*{   INSERT         DEVK900696                                        1
* Wilson Jia 2007-12-01
  INCLUDE ZZAUTH01.

*}   INSERT

endform.                               " USEREXIT_FIELD_MODIFIC_KOPF
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_FIELD_MODIFICATION
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form userexit_field_modification.
*{   INSERT         DEVK900696                                        1
* Wilson Jia 2007-12-01
  INCLUDE ZZAUTH01.

*}   INSERT

endform.                               " USEREXIT_FIELD_MODIFICATION
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_PRICING_CHECK
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form userexit_pricing_check.
*{   INSERT         DEVK900696                                        1
* Wilson Jia 2007-12-01
  INCLUDE ZZAUTH02.

*}   INSERT

endform.                               " USEREXIT_PRICING_CHECK
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_CHANGE_PRICING_RULE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_RV61A_KSTEU  text
*----------------------------------------------------------------------*
form userexit_change_pricing_rule using    p_rv61a_ksteu.

endform.                               " USEREXIT_CHANGE_PRICING_RULE

------------------------------------------------------------------------------------------------------------------------------

  *&---------------------------------------------------------------------*
*&  Include           ZZAUTH01
*&---------------------------------------------------------------------*
* Beim ersten Aufruf ist KOMV initial; OLD_KOMK löschen,
* damit auf jeden Fall Berechtigungsprüfung durchgeführt wird.
* Sicherheitshalber zunächst Berechtigung verweigern.

* if komv is initial.
  IF SCREEN-NAME = 'FCODE'.
    CLEAR OLD_KOMK.
    AUTH_SUBRC = 4.
  ENDIF.

* Berechtigungsprüfung auf Kalkulationsschema und Stufen-Nr.
* Beim Wechsel der KOMV-Zeile einmalig eine Berechtigungsprüfung
* durchführen
  IF KOMK-KALSM NE OLD_KOMK-KALSM OR KOMV-STUNR NE OLD_KOMV-STUNR.
    AUTHORITY-CHECK OBJECT 'Z_KONH_KLS'
               ID 'ZKALSM' FIELD KOMK-KALSM
               ID 'ZSTUNR' FIELD KOMV-STUNR
               ID 'ACTVT' DUMMY.
    AUTH_SUBRC = SY-SUBRC.
    OLD_KOMK = KOMK.
    OLD_KOMV = KOMV.
  ENDIF.

  IF AUTH_SUBRC NE 0 AND ( SCREEN-NAME = 'RV61A-SELKZ'
                      OR   SCREEN-NAME = 'KOMV-KAWRT'"条件基值
                      OR   SCREEN-NAME = 'RV61A-AWEIN'
                      OR   SCREEN-NAME = 'KOMV-KBETR' "VK11中金额
                      OR   SCREEN-NAME = 'RV61A-KOEIN'"VK11-货币
                      OR   SCREEN-NAME = 'KOMV-KPEIN'"VK11-单位
                      OR   SCREEN-NAME = 'KOMV-KMEIN'"VK11-UoM
                      OR   SCREEN-NAME = 'KOMV-KWERT' )."定价值
    SCREEN-ACTIVE = 0.
  ENDIF.
  MODIFY SCREEN.
* Ende Berechtigungsprüfung

----------------------------------------------------------------------------------------------------------------------------

  *&---------------------------------------------------------------------*
*&  Include           ZZAUTH02
*&---------------------------------------------------------------------*
***INCLUDE ZZAUTH02.
    AUTHORITY-CHECK OBJECT 'Z_KONH_KLS'
               ID 'ZKALSM' FIELD KOMK-KALSM
               ID 'ZSTUNR' FIELD KOMV-STUNR
               ID 'ACTVT' DUMMY.
    IF SY-SUBRC NE 0.
      MESSAGE E609(VH).
    ENDIF.
* Ende Berechtigungsprüfung

 

 


阅读(2972) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~