User Experience Insights
Enhancement to grey out short text field in PR based on certain conditions
This blog post is just a consolidation of various other blogs posts across the SCN community.
My requirement was disabling the short text field in purchase requisition based on certain conditions. The purpose of this blog posts is to display the enhancement done for this requirement.
Since there were not any complete blogs posts over the community, I decided to write this article.
We all know the functionality of field selection in transactional documents.
Details on functionality of field selection is explained very beautifully in below blog post:
There is another functionality named Metafield which influences the field selections.
What is a Metafield? How does Metafield influences the field selection? This is explained in below blog:
Metafield value can be obtained through debugging or alternatively through FM – MEMFS_BUILD_MAPPING_PO_DOC
Pass the below application values to import parameter – IM_APPLICATION
Application for PR – MMPUR_PR_DOC [We will be using this for our enhancement]
Application for PO – MMPUR_PO_DOC
The metafield value obtained for short text is 69, we will be using same in our enhancement.
The metafield values above are the link into field selection customizing, table T162-FAU*.
Field selection configuration for PR
Path – OLME à Purchase Requisition à Define Screen Layout at Document Level
For our requirement we will consider two standard field selection keys:
Header Level – NBB
Standard Item level – PT0B
The configurations from these two field selection keys will influence our enhancement. We will be overriding the optional entry to display state for certain conditions.
Our enhancement is based on assumption that the short text field status is set to OPTIONAL for both these field selection keys – NBB & PT0B.
To override the configuration settings we need to add Implicit enhancement at end of below FM’s
FM for PR – MEREQBADI_FS_ITEM [We will be using this for our enhancement]
FM for PO – MEPOBADI_FS_ITEM
We will disable the short text field based on below conditions:
- PR document type – NB
- Plant – 1A00
- Material is entered at line item
Below are the values of Field Status is stored in table – TBKKI_01
+ – Required Entry
– – Hidden
* – Display
. – Optional
Below is the sample Code:
There are other ways as well to achieve this requirement by using below BADI methods
To Summarize, based on certain conditions we can override the field status set in configuration by implementing this enhancement or BADI.
Please feel free to comment & suggest any changes required for this documentation. Please do share your feedback or thoughts on the same.
Thank you very much.
Interesting post. I am looking for similar information for S/4 Hana Cloud, specifically I want to check the setting in Field for Field Selection group. Currently when raising a Purchase Requisition we cannot edit the Sort Text field, it is adopting the Material Description but we need to capture more detail on raising to PR to carry through on PO and Finance Doc.
Any assistance welcome.