Hi I found the answer for this. We can use Integer table as a data source and create a temp sales line variable and insert the filtered records in temp sales line variable. Then use the temp table to loop as many number times. Sample code for better understanding. PWTrxLine - Export::OnPreXMLItem() CLEAR(gtTrxLines); gtTrxLines.DELETEALL; lPWTrxHeader.RESET; lPWTrxHeader.SETRANGE("Document type",lPWTrxHeader."Document type"::Shipment); lPWTrxHeader.SETFILTER("Client Program",'321'); IF lPWTrxHeader.FINDSET THEN REPEAT lPstdTrxLine.RESET; lPstdTrxLine.SETRANGE("Document type",lPWTrxHeader."Document type"); lPstdTrxLine.SETRANGE(Document,lPWTrxHeader.Document); IF lPstdTrxLine.FINDFIRST THEN REPEAT CLEAR(gtTrxLines); gtTrxLines.TRANSFERFIELDS(lPstdTrxLine); gtTrxLines.INSERT; UNTIL lPstdTrxLine.NEXT = 0; UNTIL lPWTrxHeader.NEXT =0; CLEAR(gtTrxLines); PWTrxLine.SETRANGE(Number,1,gtTrxLines.COUNT); PWTrxLine - Export::OnAfterGetRecord() IF PWTrxLine.Number = 1 THEN gtTrxLines.FINDFIRST ELSE gtTrxLines.NEXT;
↧