‎2007 Oct 02 4:42 PM
I have the following exit implemented that I am now covnerting to BADI
ME_PROCESS_REQ_CUST
FUNCTION EXIT_SAPLKACB_002.
*"----
""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(I_COBL) LIKE COBL STRUCTURE COBL
*" CHANGING
*" REFERENCE(E_COBL_CUST) LIKE BAPICOBL_CI
*" STRUCTURE BAPICOBL_CI
*" EXCEPTIONS
*" SEND_MESSAGE
*"----
INCLUDE ZXKNTU02 .
ENDFUNCTION.FUNCTION EXIT_SAPLKACB_002.
*"----
""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(I_COBL) LIKE COBL STRUCTURE COBL
*" CHANGING
*" REFERENCE(E_COBL_CUST) LIKE BAPICOBL_CI
*" STRUCTURE BAPICOBL_CI
*" EXCEPTIONS
*" SEND_MESSAGE
*"----
INCLUDE ZXKNTU02 .
ENDFUNCTION.
This message is raised in the exit.
IF lv_return-type <> c_success AND
lv_return-type <> c_space.
MESSAGE e007(zeca_nvy). "Error determining CEG
RAISE send_message.
ENDIF.
How do I do the same thing in the method PROCESS_ITEMS and RAISE the message?
‎2007 Oct 02 10:31 PM
Hello JJ
The interface method IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM does not have any exceptions or parameters in its signature that would allow error handling.
However, you have to do your checks in interface method <b>IF_EX_ME_PROCESS_PO_CUST~CHECK</b> (Closing Check). Below I provide some sample coding:
METHOD if_ex_me_process_po_cust~check.
* define local data
DATA:
lt_items TYPE purchase_order_items,
* ls_item LIKE LINE OF lt_items, " alternatively
ls_item TYPE purchase_order_item,
*
ld_netwr_sum TYPE netwr,
*
ls_header TYPE mepoheader,
ls_detail TYPE mepoitem,
lt_details TYPE tab_mepoitem.
* Get the order items
lt_items = im_header->get_items( ).
REFRESH: lt_details.
LOOP AT lt_items INTO ls_item.
ls_detail = ls_item-item->get_data( ).
IF ( <condition fails> ).
MESSAGE 'Error in requisition item ...' TYPE 'E'.
ch_failed = 'X'.
EXIT. " abort further processing OR drop the EXIT statement.
" Perhaps all error item message will be collected.
ENDIF.
ENDLOOP.
endmethod.Regards
Uwe