I need to open new document form with filled values.
I did something like below but it creates documents and writes it. Without Doc.Write() it doesn't work (values are not filled as I want). Could you tell me how I can do the same to open document form with filled values (Warehouse, Date etc and ItemsLines) but not written yet?
Procedure OpenFormGoodsIssue() Doc = CreateNewGoodsIssueDocument(Parameters.Zlecenie,"Magazyn"); FullDocumentFormName = "Document.GoodsIssue.ObjectForm"; Param = New Structure("Key",Doc); OpenForm(FullDocumentFormName,Param,ThisForm,,,,,); EndProcedure Function CreateNewGoodsIssueDocument( Query = New Query; Query.Text = query text here... Selection = Query.Execute().Select(); Doc = Documents.GoodsIssue.CreateDocument(); Doc.Warehouse=Catalogs.Warehouses.FindByDescription(WarehouseDescription); Doc.OperationType = Enums.OperationTypesGoodsIssue.Usage; Doc.ZlecenieNaprawy = ZlecenieNaprawy; Doc.Date = CurrentDate(); While Selection.Next() Do NewLine = Doc.ItemsLines.Add(); NewLine.Item = Selection.Item; NewLine.UnitOfMeasure = Selection.Item.BaseUnitOfMeasure; NewLine.Quantity = Selection.QuantityBalance; EndDo; Doc.Write(); Return Doc.Ref; EndFunction
Thank you in advance for any help!