Multi Files Importer: How to import SAP/AIS files
Forums
Hello!
I found this code:
For i = 0 To x
' Set-up the XML import task
Set task = Client.GetImportTask("ImportXML")
task.InputFileName = picked_folder & "\" & listbox2$(i)
sample_prefix = Left(listbox2$(i), (Len(listbox2$(i)) - Len( mylist2(extension)) - 1)) ' Removes Extension task.OutputFileName = task.UniqueBaseFileName(sample_prefix)
' Execute the XML import task
task.PerformTask
Set task = Nothing
Next
What do I have to change to use the code for SAP/AIS files?
Thanks in advance!
Best regards,Martin
Thank you, I appreciate it.
Thank you, I appreciate it.
Here is the code:
dbName = "ZB_ANLB_1000_03_2016.IMD"
Client.ImportDelimFile "F:\MA-RT\F-Geim\Projekte\Digitale JAP\IDEA Hauptprüfung\Quelldateien.ILB\ZB_ANLB_1000_03_2016", dbName, FALSE, "", "F:\MA-RT\F-Geim\Projekte\Digitale JAP\IDEA\Hauptprüfung\Importdefinitionen.ILB\ZB_ANLB_1000_03_2016.RDF", FALSE
Client.OpenDatabase (dbName)
The files have no extensions. I tried to implement that code in the code mentioned in my first post, but I failed.
With SAP/AIS format no importdefinitions are needed, because the definitions are embedded in the files.
Hi Martin,
Hi Martin,
Thanks for sharing the code. I see they are importing it as a text delimited file.
For your code you need to add the IMD to the dbName, as your file doesn't have a file extension the code doesn't have to remove it first. The next line is the import, the Import Delimited File is actually just one line long. It contains the source file name, the IDEA file name, a flag to indicate it you want to create the fieldstats, import criteria if any, the record definition name and a flag to indicate if the first line contains the field names.
For i = 0 To x
dbName = picked_folder & "\" & listbox2$(i) & ".IMD" 'add the IMD extension to the selected file
Client.ImportDelimFile picked_folder & "\" & listbox2$(i) , dbName, FALSE, "", "F:\MA-RT\F-Geim\Projekte\Digitale JAP\IDEA\Hauptprüfung\Importdefinitionen.ILB\ZB_ANLB_1000_03_2016.RDF", FALSE
Next
Hi Brian,
Hi Brian,
thank you very much.
I changed the code slightly to:
For i = 0 To x
d
bName = listbox2$(i) & ".IMD" 'add the IMD extension to the selected file
Client.ImportDelimFile picked_folder & "\" & listbox2$(i) , dbName, FALSE, "", workingFolder & "\Importdefinitionen.ILB\ZB_ANLA_1000_01_2016.RDF", FALSE
Next
Now it works well.
One issue is left: E.g. I have 5 files in the choosen path with no extensions. The files have to been imported as follow:
1. SAP/AIS2.SAP/AIS3. SAP/AIS4. Text5. SAP/AIS
How do I have to adjust the code that the code doesn't stop at No. 4?
As a result No 1, 2, 3, and 5 should be imported after the script.
One question left.
One question left.
In a dialog I've got 2 listboxes. One on the left side an the other one on the right side. Over a push button ">" and another push button "<" you can switch the listbox entries from one to another.
Therefore the code to follow is used. How do I have to enhance the code that I'am able to drop all of the files with the buttons "<<" and ">>" from listbox1 to listbox2?
Do
button = Dialog(mydialog)
'------- If button pressed and list isn't empty
If button = 1 And mydialog.listbox1 <> -1 Then chosenfile = mydialog.listbox1 chosentxt = listbox1$(chosenfile)
z = 0
Do Until listbox2$(z) = "" z = z + 1 Loop
listbox2$(z) = chosentxt listbox1$(chosenfile) = ""
End If
If button = 2 And mydialog.listbox2 <> -1Then
chosenfile = mydialog.listbox2 chosentxt = listbox2$(chosenfile)
'------ This part looks for the first empty slot to input the selection z = 0 Do Until listbox1$(z) = "" z = z + 1 Loop
'-------- Copies to the first empty slot and clears the selection from the selection list
listbox1$(z) = chosentxt listbox2$(chosenfile) = ""
End If
cleanup_listbox1 cleanup_listbox2
'------- Loops until Ok or Cancel is clicked
Loop Until button < 1
If button = 0 Then GoTo exit_sub
z = 0
x = UBound(listbox2$)
'---------- Count Values in Listbox2$ array and reinitialize array with new dimensions.
For i = 0 To x
If listbox2$(z) <> "" Then z = z + 1 End If
Next
ReDim preserve listbox2$(z - 1)
x = UBound(listbox2$)
Hi Martin, did you see my
Hi Martin, did you see my code here - http://ideascripting.com/snippet/using-listboxs-select-filesfields it has the code that you are looking for or that you can adapt.
Brian
Hi Brian,
Hi Brian,
thanks for sharing the code - works fine.
I still have an issue with the import of SAP/AIS file (post #3 and #4).
If you import a SAP/AIS file through the IDEA menue you don't have to do anything except clicking the OK button, because the import definitions are embedded in SAP/AIS files. This is the key difference between e.g. csv files and SAP/AIS files.
Do you have an idea how to customize the code to follow to "use" IDEA's usual way to import SAP/AIS files?
Client.ImportDelimFile picked_folder & "\" & listbox2$(i) , dbName, FALSE, "", workingFolder & "\Importdefinitionen.ILB\ZB_ANLA_1000_01_2016.RDF", FALSE
Just for clarification: If you import those SAP/AIS files "manually" through the IDEA menue you don't have to choose "ZB_ANLA_1000_01_2016.RDF".
It must be possible because IDEA is also working without a RDF file.
Do you have any idea?
Hi Martin,
Hi Martin,
Any chance you can share the file or a portion of the file? You can send it to brian.element@ideascripting.com. Like I mentioned I have never worked with this type of file so if I could have a copy I can try and figure out what is going on.
Thanks
Brian
This thread seems to be old,
This thread seems to be old, but is in my opinion pretty interesting, because over SAP Dart View you get a lot of data files. With the SAP extraction tool (Dart View) i got over 500 sap/ais files for every month (nearly 6k a year). So i thought, that there is a way to import all of them (outside the sap smart exporter).
For me the above mentioned code did not work. After several hours of searching why, i found out, that sap/ais does also need a rdf file. Thus, i didn't find a proper solution for import the files in a fast way.
I think, after you defined an rdf for every single data file (f.e. txw_anlk_es.rdf/ txw_fi_pos.rdf/txw_fi_hd.rdf) you can adjust the above mentioned listbox style, but with an extra to chose an template file. For example, you open the txw_fi_hd_es file of period 6. after that, idea build an rdf itself. When you want to import the files of 7, 8, 9, 10 of the txw_fi_hd_es, than you can make a makro with the rdf of period 6.
Hi Martin,
Hi Martin,
Unfortunately I have never worked with an SAP/AIS file so I can't help you out. Also I don't have an example to import to create the code. If you do have one import it throught the Desktop and then go to the History and you should have the IDEAScript code to import the file that you can paste into your script. If you need to modify it you can post it and I will help you out.
Brian