BPM / ABL export to excel

Hello, epicor 9.5 users

Here is some ABL to save to cvs file
But what type of BPM would trigger saving the abl code to save cvs file

The below ABL code validate okay…

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 where part.company = CUR-COMP
no-lock.
ct = ct + 1.
export delimiter “,”
part.partnum
part.partdescription.
end.

Output close.

MESSAGE "Purchased Parts: " ct
VIEW-AS ALERT-BOX.

It would depend on when you want this to dump all the items.
However, why not use a BAQ and BAQ Export?

I would like to dump this on start activity on MES screen.

I have some code but is not working just yet,

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”.

For each part where part.company = CUR-COMP
and part.partnum = “P” no-lock.
ct = ct + 1.
export delimiter “,”
part.partnum.
end.

Output close.

MESSAGE "Part Test: " ct
VIEW-AS ALERT-BOX.

Saying that i could use a BAQ to export to excel as long as the export works when the users clicks start activity on the MES screen.

If you want to have it trigger at a particular point in the process, you need to run a trace to ensure you know what Business Object/Method is being called. I believe it is Labor.StartProductionActivity if memory serves me correctly.

Here is example code I’ve used in the past:

def var vCSVFileName as character format 'x(128)'init '\\server\folder\myVendorFile.csv' no-undo .

FILE-INFO:FILE-NAME = vCSVFileName .
	if FILE-INFO:FILE-SIZE < 24 then do:
		export delimiter ',' 'SupplierID' 'SupplierName' .
	end.
for each Vendor no-lock where Vendor.Company = CUR-COMP and Vendor.GroupCode = 'SUB' by Vendor.VendorID .
	export delimiter ',' 'SupplierID' 'SupplierName' .
	export delimiter ',' Vendor.VendorID Vendor.Name .
end .

Thanks for the info , i have tired a number of business objects just to display a simple information message on screen from start production activity (So i know i have got the correct business object to use. But no luck!

My trace log attached suggests <GetNewLaborDtl would be the correct place or Labor.getrows
TraceData6088.txt (104.2 KB)

Managed to get a trigger to work… but the code doesn’t export a csv file… i changed it to export a jobnum and partnum for jobhead table hoping this would export the current selected working on job info.

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

FILE-INFO:FILE-NAME = vCSVFileName .
if FILE-INFO:FILE-SIZE < 24 then do:
export delimiter ‘,’ ‘JobHead’ ‘PartNum’ .
end.
for each JobHead no-lock where JobHead.Company = CUR-COMP and Jobhead.PartNum = ‘SUB’ by JobHead.JobNum .
export delimiter ‘,’ ‘JobNum’ ‘PartNum’ .
export delimiter ‘,’ JobHead.JobNum JobHead.PartNum .
end .

Is that location a folder or is ERP01 the server? I think you had a bunch of typos:

def var vCSVFileName as character format 'x(128)' init '\\ERP01\temp\myVendorFile.csv' no-undo .

FILE-INFO:FILE-NAME = vCSVFileName .
if FILE-INFO:FILE-SIZE < 24 then do:
export delimiter ',' 'JobHead' 'PartNum' .
end.
for each JobHead no-lock where JobHead.Company = CUR-COMP and Jobhead.PartNum = 'SUB' by JobHead.JobNum .
export delimiter ‘,’ ‘JobNum’ ‘PartNum’ .
export delimiter ‘,’ JobHead.JobNum JobHead.PartNum .
end .

\erp01\temp\ is my share folder on the server.

I would suppose that the code requires the server name as well.

Yes it will need the server name as i want to have the csv file in shared location.

The code just needs to output the selected job that the mes users is about to working on, when start activity is press then the csv file exports jobhead.jobnum, jobhead. partnum, part.prodcode and a few other fields from the part table.

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 = ‘MSIUK’ AND
laborhed.EmployeeNum = string (ttlaborhed.EmployeeNum) .

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

end .