on 2024 Jan 09 4:57 PM
Dear all,
I have a RAP application created in On-Premise S4 system. It contains a bound action called 'Simulation' without any parameters. The entity name is 'PostingHeader'.The RAP service is exposed as oData V4 service to the external applications.
In the NodeJS based CAPM, i am trying to call this action but not able to succeed.
1. The action is present in the metadata (.csn) file of the service in the CAPM application. However, it has parameter (name: _it ). Not sure why and how did it come there
image.png
2. I tried to call the same using various techniques but getting error everytime
const externalService = await cds.connect.to('SIECUI_I_CIC');
const actionParams = {};
const actionData = {
CompanyCode: '3006',
FiscalYear: '2023',
AccountingDocument: '3000000000'
};
//ABAP Trace doesn't give anything
/* const response = await SIECUI_I_CIC.Simulation(actionData, 'xSIECxC_CIC_POSTHEADER');
console.log('response', response); */
//ABAP Trace gives something --
// const responde3 = await externalService.send({ event: action, entity: 'xSIECxC_CIC_POSTHEADER', data: actionData, params: { _it: req } });
await cds.tx(async (tx) => {
const actionResponse = await externalService.tx(tx).run(
externalService.Simulation(actionData)
);
console.log(actionResponse);
});
//ABAP Trace gives something -- Solution 3-1
/* const response = await SIECUI_I_CIC.Simulation({entity: 'xSIECxC_CIC_POSTHEADER'});
console.log('response', response); */
//ABAP Trace gives something -- Solution 4
/* SIECUI_I_CIC.send('READ', 'xSIECxC_CIC_POSTHEADER', async (request) => {
const result = await SIECUI_I_CIC.tx(request).run('Simulation');
console.log(result);
return result;
}); */
//ABAP Trace doesn't give anything -- No Solution
/* const response2 = SIECUI_I_CIC.send('Simulation', actionData);
console.log('response', response2); */
//ABAP Trace gives something -- Solution 5
/* const result = await SIECUI_I_CIC.tx({runHeader_ID: req}).run('Simulation');
console.log('result', result); */
//ABAP Trace doesn't give anything -- No Solution
/* await cds.tx(async (tx) => {
const response = await SIECUI_I_CIC.tx(tx).run(SIECUI_I_CIC.Simulation());
console.log(response);
}); */
Can some one help?
Br
Nilesh
Refer to calling functions in CAP documentation.
You mention that the bound action 'Simulation' is without any parameters. But in the code, sometimes, there are parameters actionData in the call.
let postingHeader = { id: '....'} // assume id is the key for PostingHeader
await srv.send({ event: 'Simulation', entity: 'PostingHeader', data: actionData, params: postingHeader })
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
11 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.