Skip to Content

How to access the ID of a PurchaseOrder before saving it?

Dear community,

I need to implement a REST call to an external system passing through some data of PurchaseOrders.

The PurchaseOrders are part of a third-party process and created automatically by ByD from released SalesOrders.

The PurchaseOrders are created and automatically sent by ByD and afterwards saved by the system. The problem I'm facing is that at the time of the calls to AfterModify and BeforeSave, the ID field of the PO is not yet set.

Is there a way to get the ID in the AfterModify or BeforeSave before the PO is saved for the first time?

The only possible solution I came up with is to use internal communication to create an object. This message would be sent after the save and with the ID of the PO. Is another way to do it?

Thanks for your help and best regards,


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    Sep 12, 2014 at 12:03 PM


    the ID will be generated only after the first save. Only the uuid is available before.

    You can create a MDR in order to process the created sales orders after the initial save.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 16, 2014 at 04:20 PM

    Hello Georg,

    I do not know if you can implement this in a REST call, but you can access data which is not yet stored in the database with the Retrieve() function.

    A query only queries what is saved in the database, so after the Save is done.

    However, with the Retrieve(), you can find a Purchase Order with its ID, for example, before the Save is done.

    I often use this function myself in Before-Save events. The after modify shouldn't be a problem as the instance already exists if you can modify it.

    I hope this can help you!

    Best regards!

    Have a nice day.


    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 17, 2014 at 07:31 AM


    Try with Number ranges, There are Function Modules available to get the next available PO Number

    Add comment
    10|10000 characters needed characters exceeded