The 1C:Enterprise developers forum
Namaste!I'm trying to create a Data processor to clear posting for a set of documents. Can you help me on how to programmatically clear posting?
I write script for DocumentSelection. So you need use your set of documents
DocSelection = Documents.Document1.Select(); While DocSelection.Next() Do DocSelection.GetObject().Write(DocumentWriteMode.UndoPosting); EndDo;
ivan avdonin, thank you!And what if I need to clear posting not for all documents, but starting from some date?
For this make query to Documents
Query = New Query; Query.Text = " |SELECT | Document1.Ref |FROM | Document.Document1 AS Document1 |WHERE | Document1.Date > &Date"; Query.SetParameter("Date", SomeDate); DocSelection = Query.Execute().Choose(); While DocSelection.Next() Do DocSelection.Ref.GetObject().Write(DocumentWriteMode.UndoPosting); EndDo;
Thank you again! You did a great job!