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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accpac cmd line importer GL, AR, AP 1

Status
Not open for further replies.

Greggpb88

Programmer
May 18, 2010
26
ZA
Currently once a day at our company we import 3 csv files in standard Accpac Format.

* GL Journal Batch (JNL_CCYYMMDD.CSV)
* AR invoice Batch (INV_CCYYMMDD.CSV)
* AP Payment Batch (CRP_CCYYMMDD.CSV)

They are imported by opening the respective module through the accpac front-end.
1.Hitting "new" for a new batch.
2.Then File->import
3.Selecting the file through the browse button.
4.Then renaming the batch to the file name.
5.Then post the batch.

I have look through some of the AVB examples and tried to record a macro myself.

How would one do something like this which should be relativly simple automatically. Are there any command line switches on accpac.exe to invoke macros with parameters like file name ?




 
path and filename of a4wvba.exe" -r -f "path and filename of vba macro"
 
Thanks very much for that so I can have a scheduled/file create task kick off a cmd prompt to a macro for each of the types of imports.

So now i have to write 3 Macros to import the batches..

As far as I can see from the file, it has all the information needed for in the import sitting in the first 3 rows of the file. which is awesome..

I have record this task when i did this last time. in the recorded macro there is no reference to the file that i am loading.. how do i set this from the VBA code ?

Thanks very much for you help i really apprieate it
 
Duh... You need to code the file name (ccyymmdd) in your macro. I can't do all your work for you!
 
Haha lol. more that happy to do it myself but i just need to under stand the process is a sort of psuedo-code kinda way..

From the forums and my recored macro I see the back being created from some view and a datastructure being created with the Array function..

do you manuall loop throught the file there after once the batch is created or do you point the view to the file and and tell it to import ?
 
1. Create and initialized the views.
2. Point the import to the right file.
 
Thanks for the quick response's, as I am not familiar with the accpac object structure I have figure out how to create a batch as per the recorded macro below

What I am not sure about is why is composes the array twice ?

and what Object I would reference when point to a file name and what the member on that object to execute the import ?



Code:
' TODO: To increase efficiency, comment out any unused DB links.
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)

Dim mDBLinkSysRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkSysRW = OpenDBLink(DBLINK_SYSTEM, DBLINK_FLG_READWRITE)

Dim temp As Boolean
Dim ARINVOICE1batch As AccpacCOMAPI.AccpacView
Dim ARINVOICE1batchFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0031", ARINVOICE1batch
Set ARINVOICE1batchFields = ARINVOICE1batch.Fields

Dim ARINVOICE1header As AccpacCOMAPI.AccpacView
Dim ARINVOICE1headerFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0032", ARINVOICE1header
Set ARINVOICE1headerFields = ARINVOICE1header.Fields

Dim ARINVOICE1detail1 As AccpacCOMAPI.AccpacView
Dim ARINVOICE1detail1Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0033", ARINVOICE1detail1
Set ARINVOICE1detail1Fields = ARINVOICE1detail1.Fields

Dim ARINVOICE1detail2 As AccpacCOMAPI.AccpacView
Dim ARINVOICE1detail2Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0034", ARINVOICE1detail2
Set ARINVOICE1detail2Fields = ARINVOICE1detail2.Fields

Dim ARINVOICE1detail3 As AccpacCOMAPI.AccpacView
Dim ARINVOICE1detail3Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0402", ARINVOICE1detail3
Set ARINVOICE1detail3Fields = ARINVOICE1detail3.Fields

Dim ARINVOICE1detail4 As AccpacCOMAPI.AccpacView
Dim ARINVOICE1detail4Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0401", ARINVOICE1detail4
Set ARINVOICE1detail4Fields = ARINVOICE1detail4.Fields

ARINVOICE1batch.Compose Array(ARINVOICE1header)

ARINVOICE1header.Compose Array(ARINVOICE1batch, ARINVOICE1detail1, ARINVOICE1detail2, ARINVOICE1detail3, Nothing)

ARINVOICE1detail1.Compose Array(ARINVOICE1header, ARINVOICE1batch, ARINVOICE1detail4)

ARINVOICE1detail2.Compose Array(ARINVOICE1header)

ARINVOICE1detail3.Compose Array(ARINVOICE1header)

ARINVOICE1detail4.Compose Array(ARINVOICE1detail1)


Dim ARINVCPOST2 As AccpacCOMAPI.AccpacView
Dim ARINVCPOST2Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0048", ARINVCPOST2
Set ARINVCPOST2Fields = ARINVCPOST2.Fields


Dim ARINVOICE3batch As AccpacCOMAPI.AccpacView
Dim ARINVOICE3batchFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0031", ARINVOICE3batch
Set ARINVOICE3batchFields = ARINVOICE3batch.Fields

Dim ARINVOICE3header As AccpacCOMAPI.AccpacView
Dim ARINVOICE3headerFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0032", ARINVOICE3header
Set ARINVOICE3headerFields = ARINVOICE3header.Fields

Dim ARINVOICE3detail1 As AccpacCOMAPI.AccpacView
Dim ARINVOICE3detail1Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0033", ARINVOICE3detail1
Set ARINVOICE3detail1Fields = ARINVOICE3detail1.Fields

Dim ARINVOICE3detail2 As AccpacCOMAPI.AccpacView
Dim ARINVOICE3detail2Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0034", ARINVOICE3detail2
Set ARINVOICE3detail2Fields = ARINVOICE3detail2.Fields

Dim ARINVOICE3detail3 As AccpacCOMAPI.AccpacView
Dim ARINVOICE3detail3Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0402", ARINVOICE3detail3
Set ARINVOICE3detail3Fields = ARINVOICE3detail3.Fields

Dim ARINVOICE3detail4 As AccpacCOMAPI.AccpacView
Dim ARINVOICE3detail4Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0401", ARINVOICE3detail4
Set ARINVOICE3detail4Fields = ARINVOICE3detail4.Fields

ARINVOICE3batch.Compose Array(ARINVOICE3header)

ARINVOICE3header.Compose Array(ARINVOICE3batch, ARINVOICE3detail1, ARINVOICE3detail2, ARINVOICE3detail3, Nothing)

ARINVOICE3detail1.Compose Array(ARINVOICE3header, ARINVOICE3batch, ARINVOICE3detail4)

ARINVOICE3detail2.Compose Array(ARINVOICE3header)

ARINVOICE3detail3.Compose Array(ARINVOICE3header)

ARINVOICE3detail4.Compose Array(ARINVOICE3detail1)


ARINVOICE3batch.Browse "((BTCHSTTS = 1) OR (BTCHSTTS = 7))", 1
temp = ARINVOICE3batch.Exists
ARINVOICE3batch.RecordCreate 1

ARINVOICE3batchFields("PROCESSCMD").PutWithoutVerification ("1")      ' Process Command

ARINVOICE3batch.Process
ARINVOICE3batch.Read
temp = ARINVOICE3header.Exists
ARINVOICE3header.RecordCreate 2
ARINVOICE3detail1.Cancel
ARINVOICE3batchFields("PROCESSCMD").PutWithoutVerification ("2")      ' Process Command
ARINVOICE3batch.Process
ARINVOICE3batch.Read

ARINVOICE3batchFields("PROCESSCMD").PutWithoutVerification ("1")      ' Process Command

ARINVOICE3batch.Process
ARINVOICE3headerFields("CNTITEM").PutWithoutVerification ("-9999999")   ' Entry Number
ARINVOICE3header.Browse "", 1
ARINVOICE3header.Fetch
ARINVOICE3detail1.Read
ARINVOICE3detail1.Read
ARINVOICE3batchFields("BTCHDESC").PutWithoutVerification ("CTN_20100518.j01")   ' Description
ARINVOICE3batch.Update
 
Step 1 is to clean up the recorded mess.
Code:
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Dim ARbatch As AccpacCOMAPI.AccpacView
Dim ARheader As AccpacCOMAPI.AccpacView
Dim ARdetail1 As AccpacCOMAPI.AccpacView
Dim ARdetail2 As AccpacCOMAPI.AccpacView
Dim ARdetail3 As AccpacCOMAPI.AccpacView
Dim ARdetail4 As AccpacCOMAPI.AccpacView

Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)
mDBLinkCmpRW.OpenView "AR0031", ARbatch
mDBLinkCmpRW.OpenView "AR0032", ARheader
mDBLinkCmpRW.OpenView "AR0033", ARdetail1
mDBLinkCmpRW.OpenView "AR0034", ARdetail2
mDBLinkCmpRW.OpenView "AR0402", ARdetail3
mDBLinkCmpRW.OpenView "AR0401", ARdetail4

ARbatch.Compose Array(ARheader)
ARheader.Compose Array(ARbatch, ARdetail1, ARdetail2, ARdetail3, Nothing)
ARdetail1.Compose Array(ARheader, ARbatch, ARdetail4)
ARdetail2.Compose Array(ARheader)
ARdetail3.Compose Array(ARheader)
ARdetail4.Compose Array(ARdetail1)

ARbatch.RecordCreate 1
ARbatch.Fields("BTCHDESC").PutWithoutVerification "CTN_20100518.j01"
ARbatch.Update
 
Thanks for the help with the clean up it is far easier to read now.. I have added comments on what I think the code does?
are they correct ?

Code:
'All the comment on this piece of code are assumptions

' decalre all vars
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink 
Dim ARbatch As AccpacCOMAPI.AccpacView
Dim ARheader As AccpacCOMAPI.AccpacView
Dim ARdetail1 As AccpacCOMAPI.AccpacView
Dim ARdetail2 As AccpacCOMAPI.AccpacView
Dim ARdetail3 As AccpacCOMAPI.AccpacView
Dim ARdetail4 As AccpacCOMAPI.AccpacView

Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)  '  Open a connection to the company database


mDBLinkCmpRW.OpenView "AR0031", ARbatch		' The view of the batch list in Accpac
mDBLinkCmpRW.OpenView "AR0032", ARheader	' Is this the header for the batch or for once specific invoice in the batch 
mDBLinkCmpRW.OpenView "AR0033", ARdetail1	' I am not sure if these view relate to screens ina ccpac or view on the database
mDBLinkCmpRW.OpenView "AR0034", ARdetail2	'
mDBLinkCmpRW.OpenView "AR0402", ARdetail3	'
mDBLinkCmpRW.OpenView "AR0401", ARdetail4	'

' This is Creating the data structure or some sort in memory of some sort of how th batch will be structured
ARbatch.Compose Array(ARheader)
ARheader.Compose Array(ARbatch, ARdetail1, ARdetail2, ARdetail3, Nothing)
ARdetail1.Compose Array(ARheader, ARbatch, ARdetail4)
ARdetail2.Compose Array(ARheader)
ARdetail3.Compose Array(ARheader)
ARdetail4.Compose Array(ARdetail1)


ARbatch.RecordCreate 1 ' Create the actual batch
ARbatch.Fields("BTCHDESC").PutWithoutVerification "CTN_20100518.j01" ' assigne the name of the batch
ARbatch.Update
' at this point I have an empty Batch.
 
Step 2 is reading the CSV file with ADODB recordsets.
Step 3 is inserting header and detail lines in the batch. Do some more recording of an invoice being added.
 
@Tuba2007 I have been doing recording of a batch using batchlist file->import..
do I have to go to invoice entry and add the invoice while recording ?

Ps thanks for the help, I am shooting in the dark here.
 
If your company is certified for Sage Accpac programming, you should have access to Sage's Application Object Models (AOM).

The AOM's can be downloaded from the Sage site after logging into the partner section with a valid developer user name and password.

AOM's are released for each version of Sage Accpac and identify each of the tables, fields and compositions.

In case you can't access it right now
- AR0031: Invoice Batches
- AR0032: Invoices (Header)
- AR0033: Invoice Details
- AR0034: Invoice Payment Schedules
- AR0402: Invoice Optional Fields
- AR0401: Invoice Detail Optional Fields

If at first you don't succeed, then sky diving wasn't meant for you!
 
@BlueJay07 Thanks for the info, unfortunately we are not an Accpac programming Partner, but a freight company. We are basically looking to automate some tasks, we have been through a couple of the a couple of Accpac service Certified providers each worse than the next. I ill google the net for some info on the views..
 
Not everything records. You need to add an AccpacImportExport object to your project, like this (untested) sample I copied from another forum:

Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)

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

With IE
.Open mDBLinkCmpRW
.ImportAction = IMPORT_INSERT_AND_UPDATE
.SetViewEx "GL0008", "", VIEW_BATCH, Null, ACTION_ASK
.SetViewEx "GL0006", "GL0008", VIEW_SEQUENCED_HEADER, Null, ACTION_ASK
.SetViewEx "GL0010", "GL0006", VIEW_DETAIL_SEQUENCED, Null, ACTION_ASK
.SetViewEx "GL0402", "GL0010", VIEW_DETAIL_ORDERED, Null, OPTIONAL_VIEW
.SetBatchNumber CVar("000140")

.ExecuteImportScript "C:\ImportGL.xml", True
.VerifyOnPut = True

.GetExecuteResult str
MsgBox str
.Close
End With

 
The AR views are declared, then opened and then composed.
The AR views have a batch-header-detail hierarchy, in this case there are multiple details. Typically each view relates to a screen, or a tab on a screen in Accpac, or as in the case of the batch entry screen the header relates to the header fields and detail1 relates to the details grid.
The compose sets up the relationship between views.
 
Ok guys I went away and had a look and this is what I have come up with and it is not working..

Must I generate a new script file evertime i do an import ? or can i just setup the AccpacImportExport object directly ?


Code:
'All the comment on this piece of code are assumptions

' decalre all vars
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Dim ARbatch As AccpacCOMAPI.AccpacView
Dim ARheader As AccpacCOMAPI.AccpacView
Dim ARdetail1 As AccpacCOMAPI.AccpacView
Dim ARdetail2 As AccpacCOMAPI.AccpacView
Dim ARdetail3 As AccpacCOMAPI.AccpacView
Dim ARdetail4 As AccpacCOMAPI.AccpacView
Dim IE As AccpacImportExport.ImportExport

Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)  '  Open a connection to the company database
Set IE = New AccpacImportExport.ImportExport

mDBLinkCmpRW.OpenView "AR0031", ARbatch     ' The view of the batch list in Accpac
mDBLinkCmpRW.OpenView "AR0032", ARheader    ' Is this the header for the batch or for once specific invoice in the batch
mDBLinkCmpRW.OpenView "AR0033", ARdetail1   ' I am not sure if these view relate to screens ina ccpac or view on the database
mDBLinkCmpRW.OpenView "AR0034", ARdetail2   '
mDBLinkCmpRW.OpenView "AR0402", ARdetail3   '
mDBLinkCmpRW.OpenView "AR0401", ARdetail4   '

' This is Creating the data structure or some sort in memory of some sort of how th batch will be structured
ARbatch.Compose Array(ARheader)
ARheader.Compose Array(ARbatch, ARdetail1, ARdetail2, ARdetail3, Nothing)
ARdetail1.Compose Array(ARheader, ARbatch, ARdetail4)
ARdetail2.Compose Array(ARheader)
ARdetail3.Compose Array(ARheader)
ARdetail4.Compose Array(ARdetail1)


ARbatch.RecordCreate 1 ' Create the actual batch
ARbatch.Fields("BTCHDESC").PutWithoutVerification "MY TEST BATCH" ' assigne the name of the batch
ARbatch.Update
' at this point I have an empty Batch.


Dim str As String

With IE
.Open mDBLinkCmpRW
.ImportAction = IMPORT_INSERT
.SetViewEx "AR0031", "", VIEW_BATCH, Null, ACTION_ASK
.SetViewEx "AR0032", "AR0031", VIEW_SEQUENCED_HEADER, Null, ACTION_ASK
.SetViewEx "AR0034", "AR0032", VIEW_DETAIL_SEQUENCED, Null, ACTION_ASK
'.SetViewEx "AR0402", "AR0034", VIEW_DETAIL_ORDERED, Null, OPTIONAL_VIEW ' no optional field on my imports
.SetBatchNumber CVar("000140")
'.SetBatchNumber


.ExecuteImportScript "A:\Import Script\ARImportScript.xml", True
.VerifyOnPut = True

'A:\Import Script\ARImportScript.xml
'<?xml version="1.0" encoding="utf-8"?>
'<AccpacImpExp Action="16" ProgramName="AR2100" Type="IMPORT" Version="532" HasTitleRecord="1">
'   <VIEW ID="AR0031" Type="4" Action="0">
'       <TABLE>Invoice_Batches</TABLE>
'   </VIEW>
'   <VIEW ID="AR0032" Type="3" Action="0" Parent="AR0031" SelectedIDs="1 2 4 8 11 14 18 22 23 25 46 142 146 ">
'       <TABLE>Invoices</TABLE>
'   </VIEW>
'   <VIEW ID="AR0033" Type="9" Action="0" Parent="AR0032" SelectedIDs="1 2 3 6 7 18 28 38 74 ">
'       <TABLE>Invoice_Details</TABLE>
'   </VIEW>
'   <VIEW ID="AR0034" Type="9" Action="0" Parent="AR0032" AllFieldSelected="1">
'       <TABLE>Invoice_Payment_Schedules</TABLE>
'   </VIEW>
'   <DBNAME>S:\airship32\Runtimes\OUTPUT\Processed Files\CTN_20100518.j01</DBNAME>
'   <DBTYPE>Single CSV File</DBTYPE>
'   <BatchID>52</BatchID>
'</AccpacImpExp>




.GetExecuteResult str
MsgBox str
.Close
End With
 
If you look at the code I have to to the point when I can create batches and import them I have sorted out how to set the batch number properly

The only hiccup I have having it loading the filename would i have to modify the script file on a daily basis or is there an option i am missing ?
 
The script file ARImportScript.xml points to the import file
Code:
<DBNAME>S:\airship32\Runtimes\OUTPUT\Processed Files\CTN_20100518.j01</DBNAME>
.
Either keep the import file name the same, or rename the import file before importing it, or edit the script file.
 
Hi Guys please find attache the code that I eventually got working to load the AR transactions, still need some propper error checking but it works..

Thanks very much to the guys here for the help.. and if you have any question i will do my best to explain what I have learned here..


Code:
Dim sTemplateFileName As String
Dim sScriptFileName As String
sTemplateFileName = "A:\Import Script\ARImportScript.xml"
'A:\Import Script\ARImportScript.xml
'<?xml version="1.0" encoding="utf-8"?>
'<AccpacImpExp Action="16" ProgramName="AR2100" Type="IMPORT" Version="532" HasTitleRecord="1">
'   <VIEW ID="AR0031" Type="4" Action="0">
'       <TABLE>Invoice_Batches</TABLE>
'   </VIEW>
'   <VIEW ID="AR0032" Type="3" Action="0" Parent="AR0031" SelectedIDs="1 2 4 8 11 14 18 22 23 25 46 142 146 ">
'       <TABLE>Invoices</TABLE>
'   </VIEW>
'   <VIEW ID="AR0033" Type="9" Action="0" Parent="AR0032" SelectedIDs="1 2 3 6 7 18 28 38 74 ">
'       <TABLE>Invoice_Details</TABLE>
'   </VIEW>
'   <VIEW ID="AR0034" Type="9" Action="0" Parent="AR0032" AllFieldSelected="1">
'       <TABLE>Invoice_Payment_Schedules</TABLE>
'   </VIEW>
'   <DBNAME>S:\airship32\Runtimes\OUTPUT\Processed Files\CTN_CCYYMMDD.j01</DBNAME>
'   <DBTYPE>Single CSV File</DBTYPE>
'   <BatchID>52</BatchID>
'</AccpacImpExp>
sScriptFileName = "A:\Import Script\TodayScript.xml"

'------------------------------------------------------------------------------
' Create a Script file specific to today
'------------------------------------------------------------------------------
' Load a template file saved out of accpac and change file name with a string
' replace. In this Case replacing CCYYMMDD with 20100524
'------------------------------------------------------------------------------
Dim objFSO, objFile, oTextStream
Dim sTemplateImportScript As String
' Create the FSO Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set oTextStream = objFSO.OpenTextFile(sTemplateFileName, 1)

'load the template file
sTemplateImportScript = oTextStream.ReadAll
oTextStream.Close

' Change the file name to todays date
sTemplateImportScript = Replace(sTemplateImportScript, "CCYYMMDD", CStr(Format(Now, "yyyymmdd")))

' Write the new text File
Set objFile = objFSO.OpenTextFile(sScriptFileName, 2, True)
objFile.Write (sTemplateImportScript)
objFile.Close

' Cleanup
Set oTextStream = Nothing
Set objFile = Nothing
Set objFSO = Nothing

'------------------------------------------------------------------------------
' Declare all Accpac related Vars
'------------------------------------------------------------------------------
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Dim ARbatch As AccpacCOMAPI.AccpacView
Dim ARheader As AccpacCOMAPI.AccpacView
Dim ARdetail1 As AccpacCOMAPI.AccpacView
Dim ARdetail2 As AccpacCOMAPI.AccpacView
Dim ARdetail3 As AccpacCOMAPI.AccpacView
Dim ARdetail4 As AccpacCOMAPI.AccpacView
Dim strBatchID As String

Dim IE As AccpacImportExport.ImportExport

Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)  '  Open a connection to the company database
Set IE = New AccpacImportExport.ImportExport

mDBLinkCmpRW.OpenView "AR0031", ARbatch     ' The view of the batch list in Accpac
mDBLinkCmpRW.OpenView "AR0032", ARheader    ' Is this the header for the batch or for once specific invoice in the batch
mDBLinkCmpRW.OpenView "AR0033", ARdetail1   ' I am not sure if these view relate to screens ina ccpac or view on the database
mDBLinkCmpRW.OpenView "AR0034", ARdetail2   '
mDBLinkCmpRW.OpenView "AR0402", ARdetail3   '
mDBLinkCmpRW.OpenView "AR0401", ARdetail4   '

' This is Creating the data structure or some sort in memory of some sort of how th batch will be structured
ARbatch.Compose Array(ARheader)
ARheader.Compose Array(ARbatch, ARdetail1, ARdetail2, ARdetail3, Nothing)
ARdetail1.Compose Array(ARheader, ARbatch, ARdetail4)
ARdetail2.Compose Array(ARheader)
ARdetail3.Compose Array(ARheader)
ARdetail4.Compose Array(ARdetail1)


ARbatch.RecordCreate 1 ' Create the actual batch
ARbatch.Fields("BTCHDESC").PutWithoutVerification "MY TEST BATCH" ' assigne the name of the batch
ARbatch.Update
' at this point I have an empty Batch.
' Get The batch Id out of the empty batch
strBatchID = ARbatch.Fields("CNTBTCH").Value

Dim str As String

With IE
.Open mDBLinkCmpRW
.ImportAction = IMPORT_INSERT
.SetViewEx "AR0031", "", VIEW_BATCH, Null, ACTION_ASK
.SetViewEx "AR0032", "AR0031", VIEW_SEQUENCED_HEADER, Null, ACTION_ASK
.SetViewEx "AR0034", "AR0032", VIEW_DETAIL_SEQUENCED, Null, ACTION_ASK
' Set The batch number to the one from the created batch
.SetBatchNumber Trim(strBatchID)
.ExecuteImportScript sScriptFileName, True
.VerifyOnPut = True
' Get The xml result report
.GetExecuteResult str
MsgBox str
.Close
End With
 
oops Forgot the last requirement anyone know how to post ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top