cancel
Showing results for 
Search instead for 
Did you mean: 

Java Script exit method on XSA using Batch requests.

Former Member

Hello.

I have an issue regarding the JS exit method on XSA. Here are the detailed steps whichi have done.

First of all, I have a CDS view with a simple entity:

entity BusinessPartner {  
     key BusinessPartnerID: Integer; 
     isCustomer: hana.TINYINT;
     Name: String(100);   
     isSupplier: hana.TINYINT;
}

Then, a simple odata service:

service namespace "SUPPLY_CHAIN_TRACKING"{  
   "poc_scm.db.data::SupplyChainTracking.BusinessPartner"                        as "BusinessPartnerSet" 
} 

At this moment, everything is perfect.

In the next step, I want to use a JS function exit on entity creation, so, I created a businessPartnerCreateMethod.xsjslib file, and on that file I have a createMethod with some insert logic.

The next step is to change the odata service declaration:

service namespace "SUPPLY_CHAIN_TRACKING"{  
   "poc_scm.db.data::SupplyChainTracking.BusinessPartner"                        as "BusinessPartnerSet"  
create using"xsjs:businessPartnerCreateMethod.xsjslib::createMethod"; }

When I do a simple POST request, everything is working. The create method is called, everything is ok.

The problem comes, when I do the Batch request. On Batch request, the error message says:

{"error":{"code":500,"message":{"lang":"en-US","value":"context.functionExecutor is not a function"}}} (It works for a simple POST request!)

Any help will be appreciated. Thank you.

P.S If someone need more information, I can provide it.

0 Kudos

Hi Alex, did you find a solution by any chance?

Former Member
0 Kudos

Hi Neha. Unfortunately not.

0 Kudos

I managed to run it with a single request and the workaround was to turn the batch request mode off in the SAPUI5 app. But I don't know the way to fix it while using the batch mode.

oModel.setUseBatch(false);
oModel.submitChanges();

Accepted Solutions (1)

Accepted Solutions (1)

christianlechne
Active Contributor
0 Kudos

Hi Alexandru,

the issue should be solved with SAP note 2421178

Best regards,

Christian

Answers (0)