Hi, I’m a newb so bear with me. I have been certified dev 1/2 fin 1/2 and sql so I have a good heads up I just write most of my code in web based languages and vb.
That aside here is my simple problem. BTW I have searched and research to no avail.
I have a form that is used with touch screens (big buttons and texts) which is simply filtering and color coding the purchase order lines table data. That’s all the form displays, it’s the same form as Purchase Order Lines.
The shop guys update the qty's to receive. They also update total qty when > than qty to receive.
When doing this (as we always release our documents) they will need to update / release and reopen the purchase document from one button. The recursion required for this I can handle. Its passing finding and passing the Purchase Header Rec from my Purchase Lines to code unit 415-Release Purchase Document that has me confused.
I have looked into the Release Purchase Document Code Unit (415) and can see the two functions which require you to pass Rec and a parameter. This is fin except i have now broken two keyboards in half over this error i get often. Variable must belong to 38 not 0 or if I change variables I get must belong to 38 and not 39.
I know I am failing to program the Rec correctly. I don’t know how to tell the push action or the code (ReleasePurchDoc.PerformManualRelease(Rec);) that Rec is the document number from the currently selected line.
Please any help would do.
Thank you...
0
Comments
Rec is the record variable and not the document number
http://ssdynamics.co.in
RIS Plus, LLC
MVP - Business Apps
1. The SETSELECTIONFILTER function (see the Help file)
2. Create a new Purchase Line record variable and set ranges and filters on it so it gets you the current record
I have in my Dev books, online help, dynamics user, dynamics partner source and here looked for information and can not find it.
Simple View
Purchase order lines form, design and save it as something else.
Now goto the purchase order, design and take this code and setup variables;
You will get somethine like this (ReleasePurchDoc.PerformManualRelease(Rec);).
Now go back to your Purchase Order Lines form and create a button, setup variables, add code.
See below for a clear cut example of what i am trying todo and the area where I am experiancing a problem in defining rec for the header table.
(BWT I know about Table := Rec;, does not work. Rec inherited by form)
Rec is now = Rec for purchase lines, duh know this.
{
Example Code
ON PUSH()
?¿¿? MISSING CODE TO DEFINE REC FOR OR FROM PURCHASE HEADER!!! ¿??¿
PoNum := Rec."Document No."
SETRANGE(PurchaseHeader."No.", "PoNum");
IF (PurchaseHeader.Status = PurchaseHeader.Status::Released) THEN BEGIN
ReleasePurchDoc.PerformManualRelease(Rec);
END;
IF (PurchaseHeader.Status = PurchaseHeader.Status::Open) THEN BEGIN
ReleasePurchDoc.PerformManualOpen(Rec);
END;
}
So I’m sure this is an easy thing I just lack experience and am having a lot of trouble finding answers on my own.
I am running my code from a from thats source table is Purchase Order Lines. So my Rec is related to purchase order lines.
I need to use Code Unit 415 - Release Purchase Document to allow a button to change the status. I have to pass the function the Rec. This is the problem. Rec = Purchase Order Lines not Purchase Header.
How can I pass Rec to the functions within Code Unit 415 - Release Purchase Document when current Rec is Purchase Order Lines. How do I pass the code unit's function Rec from the Purchase Lines when the code unit requires Rec from the header?
So all sarcasm aside (all in good jest on my part)
Create a record variable based on the purchase header table, for instance "PurchaseHeader". The Purchase Line's primary key is (Document Type, Document Number, Line Number), and the first two fields are the primary key of the purchase header table. So, you can do: And that will retrieve the header that belongs to the line.
Now lucky for you, the Purchase Line table has a function called "GetPurchHeader", which retrieves the header record for you, and stores it into the PurchHeader variable. So, you could even call that function right from your form, and pass the purchase header variable into the function.
RIS Plus, LLC
MVP - Business Apps
Just be aware which record is actually stored in Rec, which is always the record that the user's cursor is currently on. In a Card form it's the record currently displayed, and in a list form it's the record that has the little triangle or asterisk next to it. You don't need to retrieve it from the database, because the form already did that for you.
RIS Plus, LLC
MVP - Business Apps
No need to re-invent the wheel. The goal is to get really good at knowing where to steal code snippets from the standard application
RIS Plus, LLC
MVP - Business Apps