Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Display error message in EXIT_SAPMM06E_016 and stay in same screen without clearing the data entered

Francis417
Participant
0 Kudos
1,220

Dear experts,

I need to add custom checking in for the line item entered for the scheduling agreement created/changed using ME31L/ME32L. I've add coding in exit_sapmm06e_016 as follows and it seems to work but it will clear the entire line item that is being checked if the error message is issued.

How can I display the error message while keeping the entered data unchanged in the same screen. Or if there is any other BAdI or user-exit that I can use for the purpose.

Thanks,

Francis

data: tmp_netpr type eine-netpr.

if i_ekko-bsart = 'LP'.    
  clear tmp_netpr.
  if i_ekpo-pstyp = '2'.   
    select single netpr into tmp_netpr
                        from eine
                       where infnr = i_ekpo-infnr
                         and esokz = '2'                 
                         and werks = i_ekpo-werks    
                         and loekz ne 'X'            
                         and prdat ge sy-datum.      
    if tmp_netpr le 0.
      message 'Price not found' type 'W' display like 'E'.
        leave screen.
    endif.
  endif.
endif.
2 REPLIES 2

NTeunckens
Active Contributor
0 Kudos
291

This UserExit is a so-called "PBO"-Exit, used for passing Custom fields and the like. When you Raise Error-Msg here, this will result in loss of data (your current line). Try it's counterpart "PAI" "EXIT_SAPMM06E_017" to validate your data and raise a Message ...

Further, you might want to look into BAdI "ME_PO_PRICING_CUST" as an Alternative?

0 Kudos
291

Dear Nic,

Thanks for you suggestions.

I've tried the BAdI 'ME_PO_PRICING_CUST' by setting a break-point in the method PROCESS_KOMP but it seems ME31L is triggering the method, or it is not triggered after I've enter a line item in the overview screen and hit <Enter>. Anything I've missed?

As for the 'EXIT_SAPMM06E_017', it will also displayed message in the subsequent screen but not on the same overview screen that I've just entered the line item that is to be checked against.

Any idea how I can achieve to display the message in the same overview screen similar to the following.

Many Thanks,

Francis