2008 Sep 30 12:39 PM
Hi All,
I need to validate some item level data with the header data, So i wrote the code in User Exit. Its validating well, but if i press save button its simple asking a dialog and the PO is getting saved when i have errro also.
i have tried EXIT_SAPMM06E_007, EXIT_SAPMM06E_006 and EXIT_SAPMM06E_012 also. In call cases, its validating properly with throwing a message. But i am able to save...
can you please let me know your views on this.
Thnks,
Raghu Posani.
Hi raghu,
Try issuing an Error Message instead of Warning.
Then why you have enclosed message statement with +* ?
Try removing that and try.
>
>
> +*MESSAGE W072(zmm) WITH ls_detail-ebelp.*+ >>
Regards
Karthik D
2008 Oct 01 4:30 AM
Hello Raghu
When you look through the signatures of the exit-fm's you have mentioned then you see that there is no parameter available to send back an "error flag" to the main application.
I am not very familiar with this user-exit function group but if you have BAdI ME_PROCESS_PO_CUST available on your system you can easily implement your logic in interface method IF_EX_ME_PROCESS_PO_CUST~CHECK, e.g.:
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.
" check ( im_hold = 'X' ). " hold purchase order
* 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( ).
ADD ls_detail-netwr TO ld_netwr_sum. " Total of net price
ENDLOOP.
* Check condition
IF ( ld_netwr_sum > 1000 ).
MESSAGE 'Net price > 1000 => create purchase requisition' TYPE 'E'.
ch_failed = 'X'. "
ENDIF.
ENDMETHOD.
The "error flag" for the main program is CH_FAILED. If this CHANGING parameter is set CH_FAILED = 'X' the PO cannot be saved.
Regards
Uwe
2008 Oct 01 6:49 AM
Dear Uwe,
Thanks for the beautiful example...
But when i am trying to execute the below code with warning message, the warning message is not populating. Can you please tell me, why iam unable to display the warning messages??
SELECT SINGLE * FROM marc
INTO wa_marc
WHERE matnr = ls_detail-matnr
AND werks = ls_detail-werks
AND ekgrp = ls_header-ekgrp.
IF sy-subrc NE 0.
+*MESSAGE W072(zmm) WITH ls_detail-ebelp.*+
ENDIF.
Thnks,
Raghu Posani.
2008 Oct 01 7:27 AM
Hi raghu,
Try issuing an Error Message instead of Warning.
Then why you have enclosed message statement with +* ?
Try removing that and try.
>
>
> +*MESSAGE W072(zmm) WITH ls_detail-ebelp.*+ >>
Regards
Karthik D
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |