Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need help exporting data of AR receipts in 5.2

Status
Not open for further replies.
Dec 2, 2003
12
0
0
Hi,

I have created a macro to export the receipt batches from AR in 5.2. However, the files that come out are empty. Can someone help me spot my error.

=========macro==========
Sub ExportArReceiptBatch()

Dim ReturnValue As Boolean
Dim CompDBLink As AccpacCOMAPI.AccpacDBLink
Set CompDBLink = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)

Dim ARExport As AccpacImportExport.ImportExport
Set ARExport = New AccpacImportExport.ImportExport

ARExport.Open CompDBLink
ARExport.SetView "AR0041", "", VIEW_BATCH, Null
ARExport.SetView "AR0042", "AR0041", VIEW_SEQUENCED_HEADER, Null
ARExport.SetView "AR0043", "AR0042", VIEW_DETAIL, Null
ARExport.SetView "AR0044", "AR0042", VIEW_DETAIL, Null
ARExport.SetView "AR0045", "AR0042", VIEW_DETAIL, Null
Dim FileName As String
Dim NewFileName As String
Dim i As Integer

For i = 1 To 5
ARExport.SetBatchNumber CStr(i)
ARExport.ExecuteExportScript "C:\Documents and Settings\sandy\Desktop\Carlos Files\AR\rec.xml", ReturnValue

On Error Resume Next

FileName = "C:\Documents and Settings\sandy\Desktop\Carlos Files\AR\rec.xls"
NewFileName = "C:\Documents and Settings\sandy\Desktop\Carlos Files\AR\REC" & CStr(i) & ".xls"
Name FileName As NewFileName

Next i

ARExport.Close

End Sub
========end macro=========

========rec.xml===========
<?xml version="1.0" encoding="utf-8" ?>
- <AccpacImpExp Action="0" ProgramName="AR3100" Type="EXPORT" Version="513">
- <VIEW ID="AR0041" Type="4" Action="0" AllFieldSelected="0">
<TABLE>Receipt_and_Adjustment_Batches</TABLE>
</VIEW>
- <VIEW ID="AR0042" Type="3" Action="0" Parent="AR0041" AllFieldSelected="1">
<TABLE>Receipts_Adjustments</TABLE>
</VIEW>
- <VIEW ID="AR0043" Type="1" Action="0" Parent="AR0042" AllFieldSelected="1">
<TABLE>Miscellaneous_Receipts</TABLE>
</VIEW>
- <VIEW ID="AR0044" Type="1" Action="0" Parent="AR0042" AllFieldSelected="1">
<TABLE>Applied_Receipts_Adjustments</TABLE>
</VIEW>
- <VIEW ID="AR0045" Type="1" Action="0" Parent="AR0044" AllFieldSelected="1">
<TABLE>Adjustment_G_L_Distributions</TABLE>
</VIEW>
<DBTYPE>Excel 2000</DBTYPE>
<DBNAME>C:\Documents and Settings\sandy\Desktop\Carlos Files\AR\rec.xls</DBNAME>
<BatchID>CA 3</BatchID>
</AccpacImpExp>
==========end rec.xml ===========

Any help will be greatly appreciated.

Carlos
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top