Close Sidebar close
Sapignite
  • SAP
  • Coding Challenges
  • Download
  • SAP Ignite Products

Subscribe & Follow

All product names on this web site are trademarks of the companies that own them. Sapignite.com is not affiliated with SAP AG in any way. SAP AG is the registered trademark holder of SAP, SAP R/3, mySAP, ABAP, xApps, NetWeaver, and other proprietary terms. The technical information on this site is verified to the greatest extent possible, however, any information found on this site is used at the site visitor's own risk. Sapignite.com reserves the right to correct any errors or omissions in any portion of this site at any time without obligation.

  • SAP
  • Coding Challenges
  • Download
  • SAP Ignite Products
Sapignite
Sapignite
    ABAP Enhancement SAP

    Tutorial on How to Work with field Exit

    August 9, 2017

    Suppose you want to put a validation on a particular field then you can use Field exit.

    There are two types of field exits, Global and local.

    Global Field EXIT (suffix 0)

    Which is applicable for screens.

    LOCAL Field EXIT: (with suffix 1-9, A-Z)

    Which is applicable to a particular screen (that means, if you want to create a validation for batch field in MSC1n only, the same validation will not be applicable for other screens like VL32N, MB1C etc.)

    Let’s take a simple example:

    The requirement is to put a validation on field Production allocation in Basic data1 tab of Material Master. (See the below screen shot)

    IT should give an error message when user enters the value ‘RDC’ in the Production Allocation field.

    You can create a field exit for such kind of requirements.

    There are two ways to create field exit:

    Option 1:

    1) For field exits in R/3 4.6C, execute transaction CMOD. Then type PRFB in the command field.

    2) On the top menu…click on Field exit-> create ->enter the name of data element

    3) Enter the data element required for screen field to be mandatory and Execute

    4) Another screen comes with a function module name FIELD_EXIT_name of data element

    5) Click create and save it to corresponding function group

    6) You will get a function module with

    import parameter as: INPUT

    export parameter as: OUTPUT

    7) In the source code write the code: for validation

    8)Again to activate execute transaction CMOD. Then type

    PRFB in the command field. on the top menu…click on Field

    exit->Activate

    now wherever data element is used the mandatory check will

    come but you need it only for your program, so in the same

    screen click on Assign prog./screen tab and write the name

    of the program and screen number where you want the

    particular check

    Option 2

    You can also run the report RSMODPRF to create a field exit.

    For this example we will create a GLOBAL Field exit. So it will validate Production version for all the screen where-ever it is used.(Note : will are going to use option No 2 to create this field exit for this tutorial.)

    Step1

    Go to SE38 and run program RSMODPRF.

    Enter the data element name as KOSCH: you can find out the data element name using F1 help for that particular field: and Press F8.

    Step2:

    It will open the Function builder screen with FM name: FIELD_EXIT_KOSCH (FIELD_EXIT_<dataelement>_Suffix)

    Just click on create button and create a FM with the following code:

    (Note: it will ask for Function group name, you can create your own Function group and use it here)

    If you check the IMPORT and EXPORT data, you can see the INPUT and OUTPUT.it is nothing but the value of the field.

    if
    input = ‘RDC’.
    message
    ‘RDC type is not allowed’
    type
    ‘E’.
    endif.

    Step 3:

    Activate this Function module and click on back button.

    and execute the report RSMODPRF without the data element and suffix.

    It will display the below list: find out your exit

    Select that entry and activate it using menu bar FIELD EXITà ACTIVATE

    Now it’s time to test it…

    Go to MM02 enter any material name and select Basic data 1.and enter production type as RDC.Press Enter.

    FIELD_EXIT_KOSCHsap abap CMOD SMODsap abap enhancementsap abap field exitsap abap RSMODPRF
    raju borda
    Raju is working with Technical areas like SAP ABAP, PI , Web design, JAVA , PBT, robotics as architect also functional areas like SCM , QM, MM , insurance . When he is not Doing above geeky things you might find him travelling , Cooking , dancing or drinking with friends :-) .
    • Most frequently asked interview DIFFERENCES

    • Tutorial on How to work with function module EXIT

    You Might Also Like

    Let’s remember our old friend : Classical Reports !

    August 7, 2017

    Design patterns in Object oriented programming

    July 14, 2017

    SAP’s revolutionary journey and history of User interface / GUI

    July 10, 2017

    No Comments

    Leave a Reply Cancel Reply

Sign up for some exciting content

Recent Posts

  • How to prepare for SAP IBP Certification
  • What is SAP Leonardo ?
  • RoadMap UI Tutorial webdynpro for ABAP
  • Offline Adobe forms in WebDynPro for ABAP
  • MVC Architecture for Webdynpro for ABAP

Categories

  • ABAP
  • Android
  • Coding Challenges
  • Enhancement
  • featured
  • Interviews
  • Learning Hub
  • PI ( Process integration )
  • SAP
  • SAP HANA
  • Uncategorized
  • Webdynpro for ABAP
  • Webdynpro For ABAP