# MES BPM to check material

**URL:** <https://www.epiusers.help/t/mes-bpm-to-check-material/39664>\
**Category:** Epicor ERP 9\
**Created:** [August 4, 2017, 4:34pm UTC](https://www.epiusers.help/t/mes-bpm-to-check-material/39664 "2017-08-04T16:34:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MelissaC](https://www.epiusers.help/user_avatar/www.epiusers.help/melissac/32/1982_2.png) [@MelissaC](https://www.epiusers.help/u/MelissaC)\
**Post date:** [August 4, 2017, 4:34pm UTC](https://www.epiusers.help/t/mes-bpm-to-check-material/39664/1 "2017-08-04T16:34:31Z")

</div>

Hi,  
I am retrying a BPM I was working on a little while ago. I want to check that the material related to the operation they are clocking out of has been issued. I don’t get any errors but I don’t get the warning when I expect it.

I have a method directive, pre-processing on Labor.EndEctivityComplete

my query is:

for each ttLaborDtl no-lock , each JobMtl no-lock where

(ttLaborDtl.Company = JobMtl.Company and ttLaborDtl.JobNum = JobMtl.JobNum

and ttLaborDtl.AssemblySeq = JobMtl.AssemblySeq and ttLaborDtl.OprSeq =

JobMtl.RelatedOperation and JobMtl.IssuedQty = 0 )

And the action is raise exception with my message.

I am not sure what I am missing/doing wrong.

Thanks  
Melissa

---

<div class="post-metadata">

**Author:** ![gpayne](https://www.epiusers.help/user_avatar/www.epiusers.help/gpayne/32/55751_2.png) [@gpayne](https://www.epiusers.help/u/gpayne)\
**Post date:** [August 4, 2017, 6:01pm UTC](https://www.epiusers.help/t/mes-bpm-to-check-material/39664/2 "2017-08-04T18:01:07Z")

</div>

First put just an informational message to make sure the method is getting called.

I do something like this on reporting quantities on Labor.Update. I took that bpm and changed it to do a material check on labor update. This is not condition and abl code.

code is below and marked as code - thanks @Chris_Conn

Greg

```auto

/* Stopping if Mtl not issued */

  For each ttLaborDtl where ttLaborDtl.RowMod = 'U' and ttLaborDtl.LaborType = "P" no-lock.
  
  

		       For Each JobMtl Where JobMtl.Company = ttLaborDtl.Company and JobMtl.JobNum = ttLaborDtl.JobNum and JobMtl.AssemblySeq = ttLaborDtl.AssemblySeq and
		       JobMtl.RelatedOperation = ttLaborDtl.OprSeq no-lock.
		       
		       		If JobMtl.IssuedQty > 0 then next.
		       
		  
		         
		        		If JobMtl.IssuedQty = 0 Then DO:
		         
		        			 {lib/PublishEx.i &ExMsg = "'Material ' + JobMtl.PartNum + ' not issued.'"}.
		         
		        				 assign ttLaborDtl.LaborQty = 0.
		         
		        
		         		End.
		       
		   
		       
		 			 End.
  End.
  
  

```

---

<div class="post-metadata">

**Author:** ![MelissaC](https://www.epiusers.help/user_avatar/www.epiusers.help/melissac/32/1982_2.png) [@MelissaC](https://www.epiusers.help/u/MelissaC)\
**Post date:** [August 4, 2017, 7:41pm UTC](https://www.epiusers.help/t/mes-bpm-to-check-material/39664/3 "2017-08-04T19:41:51Z")

</div>

That worked wonderfully.  
Thank you so much 🙂

---

<div class="post-metadata">

**Author:** ![gpayne](https://www.epiusers.help/user_avatar/www.epiusers.help/gpayne/32/55751_2.png) [@gpayne](https://www.epiusers.help/u/gpayne)\
**Post date:** [August 4, 2017, 7:54pm UTC](https://www.epiusers.help/t/mes-bpm-to-check-material/39664/4 "2017-08-04T19:54:29Z")

</div>

Your welcome. Can you mark the question as solved?
