WITH WhseShipLine DO BEGIN IF FIND THEN BEGIN Selection := STRMENU(Text000,2); IF Selection = 0 THEN EXIT; Ship := Selection IN [1,2]; Invoice := Selection IN [2]; END; WhsePostShipment.SetPostingSettings(Invoice); WhsePostShipment.SetPrint(TRUE); WhsePostShipment.RUN(WhseShipLine); WhsePostShipment.GetResultMessage; CLEAR(WhsePostShipment); // What is it for? END;
CLEAR(WhsePostShipment); // What is it for?
Comments
That's what CLEARALL is used for. I must admit, I don't fully understand the implication of this, though, unless you created a copy of the codunit variable before and reuse either of these afterwards.
And if your are calling more than one function of the codeunit depending on some data or process then you won't know when to call CLEARALL within the codeunit.
This might also be important:
What is single instance codeunit?
How many kind of codeunits are there? :-k
Andwian
Just single instance and non single instance (which is the most common)
Andwian
1. Create a codeunit and a report as the ones in the example
2. Run the report
3. Change the codeunit to SingleInstance
4. Run the report
5. Run the report again
6. Open a new database session (now you have two clients open)
7. Run the report again with the new session
Salut!
Laura Nicolàs
CODEUNIT
REPORT
Author of the book Implementing Dynamics NAV 2013
Cursos Dynamics NAV (spanish) : http://clipdynamics.com/ - A new lesson released every day.
Andwian