on 10-27-2023 9:01 AM
Hello Experts,
We are trying to develop a wrapper kind of CAPM service for Sales Order Creation in CAPM. As we are basically trying to simplify the SO creation process, our service will be used in a much simpler version of 'Manage Sales Order Version 2' app. We are planning to develop it as a freestyle app as the requirements of our client are unique.
We are trying to call the same service used in the standard app, which is the below link
We are able to implement a Get service to retrieve SO details in our CAPM service but we are unable to figure out how to call the 'CreateWithSalesOrderType' action declared.
Please suggest if the approach of calling the service is recommended or any other approach we should be taking up.
Below is the original create call in the app 'Manage Sales Order Version 2'
Thanks,
Bhavyasri M
Hi,
Have you looked at the documentation for calling actions and functions. In the section titled "Programmatic usage via generic APIs would look like this for Node.js:" are examples for both bound and unbound functions for OData V4.
Thanks,
Katan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi katan_patel,
Thanks for pointing me to the proper documentation. I have now modified my code to call the backend action via send method.
But still the call is unable to invoke the backend action of my S/4 HANA service.
Below is the service call
/sap/opu/odata4/sap/c_salesordermanage_srv/srvd/sap/c_salesordermanage_sd/0001/$batch?sap-client=400
SalesOrderManage/com.sap.gateway.srvd.c_salesordermanage_sd.v0001.CreateWithSalesOrderType/
This is the uri of the action getting triggered. In original service, the action is configured via the backend annotations.I've now tried below ways to invoke the action but none of them are working.
const sosrv = await cds.connect.to('c_salesordermanage_srv');
//not working const SalesOrderResponse = await sosrv.run('SalesOrderManage/com.sap.gateway.srvd.c_salesordermanage_sd.v0001.CreateWithSalesOrderType', [OrderData]); //{"sampleresp": "Test"};
////not working const SalesOrderResponse = await sosrv.CreateWithSalesOrderType('SalesOrderManage', OrderData);
//not working const SalesOrderResponse = await sosrv.send('SalesOrderManage/com.sap.gateway.srvd.c_salesordermanage_sd.v0001.CreateWithSalesOrderType', req.data.Order );
Also not sure if I need to declare the action in .cds file as we do for entities..
Please suggest if you can think of something I've wrongly configured or accessing it wrong.
Thanks,
Bhavyasri M
User | Count |
---|---|
72 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.