Posting Rule

CodeUnit postline //////////////////////////////////////////////////////////////////////////// RunWithCheck(VAR RentalJnlLine2 : Record “Rental Journal Line”) //////////////////////////////////////////////////////////////////////////// RentalJnlLine.COPY(RentalJnlLine2); Code; RentalJnlLine2:= RentalJnlLine; Anyone can explain about the codes above?I am confuse. COPY and Assignment(:=). why first line use COPY and last line use assignment? RentalJnlLine2 is VAR, so why still use assignment on the last line of codes above? One question again, on the “Code” function,why we set Local property = “yes” ? Please help me…

the copy command copies the record including filter, whereby the assignment of one record into another record only copies the data and leaves the original set filters untouched. So the result is that RentalJnlLine has exactly the same filters applied as RentalJnlLine2. In the Code function the filters on the RentalJnlLine might be changed. But you do not want to change the filters of the RentalJnlLine2 when returning to the calling function. The Code function is defined as local so nobody can call it from outside the CU. The reason is that if you call it from outside the variable RentalJnlLine might not be set properly.

if I add code: RentalJnlLine.COPY(RentalJnlLine2); Count := RentalJnlline.count; Code; RentalJnlLine2:= RentalJnlLine; if in rental journal has 3 records, Count = 3, if rental journal has 4 records,Count = 4, so I think there is no filter on RentalJnlLine2. what filter should be copied from Rental Journal Form? :-k Sorry, I ask to much…but I want to understand it truely.

It WOULD copy the filters if there WOULD be any one. Imagine you are in a General Journal ynd you filter for a number of records, then you call the post function. YXou expect that only the visible records are getting posted. That is what COPY makes sure.