on 09-10-2018 11:10 AM
Hi there,
we are trying to add some additional checks to the OData service related to the Fiori approve purchase order app. In case a check fails an error message should be displayed on the frontend (or at least be part of the HTTP response).
BADI: GBAPP_APV_PO_RDP
Interface: IF_GBAPP_EX_APV_PO_RDP
Method: CHANGE_SET_DECISION
The method CHANGE_SET_DECISION may raises an exception of type /IWBEP/CX_MGW_BUSI_EXCEPTION.
So basically that is what I´m trying to do:
CLASS /sie/ad_zcm_cl_fio_apv_check DEFINITION PUBLIC CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_badi_interface .
INTERFACES if_gbapp_ex_apv_po_rdp .
ENDCLASS.
CLASS /sie/ad_zcm_cl_fio_apv_check IMPLEMENTATION.
METHOD if_gbapp_ex_apv_po_rdp~change_set_decision.
* some checks here
RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
EXPORTING
textid =
/iwbep/cx_mgw_busi_exception=>business_error_unlimited
message_unlimited = 'some error message'.
ENDMETHOD.
ENDCLASS.
Unfortunately the message is not part of the HTTP response. The message class and number are correct (business_error_unlimited) but instead of the message string the placeholder '&1' is shown.
{
"error": {
"code": "SY/530",
"message": {
"lang": "en",
"value": "An exception was raised."
},
"innererror": {
"application": {
"component_id": "MM-PUR",
"service_namespace": "/SAP/",
"service_id": "GBAPP_POAPPROVAL",
"service_version": "0001"
},
(...)
"errordetails": [
{
"code": "/IWBEP/CM_MGW_RT/022",
"message": "&1",
"propertyref": "",
"severity": "info",
"target": ""
},
{
"code": "/IWBEP/CX_MGW_BUSI_EXCEPTION",
"message": "An exception was raised.",
"propertyref": "",
"severity": "error",
"target": ""
}
]
}
}
}
The exception is catched in class CL_GBAPP_APV_PO_API method SET_DECISION.
TRY.
CALL BADI lo_ext_badi_rdp->change_set_decision
EXPORTING
iv_workitem_id = <fs_approval_decision>-workitem_id
iv_pc_number = <fs_approval_decision>-po_number
iv_release_code = lv_release_code
iv_approval_text = lv_approval_text
iv_rejection_text = lv_rejection_text
iv_approval_string = <fs_approval_decision>-approval_text
iv_rejection_string = <fs_approval_decision>-rejection_text
iv_decision = <fs_approval_decision>-decision
IMPORTING
ev_decision_processed = lv_decision_processed
es_action_successful = lv_action_successful
ev_skip_wait = lv_skip_wait
ev_wait_loops = lv_wait_loops.
CATCH /iwbep/cx_mgw_busi_exception INTO lcx_badi.
" get_text() returns the correct message but lv_msg is a single char
lv_msg = lcx_badi->get_text( ).
" the method has a paramter lv_text_msg but it´s not used here
lo_cmn_api->raise_exception_iwbep_business( iv_leading_msg = lv_msg ).ENDTRY.
So the question is:
What is the correct way to do retrieve a custom error message using the /IWBEP/CX_MGW_BUSI_EXCEPTION exception class?
For my release this issue has been solved by note 2747538.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.