on 06-26-2019 1:39 PM
Dear experts,
I am calling InboudDelivery APIs using SAP Cloud SDK but met with two issues.
1. Create InboundDelivery error
Error message:
"Creating operations are disabled for entity \u0027API_INBOUND_DELIVERY_0002~A_InbDeliveryHeader\u0027"
Seems I need to enable create operation but I do not know how to.
2. Call Post Good Receipt function error
"errordetails": [
{
"code": "/IWBEP/CX_MGW_BUSI_EXCEPTION",
"message": "Precondition required",
"longtext_url": "/sap/opu/odata/iwbep/message_text;o\u003dLOCAL/T100_longtexts(MSGID\u003d\u0027%2FIWBEP%2FCM_MGW_RT\u0027,MSGNO\u003d\u0027194\u0027,MESSAGE_V1\u003d\u0027\u0027,MESSAGE_V2\u003d\u0027\u0027,MESSAGE_V3\u003d\u0027\u0027,MESSAGE_V4\u003d\u0027\u0027)/$value",
"propertyref": "",
"severity": "error",
"target": ""
}
]
The code is as below.
@Override
public List<PutawayReport> goodsReceipt(String deliveryDocument) throws Exception {
List<PutawayReport> putawayReports = inboundDeliveryService.postGoodsReceipt(deliveryDocument)
.execute(ErpConfigUtil.getErpConfig());
return putawayReports;
}
Could you give me some advice on these two issues?
Thanks
Jerry
Dear Jerry,
regarding the second point:
You have to pass the If-Match header manually. Either you force overwrite by using "*" as a value or you retrieve the etag of the entity beforehand. This requires knowledge about the service and its entity model.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Pls fetch the etag from the existing entity from your machine with postman.
I suspect the etag you provided has a wrong format. I want to see the format that S/4HANA gives you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you.
Finally I fixed this problem by adding a zero prefix to the delivery document.
Wrong parameter:
/sap/opu/odata/sap/API_INBOUND_DELIVERY_SRV;v=2/PostGoodsReceipt?DeliveryDocument='180001334'
Correct parameter:
/sap/opu/odata/sap/API_INBOUND_DELIVERY_SRV;v=2/PostGoodsReceipt?DeliveryDocument='0180001334'
Root cause:
If delivery document number is not matching, it would not get etag info from database so the validation is failed.
What does the gateway error log say?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Pls check the Javadoc and look for the method withCustomHttpHeader.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes. I found the API and tested it but now the error is "Precondition failed" and HTTP error code is 412.
Both "*" and etag value from inbounddelivery entity for If-Match request header are not working. I also checked the ETAG using SAP Gateway client and etag value is W/"'002'". I think the etag value is correct in the header. Why validation is failed?
@Override
public List<PutawayReport> goodsReceipt(String deliveryDocument) throws Exception {
InbDeliveryHeader inbDeliveryHeader = inboundDeliveryService.getInbDeliveryHeaderByKey(deliveryDocument).execute();
logger.info(inbDeliveryHeader.getDeliveryDocument());
//Map<String, String> map = new HashMap<>();
//map.put("If-Match", inbDeliveryHeader.getVersionIdentifier().get());
List<PutawayReport> putawayReports = inboundDeliveryService.postGoodsReceipt(inbDeliveryHeader.getDeliveryDocument())
.withCustomHttpHeader("If-Match", inbDeliveryHeader.getVersionIdentifier().get())
//.withCustomHttpHeaders(map)
//.onRequestOnly()
.onRequestAndImplicitRequests()
.execute(ErpConfigUtil.getErpConfig());
return putawayReports;
}
User | Count |
---|---|
77 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
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.