Enable for input erroneous field after the E error message in MIRO?

6.7k Views Asked by At

I'm developing a validation in tx MIRO through the BADI MRM_HEADER_CHECK, I show a message when the field "reference" has already been used. The message has type E, this disables every field on screen and so the user can't return to that field to fix its value.

Screenshot Tcode MIRO

FYI:

  • I have to show message type E because I want to block every fields excepts the two fields with encircled in red. I saw that the people suggestion use this:

  • if I put the breakpoint SY-DINNR equals to 6000.

  • In my BADI code LOOP AT SCREEN doesn't see field names that I want to disable.

  • MESSAGE <msg> TYPE 'S' DISPLAY LIKE 'E' doesn't work as well

I can't modify code that is out of my BADI code, e.g. in PAI and PBO modules:

CHAIN.
  fields: f1,f2,f3.
  MODULE <mod name>.
ENDCHAIN.

This my BADI code:

*This field symbol have the values of inputs.
ASSIGN ('(SAPLMR1M)RBKPV') TO <fs_rbkpv>. 
IF <fs_rbkpv>-XBLNR = lwa_bkpf-xblnr.
  MESSAGE lc_message TYPE 'E'.
ENDIF.

Any ideas? Thanks in advance.

1

There are 1 best solutions below

0
On

It is not possible. There is no access to screen fields from BAdI, so you should rather enhance standard PBO code with the CHAIN...ENDCHAIN statement or find another user exit/BAdI.

Personally I suggest you not to overthink and overcomplicate and simply use:

MESSAGE 'Your Message' TYPE 'W' DISPLAY LIKE 'E'.

It will show usual error message leaving screen fields free to input. Anyway invoice won't be saved until all screen fields would be valid, no matter disabled they or not.


P.S. Why don't you use standard interface I_RBKPV provided by MRM_HEADER_CHECK like this:

IF i_rbkpv-xblnr = lwa_bkpf-xblnr AND sy-tcode = 'MIRO'.
 ...
ENDIF.

Direct memory access via field-symbols is not safe and shouldn't be used where it's not necessary.