Skip to Content

High level requirement : Whenever MM RFQ created the line item material column should me mandatory based on Doc. Type and Purchase Organization.

Possible Solution : In SPRO customizing, define screen layout level we can set whether Reqd.entry / Opt. entry /  Display.

Analysis :

1)  In selection group basic item data we couldnt find Material field so its controlled by program level.

“Field Label                    Reqd.entry  Opt. entry  Display

Plant

Storage location

Indicator: “Texts exist”

Short text

Material group

Material description

Manufacturer part number”

2) Tried to put validation on enhancement ‘MM06E005‘ with PAI and Posting level but validation got triggered and stopping the entire process. Say like I have maintained 20 rows in table control with material column and 21st row i have maintained material text, in this case validation triggered but I couldnt delete since the error got triggered. Now there is an option to create from scratch RFQ from beginning which is redundant work.

3) Tried BADI but not suitable.

4) Tried field exit(EMATNR) based on Doc. Type and Purchase Organization. But the problem is when I maintain complete line items and validated successfully as our need but the field exit code got triggered on next row which is empty. I have tried to compare the Short Text field value but the value will be assigned to variable once field exit fired.

Again I have created one more field exit on the data element ‘TXZ01’ and made small logic which is given below.

Both field exit FM’s(FIELD_EXIT_EMATNR and FIELD_EXIT_TXZ01) are grouped into one Function Group(ZFG_ME41)

declared global variable as data gs_flag.

Below the logic written inside FM-FIELD_EXIT_TXZ01

  IF SY-TCODE EQ ‘ME41’ or SY-TCODE EQ ‘ME42’.

       if gs_flag is not initial and input is not initial.

         message ‘Please enter material code’ type ‘E’.

       endif.

       clear gs_flag.

  ENDIF.

Below the logic written inside FM-FIELD_EXIT_EMATNR

  IF SY-TCODE EQ ‘ME41’ or SY-TCODE EQ ‘ME42’.

       if input is initial.

          gs_flag = ‘X’.

       else.

          clear gs_flag.

       endif.

  ENDIF.

Now I have tested both ME41/ME42 and its working as expected.

This blog is very simple but I spent lot of time to achieve this validation and I can say ‘everything is possible’.

Please post your valuable comments and thanks for your valuable time.

Regards,

Vadamalai A,

Technical Architect-Tech Mahindra.

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Chinmay Kulkarni

    I have read about field exits only in books, never used it. Can you elaborate more on how to implement field exits?

    A better way to address your requirement was transaction variant. But again, I think you won’t be able to put a conditional mandatory flag in transaction variant.

    (0) 
    1. Vadamalai Athimoolam Post author

      Hi Chinmay,

      To implement field exit you can run this program ‘RSMODPRF’ and give the data element of the screen field.

      The following ABAP statements are not allowed in the function modules of

      field exits:

           BREAK-POINT,

           CALL SCREEN, CALL DIALOG, CALL TRANSACTION, SUBMIT,

           COMMIT WORK, ROLLBACK WORK,

           COMMUNICATION RECEIVE,

           EXIT FROM STEP-LOOP,

           MESSAGE I, MESSAGE W.

      Regards,

      Vadamalai

      (0) 

Leave a Reply