Application Development and Automation 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: 
Read only

Badi:MB_DOCUMENT_UPDATE_BEFORE

jaheer_hussain
Active Contributor
0 Likes
3,685

Hi

I am trying to  implment badi:MB_DOCUMENT_BADI with method MB_DOCUMENT_BEFORE_UPDATE for validation of cost ceter during GR(with PO number movement type 101).

My code in MB_DOCUMENT_BEFORE_UPDATE

------------------------------------------------------------------

method IF_EX_MB_DOCUMENT_BADI~MB_DOCUMENT_BEFORE_UPDATE.


  DATA:


        LS_MSEG TYPE MSEG,


        LS_BNAME TYPE USR02-BNAME.


  LOOP AT XMSEG INTO LS_MSEG WHERE WERKS = '4120'.


    SELECT SINGLE BNAME FROM ZMCC INTO LS_BNAME WHERE BNAME  = LS_MSEG-USNAM_MKPF AND KOSTL = LS_MSEG-KOSTL  AND WERKS = LS_MSEG-WERKS.


    IF SY-SUBRC <> 0.


      MESSAGE E027(ZQ) WITH LS_MSEG-KOSTL.



    ENDIF.


  ENDLOOP.


endmethod.

----------------------------------------------------------------------------------------------------------------------------

While doing GR  I am getting run time error(dump) as below.

Dump:

Short text
    The current application triggered a termination with a short dump.

What happened?
    The current application program detected a situation which really
    should not occur. Therefore, a termination with a short dump was
    triggered on purpose by the key word MESSAGE (type X).

Can somebody guide me to solve this problem?

1 ACCEPTED SOLUTION
Read only

arivazhagan_sivasamy
Active Contributor
0 Likes
3,047

Hi Jaheer,

Instead of writing code in MB_DOCUMENT_BEFORE_UPDATE,

write a check in user exit MBCF0002.

This exit is having all the required parameters and also it will trigger while checking document  and also posting document.

Arivazhagan S

Hi

I am trying to  implment badi:MB_DOCUMENT_BADI with method MB_DOCUMENT_BEFORE_UPDATE for validation of cost ceter during GR(with PO number movement type 101).

My code in MB_DOCUMENT_BEFORE_UPDATE

------------------------------------------------------------------

method IF_EX_MB_DOCUMENT_BADI~MB_DOCUMENT_BEFORE_UPDATE.


  DATA:


        LS_MSEG TYPE MSEG,


        LS_BNAME TYPE USR02-BNAME.


  LOOP AT XMSEG INTO LS_MSEG WHERE WERKS = '4120'.


    SELECT SINGLE BNAME FROM ZMCC INTO LS_BNAME WHERE BNAME  = LS_MSEG-USNAM_MKPF AND KOSTL = LS_MSEG-KOSTL  AND WERKS = LS_MSEG-WERKS.


    IF SY-SUBRC <> 0.


      MESSAGE E027(ZQ) WITH LS_MSEG-KOSTL.



    ENDIF.


  ENDLOOP.


endmethod.

----------------------------------------------------------------------------------------------------------------------------

While doing GR  I am getting run time error(dump) as below.

Dump:

Short text
    The current application triggered a termination with a short dump.

What happened?
    The current application program detected a situation which really
    should not occur. Therefore, a termination with a short dump was
    triggered on purpose by the key word MESSAGE (type X).

Can somebody guide me to solve this problem?

1 REPLY 1
Read only

arivazhagan_sivasamy
Active Contributor
0 Likes
3,048

Hi Jaheer,

Instead of writing code in MB_DOCUMENT_BEFORE_UPDATE,

write a check in user exit MBCF0002.

This exit is having all the required parameters and also it will trigger while checking document  and also posting document.

Arivazhagan S