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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何根据用户权限屏蔽或显示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
参考技术A http://blog.csdn.net/sap_jack/article/details/1066287

以上是关于如何根据用户权限屏蔽或显示SAP的订单中的成本显示的主要内容,如果未能解决你的问题,请参考以下文章

sap alv显示问题

SAP系统中如何根据一个订单号,查询所有在这订单中所消耗的物料

SAP系统中订单下成本中心错误

sap生产订单结算,实际成本差异结转哪里来的?在线等急

SAP中采购订单,如何删除?

SAP 如何查询生产订单的一些信息,如产成品名称,标准成本之类的,就像是查PURCHASE ORDE 的ME23N那样。