cancel
Showing results for 
Search instead for 
Did you mean: 

Invoking InboudDelivery service API issue

zje8szh
Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member186608
Active Participant
0 Kudos

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.

zje8szh
Participant
0 Kudos

Thank you for your response.

Could you specify how to do it with SAP Cloud SDK?

Answers (3)

Answers (3)

former_member186608
Active Participant
0 Kudos

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.

zje8szh
Participant
0 Kudos

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.

former_member186608
Active Participant
0 Kudos

What does the gateway error log say?

zje8szh
Participant
0 Kudos

It is the same error.

First I get the etag from inbound delivery 180001333. The etag is W/"'0004'".

Then I set the etag in the header.

I really do not know what happened.

former_member186608
Active Participant
0 Kudos

Pls check the Javadoc and look for the method withCustomHttpHeader.

zje8szh
Participant
0 Kudos

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;
    }

zje8szh
Participant
0 Kudos

Http response