SAP BLOG Enhancement to grey out short text field in PR based on certain conditions

SAP Blog

Kayıtlı Üye
Katılım
22 Ara 2017
Mesajlar
1,925
Tepki puanı
7
Puanları
6
Hi All,

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:

A brief interpretation about field selection and screen layout used in MM | SAP Blogs



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:

Field Selection – An insight on the technical implementation | SAP Blogs



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

Input-Value-for-FM-MEMF_BUILD_MAPPING_PO_DOC.png


Output-for-FM-MEMF_BUILD_MAPPING_PO_DOC.png


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.

ld-Selection-Values-set-as-OPTIONAL-for-short-text.png


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

FM-MEREQBADI_FS_ITEM.png


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:

Sample-Code.jpg


Testing

Testing.jpg


There are other ways as well to achieve this requirement by using below BADI methods

BADI.jpg


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.

Okumaya devam et...
 
Üst