Skip to Content

SAP SDK for javascript Post Goods issue function Call

How do I format a Post Goods Issue function call using SAP Cloud SDK for javascript? The following returns error: "Invalid Function Import Parameter 'OutboundDeliveryOrder'. I get the exact same error whether or not I pass the obj. This makes me think I'm not passing the function input parameters correctly but I cannot find any code examples on how it's meant to be done.

var dh = require("@sap/cloud-sdk-vdm-warehouse-outbound-delivery-order-service"); //"^1.9.2"
var obj = {"OutboundDeliveryOrder": MovementId};

var destination = await cfDestinations.readTenant(constants.endpoint.S4Endpoint, req);
S4Destination = {
   url: destination.url,
   authentication: destination.authType,
   username: destination.user,
   password: destination.password
};
		
dh.postGoodsIssue(obj)	
.execute(S4Destination)
.then((response) => {
   return res.status(200).send(response);
})
.catch(function (err) {
   return res.status(400).send(err);
});


edit: including the vdm documentation link: https://help.sap.com/doc/69202ef7e0a64767833782132648b855/1.0/en-US/modules/_sap_cloud_sdk_vdm_warehouse_outbound_delivery_order_service.html

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Jul 31, 2020 at 03:02 PM

    Austin Kloske ,

    I see that your API module is pretty outdated. Is there a reason to use 1.9.2 instead of 1.19.0 as available on npmjs?

    I asked someone from the team to take a look, but the outdated VDM might be a reason for failure.

    You can find more examples on OData use-cases in our official docs that are usually quickly updated: https://sap.github.io/cloud-sdk/docs/js/features/odata/use-typed-odata-client-for-javascript-and-typescript

    I also recommend updating to the latest core in your dependencies: https://sap.github.io/cloud-sdk/docs/js/api-reference-js-ts/

    Let me know if it helps.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 31, 2020 at 03:13 PM

    Hi Austin Kloske,

    thanks for reaching us.

    I assume there is a typo in the line 2 regarding the version of the vdm that you are using, since the version 1.9.2 is too old. I guess you are using 1.19.2?

    Also, the documentation link is about the version 1.18.0, so here is the link for version 1.19.2.

    The documentation says, the signature of the function you used is

    postGoodsIssue(parameters: PostGoodsIssueParameters)

    This link shows, you need a string property "outboundDeliveryOrder" to meet the interface "PostGoodsIssueParameters". (not sure the date type of "MovementId" that you used)

    Therefore, below is an example as a valid parameter:

    var obj = {outboundDeliveryOrder:'abc'};

    Generally, I would always provide the whole stack trace for understanding your issue better instead of one line of error message.

    Please let me know, whether it helps.

    Best regards,

    Junjie

    Add a comment
    10|10000 characters needed characters exceeded

    • I updated the version of sdk to 1.19.0 and 1.19.2 + made the corresponding code changes. The original error continues. It is strange the error says:"Invalid Function Import Parameter 'OutboundDeliveryOrder' (Capital 'O') even when i pass:

      var obj ={outboundDeliveryOrder:'abc'};

      i've also tried, passing "outboundDeliveryOrder", OutboundDeliveryOrder and "OutboundDeliveryOrder with no luck...

  • Posted on Aug 03, 2020 at 10:06 AM

    Thank you all, I was able to overcome the error with a few of these suggested updates:

    It ended up looking like this:

    "@sap-cloud-sdk/core": "1.25.0",
    "@sap/cloud-sdk-vdm-outbound-delivery-v2-service": "1.19.2",
     "@sap/cloud-sdk-vdm-warehouse-outbound-delivery-order-service": "1.19.2",
    
    var dh = require("@sap/cloud-sdk-vdm-warehouse-outbound-delivery-order-service");
    var obj = { outboundDeliveryOrder: response.data.MovementId };
    		
    dh.postGoodsIssue(obj)	
    .execute(S4Destination)
    .then((response) => {
       return res.status(200).send(response);
    })
    .catch(function (err) {
       return res.status(400).send(err);
    });
    

    When I am returned valid errors from sap, it is not human understandable or even returned in a format that can be parsed into an object for error handling (screenshot below). All I think I can do for my users is ask them to log into SAP to evaluate pgi-errors. Is there a better alternative?


    pgi-error.png (977.9 kB)
    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Austin Kloske ,

      the SAP Cloud SDK keeps the whole stack trace of the error messages from the remote system (s4 hana in your case).

      Therefore, the application developer should decide how to show the error based on the user experience design.

      Typically, you find error messages from:

      • the frontend UI (normal user)
      • the application log on the cloud (IT admin/application developer)
      • log on the server side, which is the s4 hana log in your case (IT admin/application developer)

      To investigate an error, you always need detailed information, I guess it makes sense to check either the log on the cloud or from the s4 system. However, as an end user, you just need the e.g., the following information for reporting it so that the IT admin/application developer can navigate to a specific line of error in the log.

      • error name (in your case Invalid Function Import Parameter 'OutboundDeliveryOrder') or maybe some nicer name that the application developer can decide.
      • timestamp

      I hope it answers your question.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.