Symptom
- There is no SSCUI entry to change the Field Properties on Purchase Orders or Purchase Requisitions.
- The user wants to mark the fields as hidden, optional, or mandatory.
- There is no configuration entry with this purpose, this functionality is delivered through BAdIs to give more flexibility on the Logic for Field control.
Environment
SAP S/4HANA Cloud Public Edition
Resolution
The user must use the below BADIs, please go to the App Custom logic to find more details and an example*
Note:
The BAdI Change of Field Control for Purchase Order Items (MM_PUR_S4_PO_FLDCNTRL_SIMPLE) allows the user to influence the field control of the above-mentioned fields. It does not perform any checks that may be required after the change of the status properties.
For example, if user's BAdI implementation defines the status of a field as 'Mandatory' that SAP has defined as 'Optional', the system does not perform a check and does not output an error message.
The user can implement the BAdI Check of Purchase Order Before Saving (BD_MMPUR_FINAL_CHECK_PO) to perform their own checks and to output the corresponding error messages.
Purchase Order | Change of Field Control for Purchase Order Header (MM_PUR_S4_PO_FLDCNTRL_SIMPLE_H) | Change the field control in purchase order apps by modifying the properties of specific fields. These fields can be made hidden, read-only, mandatory, or optional on header level. | |
Purchase Order | Change of Field Control for Purchase Order Item (MM_PUR_S4_PO_FLDCNTRL_SIMPLE) | Change the field control in purchase order apps by modifying the properties of specific fields. These fields can be made hidden, read-only, mandatory, or optional on item level. | |
Purchase Order | Final Check Before Saving Purchase Order
(BD_MMPUR_FINAL_CHECK_PO) | Implement own checks before a purchase order is saved. | |
Purchase Requisition | Change of Field Control for Purchase Requisitions (MM_PUR_S4_PR_FLDCNTRL_SIMPLE) | Modify the properties of different fields that appear on the user interface of purchase requisition apps. |
* Example taken from Custom Logic:
To change the field control properties, assign one of the following values to FIELDSTATUS:
- '-': To hide the field
- '*': To make the field read-only
- '+': To make the field mandatory
- '.': To make the field optional
Example Implementation:
FIELD-SYMBOLS <fs> TYPE mmpur_s_pr_fldsel.
READ TABLE fieldselection_table ASSIGNING <fs> WITH KEY field = 'PRODUCTTYPE'.
IF sy-subrc EQ 0.
<fs>-fieldstatus = '*'.
ENDIF.
Implementing this piece of code makes the field Product Type read-only in purchase requisitions.
Example
A sample implementation is available that illustrates the intended of this BAdI.
Method for BAdI: MM_PUR_S4_PR_ FLDCNTRL_SIMPLE
Use
The method IF_MM_PUR_S4_PR_FLDCNTRL of the Business Add-In MM_PUR_S4_PR_FLDCNTRL_SIMPLE enables the user to change the field control properties of different attributes that appear on the user interface of purchase requisition apps.
Parameters
Import Parameters
- PURCHASEREQUISITION: This parameter holds details for purchase requisition header.
- PURCHASEREQUISITIONITEM: This parameter holds details for purchase requisition item.
- ISEXTPURGSCENARIO: This parameter holds value as ‘X’ in case of central requisitioning, and “ “ in case of local purchasing.
Changing Parameters
FIELDSELECTION_TABLE: This table holds a list of supported fields and its default properties retrieved from configurations defined in the apps. The user can overwrite these properties based on the values of importing parameters.
Note: This BAdI cannot overwrite the configurations done at the app level.
Keywords
Field control, Logic, BAdI, configuration entry, mandatory, optional, hidden, Custom Logic , KBA , MM-PUR-REQ , Purchase Requisitions , MM-PUR-PO , Purchase Orders , Problem