Please note that this post was first published at https://medium.com/@yagubovafatima/enhancement-for-fiori-finding-the-places-for-enhancement-getting-....
I am working as a SAP ABAP Developer in a Consulting company and during the worktime we face different kind of problems especially in adding custom functionalties to SAP standards. In this blog, I am going to explain one these problems and its solution.
The problem: The customer wants to get an error message in Fiori if the document is once canceled you cannot cancel again the same document after reversing.
The purpose of this blog, finding points for enhancement and a solution for getting an error message in Fiori. (database: s4hana)
Launch Fiori from SAP GUI using /N/UI2/FLP t-code. Search for the application Material Documents Overview and click it. Then write the material document number and click to Go. We will see the screen below. In Posting date box write the earlier date and choose the item and finally click OK.
1.
We will get the error message:
2.
Clarifying the problem: the customer wants in this page the error message with the text ‘You cannot cancel the document canceled before!’ before getting the error shown in the picture.
So, how to do it?
We understand that we have to enhance for getting custom error in Fiori application. And where to enhance and how to find the places for enhancement — these are our next questions.
Firstly, we have to find where all data is collected (selected). For finding it we have to know its OData Service. There are 2 ways:
1. https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer/ — go to the link, click:
All apps -> Search application name (in our example: Material Documents Overview) -> click the application name -> Implementation information -> Configuration — on this page, we can find OData Service name.
3.
2. In Fiori open the application, Press F12 (opening the inspection of the website). Open Network tab and try to reverse the document. And click OK for reversing the document. In Network tab find the row with the name ‘batch’. In this file, we’ll find OData service name.
4.
Okay, we found the OData service name. The next step is explained below.
In SAP GUI, open t-code /n/iwfnd/maint_service. Here we’ll see the services list. Click find icon and paste the web service name. Find and click on the web service name and right below click Service Implementation button.
5.
This screen will appear:
6.
Then double-click on Data Provider class and it redirects us Class Builder page. On this page, we’ll see the methods of a class. Some of these methods are blue and some of them are black. If we set a breakpoint for each of them (of course external breakpoint) and launch the application to reverse the document we’ll see that the application redirects us to methods colored black. So, it means we can enhance into these methods. While debugging the methods we see the method with the name *cancellation*.
7.
Double-click on the name of the method. And there we are! Here we’re going to enhance.
According to our experience with an error message in this method which has type ‘E’, this error message breaks the connection and directly closes the Fiori application. So that’s why we cannot write the error message in this method. But we have to keep in mind that we can only access this section of code when we run the application from Fiori. If we run migo it won’t be redirected to this section. So where do we have to write this error message then? For finding it we continue debugging.
There is an idea that we can write this error message where the Posting date error is written.
Run the migo -> Enter the document number -> Click to Item OK -> Check — we’ll get the same error message about the posting date that we’d got in Fiori application. Click the long text of the error message and copy message no.
Then return to the method for cancellation and set the external breakpoint. Open Fiori application and try to reverse it. It will redirect us to SAP GUI debug screen.
8.
Set the breakpoint at the message. Enter the message details:
9.
And we continue debugging.
10.
Here, we found that error message. It means we can implement the error message here (in this form). Take the program name, form name, and find it in se80.
11.
Firstly, back to the screen shown in the 7th picture, and double-click on the cancellation method. And enhance here. We have to know that it comes from Fiori application. (only through Fiori we are redirecting here).
12.
So we used memory here for exporting data that provide us with the data that request comes from Fiori application.
Then in include FM07MEW0, in form werk_pruefen or inside werk_prufen — in form werk_lesen we can write error message:
13.
Time to test. Go to Fiori application and try to reverse the document.
14.
Here you are, the problem is solved.
Conclusion: one of the ways to find enhancement points for the custom error message is to find places of the standard error message. Just we should be careful when we have the same codes for the standard t-code and Fiori application. Another takeaway: while searching the enhancement points we have to develop your debugging skills because at any level we have to know how to debug according to our problem.
In my next blog, you will find another way to debug and solution for the custom error message in standard t-code. I'd like to know your thoughts about the blog and the topic.
P.S. All of the pictures in this blog have taken by me from our demo system.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
14 | |
10 | |
7 | |
7 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 |