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 - Problem with displaying error message - Urgent

Former Member
0 Likes
888

Hi,

I'm validating plant field while PO amendment. According to the logic, i'm raising one error message, but it is not coming at that moment, it is coming while saving or checking. i need to display that in task bar, there itself. Very Urgent. Please help me...

Thanks in Advance,

Sankar.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
821

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.

<b>Reward points</b>

Regards

Hi,

I'm validating plant field while PO amendment. According to the logic, i'm raising one error message, but it is not coming at that moment, it is coming while saving or checking. i need to display that in task bar, there itself. Very Urgent. Please help me...

Thanks in Advance,

Sankar.

4 REPLIES 4
Read only

Former Member
0 Likes
820

Hi,

Please mention the name of the BADI for cross checking...

Also,i believe the badi will having methods...before update..while update etc..You must have put the code at "during update" of "during SAVE"...Please check if the BADI has any other options where the code can be effectively used/implemented.

Regards

Byju

Read only

Former Member
0 Likes
822

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.

<b>Reward points</b>

Regards

Read only

0 Likes
820

Hi Kiran,

Is there any way to display that error there itself, while changing the plant.

I'm using BADI : ME_PROCESS_PO_CUST and interface : PROCESS_ITEM.

While Plant is changed in item level, error should come depending on logic. Control is going to the error message and logic is fine. But error is not coming there in task bar. is there any way to display there itself, after giveing and pressing enter? reply me soon.

Sankar.

Read only

Former Member
0 Likes
820

See following code - it adds error message into the standard SAP Messages list for the PO and prevents saving till error is fixed.

It is coded in the CHECK method of ME_PROCESS_PO_CUST BADI. It is documented in the BADI documentation.

METHOD if_ex_me_process_po_cust~check.

      • NB: Add Type Group MMMFD to implementing class properties tab

DATA: lt_items TYPE purchase_order_items,

l_item_wa TYPE purchase_order_item,

l_item TYPE mepoitem,

l_total TYPE brtwr,

l_matkl TYPE matkl,

l_flag TYPE c.

INCLUDE mm_messages_mac. "useful macros for message handling

CLEAR: l_total, l_flag.

CALL METHOD im_header->get_items

RECEIVING

re_items = lt_items.

  • Loop through items and calculate total

LOOP AT lt_items INTO l_item_wa.

CALL METHOD l_item_wa-item->get_data

RECEIVING

re_data = l_item.

l_matkl = l_item-matkl.

l_total = l_total + l_item-brtwr.

  • Check if any lines missing contract number

IF l_item-konnr IS INITIAL.

l_flag = 'X'.

ENDIF.

ENDLOOP.

IF l_flag = 'X'.

IF l_total > 5000.

mmpur_metafield mmmfd_agreement.

mmpur_message 'E' '06' '999'

'Purchase order over $5000.00 requires a contract' '' '' ''.

  • invalidate the object

CALL METHOD im_header->invalidate( ).

LOOP AT lt_items INTO l_item_wa.

CALL METHOD l_item_wa-item->invalidate( ).

ENDLOOP.

ENDIF.

ENDIF.

ENDMETHOD.