Skip to Content
Oct 14 at 07:31 AM

Error in calling an external REST API

51 Views Last edit Oct 14 at 07:43 AM 4 rev

Hi experts

i am working on a project which involves calling an external api using ABSL script in cloud application studio resulting in one or two fields being changed in a custom business object. but i have been running into some issues. so the scenario is when i press a button in my custom objects UI in bydesign, a request is triggered and using data in the request one or two fields are filled in the UI . The problem is i am running into some errors.

The api i am using is :

Here is the steps I followed:

import AP.Common.GDT as apCommonGDT;
businessobject Employees {

[Label("Employee Number")] element EmployeeNumber: LANGUAGEINDEPENDENT_EXTENDED_Text;

[Label ("Employee status")] element EmployeeStatus: LANGUAGEINDEPENDENT_EXTENDED_Text;
		action getStatus;}

1- Create a external webservice.

2- Create a communication scenario.

3- Create a communication arrangement. - check connection is successful

4- Create ABSL script file (Action-getStatus.absl) to call an api.

import ABSL;//Communication details
var ScenarioName ="DummyTest_SC";
var ServiceName ="DummyTest";
var HttpMethod ="GET";
var HttpResource ="";
var ContentType ="";
var Body ="";
var HeaderParameter : collectionof NameAndValue;//Set URL HeaderParameter
var HeaderParameterEntry : NameAndValue;
var URLParameter    : collectionof NameAndValue;
var URLParameterEntry : NameAndValue;
URLParameter.Add(URLParameterEntry);// Execute webservice call
var ws_result = WebServiceUtilities.ExecuteRESTService(ScenarioName, ServiceName, HttpMethod, HttpResource,  URLParameter, HeaderParameter, ContentType, Body);

this.EmployeeStatus = ws_result.Content;

when i click getStatus button here is the error message:

and here is the debugging result:

im not sure where im going wrong or what the issue is exactly but from what i can see the error " invalid importing parameter communication scenario name or service name" looks like the issue but when i check the ScenarioName/ServiceName in Script/Debugging it seems to be correct.

Any help would be appreciated also im new to SAP software and still learning so if my question seems unclear or anything seems to be missing then please let me know and i will add extra details where needed.

Thank you in advance for any help