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: 

Producing Error to User Via MB_CHECK_LINE_BADI

former_member393151
Participant
0 Kudos

I'm attempting to check user's input data in goods movement documents via BADI MB_CHECK_LINE_BADI. I have no problem check the data, however how does one issue an error/warning to the user and allow them to re-enter or change data?

A code example would be great!

2 REPLIES 2

shishupalreddy
Active Contributor
0 Kudos

heloo,

please look at this ample code

method IF_EX_MB_CHECK_LINE_BADI~CHECK_LINE .

IF ( IS_MSEG-INSMK = ' ' ) AND IS_MSEG-QINSPST = '1'.

MESSAGE E000(mesg-id) WITH text-001 .

ENDIF.

regards,

Former Member
0 Kudos

Hi,

In BADI u cannt raise Error Messages but u can Post the Messages to Application Logs, So u have to Update ur messages to CT_LOG.

or

See the sample BADI code for PR which raises an exceptions and do accordingly

BAdI Name: ZPUR_RFQ (Implementation name) Purchase Requisitions

Definition Name: ME_REQ_POSTED

Interface Name : IF_EX_ME_REQ_POSTED

Implementing Class: ZCL_IM_PUR_REQ

Method : POSTED

************************************************************************

METHOD if_ex_me_req_posted~posted .

DATA : v_mtart TYPE mtart.

DATA l_s_eban TYPE ueban.

LOOP AT im_eban INTO l_s_eban.

IF l_s_eban-estkz NE 'B'.

CLEAR v_mtart.

SELECT SINGLE mtart INTO v_mtart FROM mara WHERE matnr = l_s_eban-matnr.

IF v_mtart EQ 'ZERS' OR v_mtart EQ 'FHMI' OR v_mtart EQ 'UNBW'.

MESSAGE e000(zm_msg) WITH 'You are not allowed' 'to create PR for stock items'.

ENDIF.

ENDIF.

<b>IF l_s_eban-knttp NE 'F' OR l_s_eban-pstyp NE '9'.

IF l_s_eban-knttp NE 'A'.

IF ( l_s_eban-pstyp NE '9' AND l_s_eban-pstyp NE 'D' )

AND l_s_eban-matnr EQ space.

MESSAGE e000(zm_msg) WITH 'You cannot create'</b>

'a PR without material number'.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

ENDMETHOD.

<b>Reward points</b>

Regards