Skip to Content
Product Information
Author's profile photo Qi Liu

如何配置采购订单行项目净价字段为只读或隐藏

需求描述: 在创建和修改采购订单时,能否做到净价字段只读,不可修改。或者隐藏掉净价字段。

解决方案:

涉及到如下两个应用:

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.

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Huarong Shi
      Huarong Shi

      Dear Qi Liu,

      该博客中代码在我司Q系统进行测试后,其内容有报错,烦请帮助检查 @Qi

      Author's profile photo Qi Liu
      Qi Liu
      Blog Post Author

      Huarong你好,通过图片猜测你用的业务加载项为 “修改采购订单项目” ,应该用的业务加载项是“更改采购订单项目的字段控制”。

      Author's profile photo Huarong Shi
      Huarong Shi

      Dear Qi Liu,

      根据你的提示,该问题已解决,但是想问一下当一个物料有多个采购信息记录的时候并且都有效,那么采购订单取值哪一个。当采购订单净价无法更改的情况下。

      Author's profile photo Qi Liu
      Qi Liu
      Blog Post Author

      简单测试了一下,采购信息记录的条件都一样,时间范围也一样的话,是不允许创建新的信息记录的。