Epicor - ABL export to excel

EnguiD

New Member
Hello, Epicor ERP 9.5 user here!

Has any got a ABL query output to CSV file Epicor 9.5
I found the below ABL code but did not work.
Example of outputting to an Excel .csv file: from MES Button





MESSAGE "Purchased Parts: " ct
VIEW-AS ALERT-BOX.
Error i get is ----
** Unable to understand after -- "company.company". (247)
** C:\Epicor\EpicorData\6322396891617321725036161871067172191120.p Line 24 --Invalid FOR, DO, REPEAT, or EDITING statement. (194)Find first company no-lock no-error.



DEF VAR ct AS INTE NO-UNDO.



Output to c:\temp\part-purchased.csv.



Export delimiter ","

"Part Number"

"Description"

"Type Code"

"Cost Method".



For each part no-lock where part.company = company.company (use CUR-COMP

if using from a BPM)

and part.typecode = "P".

ct = ct + 1.

export delimiter ","

part.partnum

part.partdescription

part.typecode

part.costmethod.

end.



Output close.
 
Last edited:

TomBascom

Curmudgeon
Please put [ c o d e ] tags around code…

The problem would appear to be that:
Code:
For each part no-lock where part.company = company.company (use CUR-COMP
if using from a BPM)
and part.typecode = "P".

should be:
Code:
for each part no-lock where part.company = company.company /* use CUR-COMP
if using from a BPM */
and part.typecode = "P":
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
There is also the issue that you are referencing the company record buffer without first having fetched a record into it.

For example:
Code:
define variable ct  as integer   no-undo.
define variable cmp as character no-undo.

output to c:\temp\part-purchased.csv.

export delimiter ","
  "Part Number"
  "Description"
  "Type Code"
  "Cost Method".

/* which company record do you care about? */
update "Select a company" cmp. 

find company no-lock where company.company = cmp no-error.
if not available company then quit.

for each part no-lock where part.company  = company.company
                        and part.typecode = "P":
  ct = ct + 1.

  export delimiter ","
    part.partnum
    part.partdescription
    part.typecode
    part.costmethod.

end.

output close.
 
message "Purchased Parts: " ct
  view-as alert-box.

Note: this is a non-tested "hello world" example. I don't suggest that you run it against your system as-is.
 

EnguiD

New Member
I been trying to get the above code to work but gave up...

I have some simpler code that should work, but still no joy in out putting CSV file


Code:
def var vCSVFileName as character format 'x(128)'init ‘C:\temp\myVendorFile.csv’ no-undo .

    FILE-INFO:FILE-NAME = vCSVFileName .
    if FILE-INFO:FILE-SIZE < 24 then do:
    export delimiter ‘,’ ‘EmployeeNum’ .
    end.

    for each ttLaborHed where ttlaborhed.RowMod = ‘A’:
    find first laborhed where laborhed.Company = ‘TESTERP’ AND
    laborhed.EmployeeNum = string (ttlaborhed.EmployeeNum) .

    export delimiter ',' 'EmployeeNum' .
    export delimiter ',' 'laborhed.EmployeeNum' .

    end .
 
Last edited by a moderator:

Cringer

ProgressTalk.com Moderator
Staff member
It would help if you would give us the errors you receive rather than just saying it doesn't work.
In this case I guess it doesn't work because you need to define the output location:
Code:
output to value (vCSVFileName) [append].

And you'll need to close the output as well once done.
 
Top