cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori List Report Action: Passing Parameters via Annotation

I apologize if this is a basic question but I'm new to Fiori so I have been struggling with this for some time now. Is there a way to leverage annotations to pass parameters to an action that calls an import function? Can this only be done via code? If only in code, then where and how can this be done? It seems like a simple and common use case that I would think would have been handled via annotations but I certainly haven't figured out how to make that happen. Any help would be appreciated.

My use case is that I have an import function in my OData that has 2 import parameters, each of which shares a name of a field on my list report. I have added an action button to my Fiori List Report and, upon clicking the button, it creates the $batch request, but the body of the http request has only one call to the action and it shows no parameters no matter how many items I select from the list report.

Here is the list I'm using for my processing as well as the button for the action:

Upon clicking my button I get the following messages, which I assume is because of the missing parameters:

This is my HTTP Request Body:

Accepted Solutions (0)

Answers (3)

Answers (3)

Pavan_Golesar
Active Participant
0 Kudos

okay, Could you share the URL here?

0 Kudos

sap/opu/odata/sap/YDJK_TRANSPORTS_SRV/$batch

Inside the request data, there is a single call to Code Review attempted, but it sends no parameters and, no matter how many items I select on my screen, there is only ever the one call in the request data. The request data looks like this:

--batch_ba50-5a1e-7577

content-type: multipart/mixed; boundary=changeset_a4a3-8618-fe16

--changeset_a4a3-8618-fe16

content-type: application/http

content-transfer-encoding: binary

POST CodeReview HTTP/1.1

sap-contextid-accept: header

Accept: application/json

Accept-Language: en-US

DataServiceVersion: 2.0

MaxDataServiceVersion: 2.0

sap-cancel-on-close: true

x-csrf-token: mv8ixb7cCjJ3QAwIxOF6OQ==

Content-Type: application/json

--changeset_a4a3-8618-fe16--

--batch_ba50-5a1e-7577--

Incidentally, I was able to successfully get a button working using an extension and coding that differently. I've kept the button that was added via the annotation on there if anyone has any suggestions on how to get that working. It still seems like the annotation should handle it, otherwise why have the ability to annotate in a button at all?

Pavan_Golesar
Active Participant
0 Kudos

Hi david.kellogg

Lou Holtz - I never learn anything talking. I only learn...

Firstly, Don't let the errors let you believe that you are you are asking 'basic question' here on the SAP forum where there are others who might find it the same or not. Its okay to ask such question which are new. most welcome 🙂 WE all do! 😉

To your issue, As I understand that you are having a existing app which has action to post data in backend using function import.

#1. I assume in OData project you have implemented this method in DPC_EXT i.e. method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~EXECUTE_ACTION.

#2. I see in the screenshot that you are trying to hit POST method with entity set name..

In other words it should be changed to similiar to below:

/sap/opu/odata/sap/ZTEST_GW_SRV/CodeReviewFuncImport?CheckFlag=’X’ℜquestID=’0000000001′

Hope this helps, if not please share the URL which you are trying to hit:-)

Br,

Pavan Golesar

0 Kudos

#1: Yep, EXECUTE_ACTION is implemented and working well. I've been able to trigger it effectively from /IWFND/GW_CLIENT in both a single POST and a $batch with multiple items passed in. I was surprised to have gotten this far successfully in all honesty so it was a very valid question!

#2: The POST is calling the function CodeReview. The only entity set in my OData (for now) is a set called Transports....sorry for not having included that in my original screenshots. So the POST piece that is being generated by the Fiori app is as expected except that it's missing parameters. I'm reasonably sure I've messed up the annotations somehow but don't know where.

Here are what I think are the relevant annotations (some of which might be garbage as I have been messing with these a bunch trying to get something going):

There are additional annotations but are mostly just LineItem and Header definitions, but please let me know if you need to see more and I'll try to post whatever I can. I have had some issues getting screenshots into these posts.

Joseph_BERTHE
Active Contributor
0 Kudos

Hello,

The key of success is in the function import parameters. You have to have at least the entity key as parameter.

Example : if your main entity have OrderNum and Plant as keys you must have at least those two fields as input parameters in your function import. Then when you will click on the action, the system will provide to you all additional input parameters from your function import.

Regards,

Joseph

0 Kudos

I appreciate the speedy response, but this doesn't appear to be my issue. Please see the entity (Transport), having the keys sysid and trkorr and the Function Import having the same import parameters below.

Joseph_BERTHE
Active Contributor
0 Kudos

Hi,

Add one more input parameter e.g Toto type string and you should see the difference in the dialog box.

Regards,

Joseph

0 Kudos

Hi, Joseph.

I'm afraid there's no improvement with a new parameter either. Here you can see the new parameter in my metadata for the OData service:

Running the function again from the List Report gives the same errors (yellow and red popups with "Code Review" as their headings) and the error log still shows invalid Import Parameters, which makes sense since the body makes no attempt to send parameters to the function. Also, despite having 2 items selected in the list, we see the body only has one attempted call to CodeReview. Any other ideas what I'm doing wrong here?

Thanks!