Skip to Content
0
Jun 02, 2020 at 03:44 PM

SAP CAP ACTION returns no data

1276 Views

Hi All,

I have created an action in SAP CAP service. It should return a JSON string, but instead it is returning 204 No Content.

The steps are as follows:

  1. Defined an action
action wfDetails (wfRequestId : String) returns String;
//A side question here. Is there a JSON return type. As the response is a huge custom JSON with many
// deep levels, creating an Entity definition can be difficult

2. Created a custom handler for the action

srv.on('wfDetails', async (req) => {
    	var wfRequestId = req.data.wfRequestId;    	
    	var response =  await getUserWFdetails(wfRequestId);
    	return response;
    });

3. The "getUserWFdetails" function called above calls 3rd party apis asynchronously and returns a JSON string, but before it can be send back the response, I get 204 no content from service:

When I just return hard-coded string, it is sending, but the JSON output is not being returned. FYI, I have logged the JSON in console and am getting the right JSON string, but it is not being returned.

Where am I going wrong? Can anyone help with this issue?

Thanks in advance,
Harish

Attachments

204-no-content.png (64.9 kB)