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

Capture PO errors to log table

Former Member
0 Likes
2,425

Please let me know if there is a way to capture SAP standard errors raised during PO creation into a Z log table.

EX: SAP raises Message 06, message number 882, is there a way to capture this error into a log table.

Thanks for your help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,297

Why do you want to capture the errors in log table. There is a way like see what validation standard sap is doing before throwing the errors and accordingly capture them

4 REPLIES 4
Read only

Former Member
0 Likes
1,298

Why do you want to capture the errors in log table. There is a way like see what validation standard sap is doing before throwing the errors and accordingly capture them

Read only

0 Likes
1,297

Quality Inforecord is set up through config and if any material/ vendor combination does not have a QIR, SAP raises message say EX: 06 - message number 822.

I want to capture the material and vendor number and store it in Z table along with the error message for Business to later review and create QIR.

Please let me know if its possible to get list of already captured errors - to insert in Z table through User exit.

Read only

Former Member
0 Likes
1,297

In PO processing using ME21N/ME22N a lot messages are not issued individually, but are presented in a list in a pop-up window. Not sure if this is true of the messages you want to capture.

If you look at the following code implemented in the CHECK method of "ME_PROCESS_PO_CUST" BADI, you will see it adds a customer message to this list using the macro MMPUR_MESSAGE from the MM_MESSAGES_MAC include.

Perhaps there is also a macro for reading the messages.

Even if not, the macro code should show how you could read them and then you could place code in this user exit to get the messages and log the relevent ones to a Z table

[code]

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.

[/code]

Hope this is of some use.

Andrew

Read only

0 Likes
1,297

Thanks Andrew, Will look into it. Hopefully this solves the issue. Thanks!