Skip to Content

How to display ODATA read Exception via callback

Hello All,

When I try to do a odata.read with the below code with right date and company code in the ODATA with the right path( PostingPeriodSet(Ccode='XXX',postdate='20201024') it works fine .

var oModel = that.getView().getModel();
oModel.read("/" + sObjectPath, {
                                        success: function(oData) {
						this.getView().byId("input0").bindElement({
							path: ("/" + sObjectPath),
							events: {}
						});
					},
					error: function(oError) {
						MessageToast.show("oError");
					}
				});

But when a wrong date is posted ODATA will raise an exception which I am not sure how to display it through call back function in the application .

Support would be of great help .

Exception : The Exception is raised as below

<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code>F5/201</code>
<message xml:lang="en">
Posting period is not open. Diagnosis Period of fiscal year is not open for posting for the variant of posting period . System Response Processing cannot be continued. Procedure The error can have several causes. In order to eliminate the error, proceed as follows: Check whether the posting date was entered correctly. The system determines the posting period by means of the date. Check whether the required posting period is open for posting for the variant of posting period and account type . Make sure that the period is open for posting. To do this, specify a period interval in which the required period for the variant of posting period and account type is contained. You make these settings in Customizing of Financial Accounting (New) under Financial Accounting Global Settings (New) -> Ledgers -> Fiscal Year and Posting Periods - > Posting Periods -> Open and Close Posting Periods.
</message>

<innererror>
<application>
<component_id/>
<service_namespace>/SAP/</service_namespace>
<service_id>ZMF_STD_JV_SRV</service_id>
<service_version>0001</service_version>

</application>


<transactionid>15A491832E480080E005D7A6F9661BDC</transactionid>
<timestamp>20191023132926.8153270</timestamp>
<Error_Resolution>
<SAP_Transaction>
For backend administrators: run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details
</SAP_Transaction>


<SAP_Note>
See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)
</SAP_Note>



</Error_Resolution>


<errordetails>
<errordetail>
<code>/IWBEP/CX_MGW_BUSI_EXCEPTION</code>
<message>Posting period is not open</message>
<propertyref/>
<severity>error</severity>
<target/>

</errordetail>



</errordetails>



</innererror>



</error>
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Oct 25, 2019 at 06:16 AM

    Hi Prasanna Kumar S,

    Try with the following code:

    error: function (oError) {
            var sErrMsg = "Error"				
    	if (oError.responseText) {
    		if (jQuery.sap.startsWith(oError.responseText, "{\"error\":")) 
                     {
    		sErrMsg = JSON.parse(oError.responseText).error.message.value;					
    		  }
    		MessageToast.show(sErrMsg);
    	}
    }

    Thanks,

    Vaibhav

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 24, 2019 at 07:56 AM

    Hi Prasanna Kumar S

    The below code is incorrect.

    MessageToast.show("oError");

    It will obviously will show the message "oError" as you placed that object inside the string and it will be treated as a string.

    So what can u do?

    As the oError is a object, Put a debugger there and see what's inside oError object and then show that message.

    Thanks,
    Mahesh

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.