AL icon indicating copy to clipboard operation
AL copied to clipboard

[Function Expose] Codeunit 5750 Whse.-Create Source Document

Open NAVRockClimber opened this issue 8 years ago • 9 comments

Can you please expose the function CreateShptLineFromSalesLine from Codeunit 5750 - Whse.-Create Source Document

[External] CreateShptLineFromSalesLine(WhseShptHeader : Record "Warehouse Shipment Header";SalesLine : Record "Sales Line";WhseShptLineQty : Decimal;WhseShptLineQtyBase : Decimal;AssembleToOrder : Boolean) : Boolean

Thank you very much.

NAVRockClimber avatar May 03 '18 14:05 NAVRockClimber

Hi @NAVRockClimber,

The asked function is a LOCAL function and can be accessed by the other External function called FromSalesLine2ShptLine. We encourage you do use the latter function.

Cheers, Dutta.

DuttaSoumya avatar May 04 '18 07:05 DuttaSoumya

Hi @DuttaSoumya,

I know that I can do this. But in our module we can do some advanced things in the warehouse area. Among other things we extended the whole quantities and date calculations in the warehouse area. Using your approach would mean I need to manipulate the fields "Whse. Outstanding Qty." and "Whse. Outstanding Qty. (Base)" on the SalesLine and passing it into the function "FromSalesLine2ShptLine" instead of just passing my values into the CreateShptLineFromSalesLine function. Sure, you're suggestion is an option. But it feels kind of dirty.

Cheers, Bert

NAVRockClimber avatar May 04 '18 13:05 NAVRockClimber

Hi @NAVRockClimber,

The function that I suggested calling calls the CreateShptLineFromSalesLine function only if there are warehouse outstanding quantities. The two fields you mentioned are actually calculated fields- which means that you cannot manipulate their values on the Sales Line record- rather they are dependent on the related content of the Warehouse Shipment Line table. And since you are dealing with advanced warehousing, I assume that these fields shall be filled in correctly without you having to do any manipulation prior to calling the function.

If that still does not suffice your requirements, consider copying over the function CreateShptLineFromSalesLine over to your extension.

Cheers.

DuttaSoumya avatar May 25 '18 07:05 DuttaSoumya

To copy an existing function over to an extension isn't a good way. Then you have to check with each cumulative update whether this function is changed and copy these changes again. That's not the idea of extensions.

IngoStender avatar May 29 '18 12:05 IngoStender

Since a workaround (that is, calling the function FromSalesLine2ShptLine) has been suggested and it is believed that this workaround should work fine with the right quantities filled in the Warehouse Shipment Line, this thread should be closed.

DuttaSoumya avatar Jun 10 '18 07:06 DuttaSoumya

I disagree. Workarounds are never a good solution and far from a clean solution. Also I do not see any hard reason for not publishing this function, except you simply don't like to.

NAVRockClimber avatar Jun 11 '18 08:06 NAVRockClimber

Hi,

We do not want to change local methods to global and external because it limits our options to make changes to these functions. Local methods are internal to our implementation and not part of the public API. We are working to make the application more extendible but these things take time. In the meantime, we do our best to help out by adding events, exposing certain functions and suggesting workarounds. Since in this case there is a workaround we choose to not expose the local function. If you have suggestions on how the feature should be refactored so it is extendible by design please do let us know.

br/Gert

grobyns avatar Jun 12 '18 08:06 grobyns

Hi @grobyns ,

I appreciate your open and honest answer very much. This answer is something I can live with.

I already gave to one of your guys a catalog of our biggest problems when I was at your office in November. We often need to go down to your core functions. This is where we actually struggle and it is not the parts we simply can request an event. It is the part where an event is not the cure. Like adding a parameter to one of your core functions.

In this special case you could see the suggested function as a kind of specialized function or helper functions. But this is not what we need in an API. We need access to the functions actually doing the work. We need to achieve what we want / need without bypassing something or manipulate something. Manipulating or duplicating code is always a potential error source.

br/ Bert

NAVRockClimber avatar Jun 12 '18 09:06 NAVRockClimber

I will close this issue. Please do keep sending feedback.

br/Gert

grobyns avatar Jun 12 '18 10:06 grobyns