如何根据用户权限屏蔽或显示SAP的订单中的成本显示

程序目的说明:

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
 
 

转载于:https://www.cnblogs.com/duadu/archive/2006/08/15/6166950.html

你可能感兴趣的:(如何根据用户权限屏蔽或显示SAP的订单中的成本显示)