on ‎2021 Sep 17 2:54 PM
Dear Experts
When I call my function import in my SAPUI5 code, I receive the error message above (in subject). Please take the details from the descriptions below.
01. Implementing Function Import (SEGW)

02. The redefined method EXECUTE_ACTION
METHOD /iwbep/if_mgw_appl_srv_runtime~execute_action.
*************************************************************************
* Funktionsimporte ausführen
*
* Parameter
* ----------------------------------------------------------------------
* @param IO_TECH_REQUEST_CONTEXT Request Data
* @param ER_DATA Rückgabewerte
* @param /IWBEP/CX_MGW_BUSI_EXCEPTION Ausnahme in der Businesslogik
* @param /IWBEP/CX_MGW_TECH_EXCEPTION Technische Ausnahme
*************************************************************************
TYPES: BEGIN OF documentisvalid,
docstat TYPE string,
docart TYPE string,
END OF documentisvalid.
DATA: ls_dokar TYPE zcl_pm_bp_infotool_mpc=>ts_dokar,
ls_import_docart TYPE documentisvalid,
ls_doc_type TYPE zca_dokart_pop.
CASE iv_action_name.
WHEN 'DocumentIsValid'.
io_tech_request_context->get_converted_parameters( IMPORTING es_parameter_values = ls_import_docart ).
SELECT SINGLE dokar FROM zca_dokart_pop INTO ls_doc_type WHERE dokar = ls_import_docart-docart.
CLEAR ls_dokar.
IF ( sy-subrc EQ 0 ).
IF ls_import_docart-docart EQ ''.
ls_dokar-dokar = ''.
ELSE.
ls_dokar-dokar = ls_import_docart-docart.
ENDIF.
ENDIF.
copy_data_to_ref(
EXPORTING
is_data = ls_dokar
CHANGING
cr_data = er_data ).
WHEN OTHERS.
CALL METHOD super->/iwbep/if_mgw_appl_srv_runtime~execute_action
EXPORTING
iv_action_name = iv_action_name
it_parameter = it_parameter
io_tech_request_context = io_tech_request_context
IMPORTING
er_data = er_data.
ENDCASE.
ENDMETHOD.
03. Checking the metadata of OData Service
Code section with "function import":

04. Test call of function import in /IWFND/GW_CLIENT
Request URL:
/sap/opu/odata/sap/{SERVICE_NAME}/DocumentIsValid?DocArt='ZAA'&DocStat='SP'&$fo
rmat=json

05. Calling the function import in SAPUI5
…
this.oAppModel.callFunction("/DocumentIsValid", {
method: "GET",
success: fnSuccess,
error: fnError,
urlParameters: {
"DocArt": sDokar,
"DocStat": sDokst
}
});
…
The full error message is:
Assertion failed: EventProvider sap.ui.model.odata.v2.ODataModel: Function /DocumentIsValid not found in the metadata !
06. Troubleshooting
Many thanks und best regards
Cengiz
Request clarification before answering.
Hi together
The issue is fixed. The problem was using the wrong "this" initiation.
WRONG:
var that = this;
....
this.oAppModel.callFunction("/DocumentIsValid", {
...
}RIGHT:
var that = this;
....
that.oAppModel.callFunction("/DocumentIsValid", {
...
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.