There is an incorrect extended cost on a purchase order detail line when the Purchase Order (04.250.00) screen is customized

This article provides a solution to an issue where there is an incorrect extended cost on a purchase order detail line when the Purchase Order (04.250.00) screen is customized.

Applies to:   Microsoft Dynamics SL 2011
Original KB number:   2953411

Symptoms

When you customize Purchase Order Maintenance, you may notice that the extended cost on a purchase order detail line is incorrect.

Resolution

Note

This workaround should only be used if the database is a single currency database.

Add the following custom code to the PORef_Chk event and the Spread1_LineGotFocus event to set a default value on the customized field. This makes sure that a value is put in the field and will avoid the situation where the user is asked whether they want to abandon changes to the detail line.

Private Sub cpolineref_Chk(ChkStrg As String, retval As Integer)

Dim CtlVal As String

CtlVal = GetObjectValue("xuser1")
 If (Trim$(CtlVal) = "") Then
 Call SetObjectValue("xuser1", "new hot")
 End If

End Sub

Private Sub Spread1_LineGotFocus(maintflg As Integer, retval As Integer)

Dim CtlVal As String

If (maintflg <> NEWROW) Then
 CtlVal = GetObjectValue("xuser1")
 If (Trim$(CtlVal) = "") Then
 Call SetObjectValue("xuser1", "new hot")
 End If
 End If

End Sub