Wednesday 14 December 2022

How to Change Screen Field Properties in Purchase Requisitions

In this post blog, I will show you how to change screen field properties and how to hide screen fields/tabs on purchase requisitions screens.(ME51N, ME52N, ME53N)

This blog post specifically will cover showing, hiding fields which can not be customized by using SPRO customizing settings.

In additional, it works on S/4HANA Cloud too.

In our example, I’ll show you, hiding the fields which are ‘Expected Value’ and ‘Overall Limit’ fields.

SAP ABAP Development, SAP ABAP Extensibility, SAP S/4HANA, SAP ABAP Career, SAP ABAP Skill, SAP ABAP Jobs, SAP ABAP Prep

Enhanced Limits = Screen Name.

We need to complete following steps;

We will find metafield values.
We will find out how values are named.
We will create BAdI implementation.
First, we will find the metafield values of the fields on the screen. Metafield values are included in the MMMFD Type Group.

SAP ABAP Development, SAP ABAP Extensibility, SAP S/4HANA, SAP ABAP Career, SAP ABAP Skill, SAP ABAP Jobs, SAP ABAP Prep

MMMFD Simple Limits

Then we find out how the metafield values are named in the program from the MAP_METAFIELD_TO_GFN method under the CL_MM_PUR_S4_PR_FCNTRL_HELPER class.

SAP ABAP Development, SAP ABAP Extensibility, SAP S/4HANA, SAP ABAP Career, SAP ABAP Skill, SAP ABAP Jobs, SAP ABAP Prep

Metafield Names

Then we implement MM_PUR_S4_PR_FLDCNTRL_SIMPLE BAdI application. This BAdI MM_PUR_S4_PR enhancement is located under the enhancement spot.

We implement MM_PUR_S4_PR_FLDCNTRL_SIMPLE BAdI that we need for the ME5*N screen.

SAP ABAP Development, SAP ABAP Extensibility, SAP S/4HANA, SAP ABAP Career, SAP ABAP Skill, SAP ABAP Jobs, SAP ABAP Prep

Create Enhancement Implementation

Entering BAdI and class names then we choose our BAdI.

SAP ABAP Development, SAP ABAP Extensibility, SAP S/4HANA, SAP ABAP Career, SAP ABAP Skill, SAP ABAP Jobs, SAP ABAP Prep

BAdI Implemantions

After that click Empty Class and continue.

SAP ABAP Development, SAP ABAP Extensibility, SAP S/4HANA, SAP ABAP Career, SAP ABAP Skill, SAP ABAP Jobs, SAP ABAP Prep

Create Implement Class

Activate the incoming screen and continue by to the next screen.

SAP ABAP Development, SAP ABAP Extensibility, SAP S/4HANA, SAP ABAP Career, SAP ABAP Skill, SAP ABAP Jobs, SAP ABAP Prep

Enhancement Implementation

Click the Adjust Enhancement Implementation and apply Interface Component.

SAP ABAP Development, SAP ABAP Extensibility, SAP S/4HANA, SAP ABAP Career, SAP ABAP Skill, SAP ABAP Jobs, SAP ABAP Prep

Adjust Enhancement Implementation

Then press the Implement button and apply our method.

SAP ABAP Development, SAP ABAP Extensibility, SAP S/4HANA, SAP ABAP Career, SAP ABAP Skill, SAP ABAP Jobs, SAP ABAP Prep

Implement Component

Finally, we write our code in the method as follows and activate it.

  METHOD if_mm_pur_s4_pr_fldcntrl~modify_fieldcontrols.

    TYPES ty_field TYPE RANGE OF prfield.

    DATA(fields) = VALUE ty_field( sign = 'I' option = 'EQ'
     ( low = 'EXPECTEDOVERALLLIMITAMOUNT' )
     ( low = 'OVERALLLIMITAMOUNT' )
     ).

    LOOP AT fieldselection_table ASSIGNING FIELD-SYMBOL(<field>)
      WHERE field IN fields.

      <field>-fieldstatus = '-' .

    ENDLOOP.

  ENDMETHOD.
 
Possible values for fieldstatus;

‘-‘ Field is Hidden
‘*’ Field is only Displayed, which means no entry is possible
‘+’ Field is Mandatory, which means an entry must be made
‘.’ Field is Optional, which means an entry may be made

Those are all the steps to enhance ME5*N screens. When you enter the ME5*N screens, you will see that the fields are hidden.

SAP ABAP Development, SAP ABAP Extensibility, SAP S/4HANA, SAP ABAP Career, SAP ABAP Skill, SAP ABAP Jobs, SAP ABAP Prep

Those are all the steps to enhance ME5*N screens.

No comments:

Post a Comment