Tying to Copy Part.Checkbox01 into Sales Order Detail

Hello All,
When I create a Sales Order Detail I would like to copy Part.Checkbox01 into OderDtl.Checkbox02. I’ve tried using the following code in a BPM, Method Code: SalesOrder.GetNewOrderDtl, Pre-Processing with “Actions” “sychronously execute 4GL code”. This is my code:

/* Copy Part.Checkbox01 to OrderDtl.Checkbox02 */

For Each ttOrderHed where ttOrderHed.Company =cur-comp,
Each ttOrderDtl where ttOrderDtl.Company = ttOrderHed.Company and ttOrderDtl.OrderNum = ttOrderHed.OrderNum no-lock.

			Find First Part where ttOrderHed.Company = Part.Company and ttOrderDtl.PartNum = Part.PartNum no-error.
		
				If available (Part) then Do.
						
						ttOrderDtl.Checkbox02 = Part.CheckBox01.
					
				End.

End.

But this didn’t work. Can anyone help me out?

Thanks,
Jody

Fire the BPM when the part number is changed. The part number is not defined when a new order detail is created.

1 Like

I see what you are saying. I tried Method Code: SalesOrder.ChangePartNum with the code above and that didn’t work. What Method Code should I use?

Try ChangePartNumberMaster

Brian,

I don’t see a Directive ChangePartNumberMaster under SalesOrder.

@jmannett I also did this in 9 on ChangePartNumberMaster with code similar to yours. I have never seen 8 so can you do a trace to see what methods are called when adding a line and part to the order? If not what Change methods do you have available?

ChangeCardNumber
ChangeCCAmounts
ChangeCommissionable
ChangeContractNum
ChangeCounterSale
ChangeCreditExp
ChangeCurrencyCode
ChangeCustomer
ChangedCardNumber
ChangeDiscountAmount
ChangeDiscountPercent
ChangeERSOrder
ChangeGroup
ChangeKitPricing
ChangeKitQtyPer
ChangeMake
ChangeMiscAmount
ChangeMiscCode
ChangeMiscPercent
ChangeNeedByDate
ChangeNewNeedByDate
ChangeNewSellingQuantity
ChangeODtlDimCode
ChangeODtlWarehouse
ChangeOrderRelShipTo
ChangeOrderRelShipToContact
ChangeORelWarehouse
ChangeOverridePriceList
ChangePartNum
ChangePlant
ChangePriceList
ChangePricePerCode
ChangeQuickEntryOption
ChangeQuoteLine
ChangeQuoteQtyNum
ChangeRevisionNum
ChangeRMANum
ChangeSalesRep
ChangeSellingFactor
ChangeSellingFactorDirection
ChangeSellingQuantity
ChangeSellingReqQty
ChangeShipToContact
ChangeShipToID
ChangeSoldToContact
ChangeSoldToID
ChangeUnitPrice
ChangeVendorChange
ChangeXPartNum

This is what I don’t understand. I’m using SalesOrder.ChangePartNum. In Post-Processing I create an informational message in the Actions. Then I add my 4GL Code as in my previous post. Then I added an other informational message behind it. My results are when I add a new line item to the sales order and add the Part Number, I will get the two informational messages, but I will not get the Part.Checkbox01 to copy to the OrderDtl.Checkbox02.

If I do the same thing in SalesOrder.Update with Post-Processing. When I make any change to the order and save, I get the informational messages and it copies the Part.Checkbox01 to OrderDtl.Checkbox02 as I want. Any ideas what I’m doing wrong?

Here is how I did this and I added a couple of things I do for tracing. I swapped out my variables for yours, so this should work. I started with ttOrderDtl since this in on ChangePartNum I don’t think you would have or need ttOrderHed.

Also if you use ``` before and after code it will format better.
The Message statements write to you appserver server log. I think it has to be running in verbose mode.The info message will do a popup and shows you are in your custom code.

On Change you want post processing since you are between the database and the client. On update you want pre-processing since you are going from the client to the database.

This is all from 905 and I hope it works in 8.

/* set CB02 from part CB01 */

Message " IN ChangePartNum get cb01".

define variable InfoMsg as character init ''.
 
For Each ttOrderDtl where ttOrderDtl.company = cur-comp.

	

	For First Part fields (CheckBox01) where Part.PartNum = ttOrderDtl.PartNum.
		
		Assign ttOrderDtl.Checkbox02 = Part.CheckBox01.
				
		Message " IN ChangePartNum assign cb01".
		
						InfoMsg = "I made it to the assigment".

						{lib/PublishInfoMsg.i &InfoMsg = InfoMsg}.
	
	
	End.
End.

Thanks for the information. I haven’t had a chance to try it yet. I did get one of my BPM’s to work, but when I re-created it in my Live Vista it didn’t work. Why would that be? I originally created the BPM in my Training database. When I had it working like I wanted it to, then I unenabled it in my Training database and created it in my Live database and now it doesn’t work.