Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
Qi_Liu
Product and Topic Expert
Product and Topic Expert
需求描述: S/4HANA CLOUD public edition 在创建和修改采购订单时,能否做到净价字段只读,不可修改。或者隐藏掉净价字段。

(在ECC时代是可以通过界面配置实现字段的必输与否,但是在ERP CLOUD, public edition上目前只能通过BADI实现)

解决方案:

涉及到如下两个应用:

1.管理采购订单

2. 创建采购订单-高级

针对这两个应用有增强点可实现字段不可修改或隐藏。

增强点:

change of field control for purchase order items

技术名称:MM_PUR_S4_PO_FLDCNTRL_SIMPLE



以下截屏展示隐藏字段前后对比。

增强前:





增强后:





如果想要实现只读,不允许修改,可参考如下代码模板:

DATA ls_mmpur_s_po_fldsel TYPE mmpur_s_po_fldsel.

IF purchaseorder-purchaseordertype EQ 'ZXX' OR

purchaseorder-purchaseordertype EQ 'ZXX'.

LOOP AT fieldselection_table

INTO ls_mmpur_s_po_fldsel

WHERE field = 'NETPRICEAMOUNT'.

ls_mmpur_s_po_fldsel-fieldstatus = '*'.

MODIFY fieldselection_table FROM ls_mmpur_s_po_fldsel.

ENDLOOP.

ENDIF.

另外需要说明的一点,可选的字段中并没有包含总价字段,所以如果想要隐藏价格字段,只能把净价字段隐藏掉,但是总价字段无法隐藏。并且实际业务中也不应该隐藏总价,这是采购员参考的重要信息。



English version:

Requirement: Hide net price field or display only in purchase order.

Two APPs involved:

Manage Purchase Orders

Create Purchase Order - Advanced

Solution:

You can leverage the following BADl:

change of field control for purchase order items

Technical Name : MM_PUR_S4_PO_FLDCNTRL_SIMPLE



sample code to set field net price to display only

DATA ls_mmpur_s_po_fldsel TYPE mmpur_s_po_fldsel.

IF purchaseorder-purchaseordertype EQ 'ZXX' OR

purchaseorder-purchaseordertype EQ 'ZXX'.

LOOP AT fieldselection_table

INTO ls_mmpur_s_po_fldsel

WHERE field = 'NETPRICEAMOUNT'.

ls_mmpur_s_po_fldsel-fieldstatus = '*'.

MODIFY fieldselection_table FROM ls_mmpur_s_po_fldsel.

ENDLOOP.

ENDIF.

You can either change the value according to the following value range.

Hidden (-): the field is not displayed, so it cannot be edited.

Displayed (*): the field is displayed and an entry cannot be made.

Mandatory (+): the field is displayed and an entry must be made.

Optional (.): the field is displayed and an entry can be made.

Standard Settings

Additionally, if you want to hide price, only net price can be hide, total value is still displaying. Besides it is not making sense to hide the total price in PO. Purchaser need at least the total price for reference.



 

*****Update on 2023.07.10*****

According to KBA 3268822 - Field Control in Purchase Orders and Purchase Requistions in S/4HANA Cloud - SAP for Me

某些字段是无法实现的,目前测试明确的例如 税码 字段,是无法限制住的。

8 Comments