Hello everyone.
I would like to get data from the ListPart "Sales Invoice Subform".
What I want to do is to get the data and put it in an xml.
I have the following code.
I hope you can help me, thanks.
codeunit 50901 "XMLtestSUBFORM" { procedure XMLv4(RecordCurr: Record "Sales Header") var v_XMLDoc: XmlDocument; v_XMLDec: XmlDeclaration; v_RootNode: XmlElement; v_ParentNode: XmlElement; v_TempBlob: Codeunit "Temp Blob"; v_Instr: InStream; v_OutStr: OutStream; v_ReadTxt: Text; v_Writetxt: Text; v_Emisor: Record "Company Information"; v_customer: Record Customer; v_salesH: Record "Sales Header"; DatosActuales: Record "Sales Header"; begin DatosActuales := RecordCurr; DatosActuales.SetRecFilter(); v_XMLDoc := XmlDocument.Create(); v_XMLDec := XmlDeclaration.Create('1.0', 'UTF-8', 'no'); v_XMLDoc.SetDeclaration(v_XMLDec); v_Emisor.Get(); v_ParentNode := XmlElement.Create('Emisor', 'http://www.sat.gob.mx/cfd/4'); v_RootNode.Add(v_ParentNode); v_ParentNode.SetAttribute('Name', v_Emisor.Name); v_ParentNode.SetAttribute('Rfc', v_Emisor."RFC No."); v_salesH.FindSet(); v_ParentNode := XmlElement.Create('Receptor', 'http://www.sat.gob.mx/cfd/4'); v_RootNode.Add(v_ParentNode); v_ParentNode.SetAttribute('Name', DatosActuales."Bill-to Name"); v_ParentNode.SetAttribute('Code', DatosActuales."CFDI Export Code"); v_TempBlob.CreateInStream(v_Instr); v_TempBlob.CreateOutStream(v_OutStr); v_XMLDoc.WriteTo(v_OutStr); v_OutStr.WriteText(v_Writetxt); v_Instr.ReadText(v_Writetxt); v_ReadTxt := 'name_CFDI40.XML'; DownloadFromStream(v_Instr, '', '', '', v_ReadTxt); end; }