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

如何增强实现隐藏采购申请评估价格,或改成非必输

业务需求:基于行业特殊性,希望能够隐藏采购申请中的评估价格。或者将评估价格变成非必输。

需求前提:对于一般的采购申请,不建议隐藏评估价格字段。因为此字段为必输字段,一旦带入空值,则没办法修改,进而无法成功保存采购申请。

对于有物料的采购申请,评估价格会从物料主数据中带出。

对于自由文本采购申请,由于没有主数据,则无法带出价格信息,进而无法保存,因此凡是有自由文本类型的采购,不建议隐藏。

解决方案:可以通过BAdI增强实现评估价格和总价的隐藏。

起作用的两个应用程序如下:

创建采购申请-高级

管理采购申请-专业

增强业务加载项:更改采购申请的字段控制

 

代码样例:

DATA ls_mmpur_s_po_fldsel TYPE mmpur_s_po_fldsel.

LOOP AT fieldselection_table

INTO ls_mmpur_s_po_fldsel

WHERE field = ‘PURCHASEREQUISITIONPRICE’.

ls_mmpur_s_po_fldsel-fieldstatus = ‘-‘.

MODIFY fieldselection_table FROM ls_mmpur_s_po_fldsel.

ENDLOOP.

增强前:

增强后:

可以看到总价也随着评估价格自动被隐藏了。

若想改成非必输,可以应用如下代码:

FIELD-SYMBOLS <fs> TYPE mmpur_s_pr_fldsel.

READ TABLE fieldselection_table ASSIGNING <fs> WITH KEY field = ‘PURCHASEREQUISITIONPRICE’.
IF sy-subrc EQ 0.
<fs>-fieldstatus = ‘.’.
ENDIF

 

 

 

 

 

English version:

Requirement: Hide purchase requisition valuation price

Suggestion: This field is not suggested to be hide as this field is mandatory. The price usually comes from material master data. In case of free text procurement, this field need manual input.

Resolution:

Enhancement via BAdI: Change of field control for purchase requisitions

The following APPs are affected:

Create Purchase Requisitions

Manage Purchase Requisitions – Professional

Sample code:

DATA ls_mmpur_s_po_fldsel TYPE mmpur_s_po_fldsel.

LOOP AT fieldselection_table

INTO ls_mmpur_s_po_fldsel

WHERE field = ‘PURCHASEREQUISITIONPRICE’.

ls_mmpur_s_po_fldsel-fieldstatus = ‘-‘.

MODIFY fieldselection_table FROM ls_mmpur_s_po_fldsel.

ENDLOOP.

Before and after please see above screenshot. You will find total amount is also hidden.

You can also make the price field as optional by the following coding:

FIELD-SYMBOLS <fs> TYPE mmpur_s_pr_fldsel.

READ TABLE fieldselection_table ASSIGNING <fs> WITH KEY field = ‘PURCHASEREQUISITIONPRICE’.
IF sy-subrc EQ 0.
<fs>-fieldstatus = ‘.’.
ENDIF

Assigned tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.