Hey
iam new in microsoft dynamics nav and need help by developing in C/AL.
I want to create a purchase quote with the requisition worksheet.
This function does not exist in ms dynamics nav.
So how can i get the requisition line data from the requisition worksheet to a new purchase quote???
This is a cut out from ma source code, which create an new purchase quote with the last free data record.
// ++ START
PurchaseHeader.SETRANGE("No.",'1000');
IF PurchaseHeader.FIND('-') THEN
REPEAT
UNTIL PurchaseHeader.NEXT(+1)=0;
PurchaseHeader.INSERT(TRUE);
PurchaseQuote.RUN;
// --END
I would be grateful for an answer.
0
Answers
Check the coding and you can try by changing Document type from Order to Quote..
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Check out the code on the report 493 (Carry Out Action Msg. - Req.)
It probably leads you to CU 333 (Req. Wksh.-Make Order).
If you are going to make changes, once you figure out how it's determining the "Document Type" - you probably would be better off making an option from the report where the user can choose between "Order" & "Quote". that way you don't lose the original functionality but adding to it.
http://www.BiloBeauty.com
http://www.autismspeaks.org
Thanks for your help, it was a good idea.
i changed the document type from Order to Quote and got quotes instead of orders as result.
yes you´re right, a better solution is making an option to choose between both, but i dont know exactly how to make it.
I made a new Page Action in the Requisition Worksheet 291 which is called "Create Quotes". My Question is how can i use the CodeUnit 333 for example if i press the button?
[/color]
If CU333, you have use this boolean to create Document type like
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
thanks for your help,
I followed your instructions, but i got quotes only.
it is all the same whether the check box is active or not.
i changed two entries in the UC 333
from
PurchOrderHeader."Document Type" := PurchOrderHeader."Document Type"::Quote;
into
PurchOrderHeader."Document Type" := DocumentType; //Create Quote001
"DocumentType" is defined as an integer.
have you an advice for me?
Mohana mentions "IF" cu 333.
So based upon your first quote, can you tell use where you made the change so that you were getting quotes instead of orders?
http://www.BiloBeauty.com
http://www.autismspeaks.org
okay, here Step by step.
1) First of all i added a new global variable "CreateQuotes" as boolean.
2) i designed the report 493 (carry out action msg.) in request page and added a new group named "quotes" a new field "CreateQuotes"
with SourceExpr "CreateQuotes".
3) i designed the CU 333 (Req. Wksh.-Make Order) and create a new function "setCreateQuotes" in C/AL Globals.
4) i changed into C/AL from the CU 333 and the function "setCreateQuotes" is filled with the following code:
// ++Create Quote001
IF CreateQuotes THEN
DocumentType := PurchOrderHeader."Document Type"::Quote
ELSE
DocumentType := PurchOrderHeader."Document Type"::Order;
// --Create Quote001
5) DocumentType is unkown so i declared it as an integer.
6) In the Function "insertHeader" i changed the entry
PurchOrderHeader."Document Type" := PurchOrderHeader."Document Type"::Order;
into
PurchOrderHeader."Document Type" := DocumentType;
7) In the Funcion "InsertPurchOrderLine i changed the entry
PurchOrderHeader."Document Type" := PurchOrderHeader."Document Type"::Order;
into
PurchOrderHeader."Document Type" := DocumentType;
8) i used the "requistion worksheet", clicked the "carry out action message" and press OK so i got Quotes instead of Orders, all the same whether the check box was clicked or not.
Did i made a mistake?
thats all.
You can test it by adding to CU333
OnRun(VAR Rec : Record "Requisition Line")
IF CONFIRM('Make Quote?',TRUE) THEN
DocumentType := 0
ELSE DocumentType := 1;
InsertPurchOrderLine(VAR ReqLine2 : Record "Requisition Line";VAR PurchOrderHeader : Record "Purchase Header")
PurchOrderLine."Document Type" := DocumentType;
InsertHeader(VAR ReqLine2 : Record "Requisition Line")
PurchOrderHeader."Document Type" := DocumentType;
Then you know it working. I assume you want a checkbox or 2 RadioButtons (Make Order) (Make Quote) on the request form of the Carry Out Action Msg. - Req. report. Where you pass the values to the CU.
http://www.BiloBeauty.com
http://www.autismspeaks.org
Hi, thanks for your answer. i followed your instructions and added in function "OnRun(VAR Rec : Record "Requisition Line")" the following code:
IF CONFIRM('Create Quotes',TRUE) THEN //CreateQuotes001
DocumentType := 0
ELSE DocumentType := 1;
--> "Create Quotes" is my check box from the report "Carry Out Action Msg. - Req." but its the same problem.
the variable is not being passed from the report to the CU.
Call this function after
ReqWkshMakeOrders.Set(PurchOrderHeader,EndOrderDate,PrintOrders);
in report 493 by passing the newly added boolean field..
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
i am sorry but i dont know exactly what you mean.
you´ve said create new function with parameter "boolean", or did you mean create a variable.......?
please step-by-step. what i have to do next?
thank you for your help
http://www.BiloBeauty.com
http://www.autismspeaks.org
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav