Copy A Sales Order and Edit Original and Copy using AL

markclemarkcle Member Posts: 65
Hi All

Fairly new to Dynamics 365 BC. Written a few small AL extensions (adding a few fields, custom reports and queries.

I need to write a function that will copy a sales order with and all lines where qty to ship is > 0 (think of it like releasing from a blanket). The sales person will fill out Qty to ship on each line and then go to Action in ribbon and select "Copy Order Lines" ( I could do it from a new sales order (they would enter the source order) if it simplifies things a lot

The copy should have identical header, and each line where qty to ship was > 0. The copied lines qty will be the qty to ship. I then need to decrement the qty to ship from the original order

SO if I have the following

Line qty qty to ship
1 1000 100
2 2000 0
3 3000 300


The new line order should have

Line qty qty to ship
1 100 100
3 2700 2700

The old order should have

Line qty qty to ship
1 900 0
2 2000 0
3 2700 0

Could do it easily in SQL, but want to use the correct method. I read the old design pattern for copydocs, but it's all C/SIDE

I know about code unit 6620, but have never worked with code units.

I read a bit about Copy and TransferItems, and it seems Copy is way to go (as AFAIK, TransferItems is generally used for tranferring items between disimilar docs (e.g. order to shipment or order to invoice)

Can anyone point me in the right direction?

Thanks

Mark

Answers

  • krikikriki Member, Moderator Posts: 9,115
    [Topic moved from 'NAV Tips & Tricks' forum to 'NAV Three Tier' forum]

    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.