Skip to Content

enable screen fields after error message in MM01/02 User Exit

Hi all,

i need help to enable screen fields of a specific view(Sales:General/Plant Data) in MM01/02 after Error Message(if xchpf is not set when its set in other plant) in CustomerExit.

It looks like this after i try to save Material.

EXIT_SAPLMGMU_001

INCLUDE ZXMG0U02

Every combination of Message Type and Display Like didnt work. Also RAISING APPLICATION_ERROR didnt work.

I also tried to loop at screen and set screen-input = 1. And Chain-Endchain cant be used in UserExit.

It feels like its a super easy problem but i cant figure it out since days/ even weeks. I would appreciate your help very much.

Greetings

My Code below:


*&---------------------------------------------------------------------*
*& Include ZXMG0U02
*&---------------------------------------------------------------------*

*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(WMARA) LIKE MARA STRUCTURE MARA
*" VALUE(WMARC) LIKE MARC STRUCTURE MARC
*" VALUE(WMARD) LIKE MARD STRUCTURE MARD
*" VALUE(WMBEW) LIKE MBEW STRUCTURE MBEW
*" VALUE(WMLGN) LIKE MLGN STRUCTURE MLGN
*" VALUE(WMLGT) LIKE MLGT STRUCTURE MLGT
*" VALUE(WMVKE) LIKE MVKE STRUCTURE MVKE
*" VALUE(WSTAT) LIKE MGSTAT STRUCTURE MGSTAT
*" VALUE(WMFHM) LIKE MFHM STRUCTURE MFHM
*" VALUE(WMPOP) LIKE MPOP STRUCTURE MPOP
*" TABLES
*" STEXT STRUCTURE SHORT_DESC
*" SSTEUERTAB STRUCTURE MG03STEUER
*" SSTEUMMTAB STRUCTURE MG03STEUMM
*" WMEINH STRUCTURE SMEINH
*" SMEAN_ME_TAB STRUCTURE MEAN
*" CHANGING
*" VALUE(CMARA) LIKE MARU STRUCTURE MARU
*" EXCEPTIONS
*" APPLICATION_ERROR
*"----------------------------------------------------------------------


IF ( sy-tcode = 'MM01' OR sy-tcode = 'MM02' ) AND ( sy-ucomm = 'BU' OR sy-ucomm = 'YES').

DATA: wa_marc LIKE marc,
l_return TYPE bapireturn,
l_returnpalet TYPE bapireturn, "dont mind this
other_werk TYPE werks,
xchpfcheck_text TYPE string.

IF wmarc-werks = '0001'.
other_werk = '0002'.
ELSEIF wmarc-werks = '0002'.
other_werk = '0001'.
ENDIF.

CALL FUNCTION 'BAPI_MATERIAL_GET_DETAIL'
EXPORTING
material = wmarc-matnr
plant = other_werk
IMPORTING
return = l_return.

CLEAR xchpfcheck_text.

*Wenn Artikel überhaupt im anderen Werk existiert
IF l_return-type = 'S'.


IF wmarc-werks = '0001' AND wmarc-xchpf IS INITIAL.
SELECT SINGLE * FROM marc INTO wa_marc WHERE matnr = wmarc-matnr AND werks = other_werk.
IF sy-subrc = 0.
IF wa_marc-xchpf = 'X'.
CONCATENATE 'Material' wmarc-matnr 'ist im Werk' other_werk 'chargenpflichtig. Bitte in Werk' wmarc-werks 'auch setzen.' INTO xchpfcheck_text SEPARATED BY space.

* LOOP AT SCREEN.
* screen-input = '1'.
* MODIFY SCREEN.
* ENDLOOP.

* MESSAGE ID 'L2' TYPE 'E' NUMBER '024' RAISING application_error.


MESSAGE e024(l2).

* SET SCREEN sy-dynnr.
* EXIT.

ENDIF.
ENDIF.
ELSEIF wmarc-werks = '0002' AND wmarc-xchpf IS INITIAL.
SELECT SINGLE * FROM marc INTO wa_marc WHERE matnr = wmarc-matnr AND werks = other_werk.
IF sy-subrc = 0.
IF wa_marc-xchpf = 'X'.
CONCATENATE 'Material' wmarc-matnr 'ist im Werk' other_werk 'chargenpflichtig. Bitte in Werk' wmarc-werks 'auch setzen.' INTO xchpfcheck_text SEPARATED BY space.

* LOOP AT SCREEN.
* screen-input = '1'.
* MODIFY SCREEN.
* ENDLOOP.

* MESSAGE ID 'L2' TYPE 'E' NUMBER '024' RAISING application_error.

MESSAGE e024(l2).

* SET SCREEN sy-dynnr.
* EXIT.
ENDIF.
ENDIF.
ENDIF.
ENDIF.

ENDIF.

eeaqp.png (83.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Jan 14 at 01:51 PM

    I found out that this coding works on other SAP system-server. When i call 'MESSAGE e024(l2)' on our productive server it works as intended.


    But in our test system it disables all fields.

    I cant find out why

    Add comment
    10|10000 characters needed characters exceeded