Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create PO Receipt with Lot tracking

Status
Not open for further replies.

vbdbcoder

Programmer
Nov 23, 2006
241
0
16
US
I am having problem following the macro code captured to create PO receipt detail line with Lot # and Lot qty.

The scenario is to populate a Lot # value and Lot qty from my own value when receiving an item. It is one to one relationship to the PO receipt line. I receive 10 item AAA, then the Lot # "555" should have a qty of 10.

Is there any sample code that can help ?

Thanks
 
As Tuba said, recording macros will get you what you need here. However, I've got some code handy that should assist.

You first need to get the line read to receive serial or lot information.

Code:
Public Sub PrepareLineForSerialsOrLots()
    If Not (m_bSuccess) Then Exit Sub
    With PORCP1detail1
        .Fields("PROCESSCMD").PutWithoutVerification ("29")       
        .Process
    End With
End Sub

Then you can add your lot information.
Code:
Public Sub CreateLot(aLotNo As String, aQty As Double)
    On Error GoTo CreateLot_Error

    With PORCP1detail14
        .RecordClear
        .Fields("LOTNUMF").PutWithoutVerification aLotNo
        If .Read Then
            .Fields("QTY").Value = .Fields("QTY").Value + aQty
            .Fields("QTYSQ").Value = .Fields("QTYSQ").Value + aQty
            .Update
        Else
            .RecordCreate VIEW_RECORD_CREATE_NOINSERT
            .Fields("LOTNUMF").Value = aLotNo
            .Fields("QTY").Value = aQty
            .Fields("QTYSQ").Value = aQty
            .Insert
        End If
    End With
Cleanup:
    On Error GoTo 0
    Exit Sub

CreateLot_Error:

    m_sMsg = GetAccpacErrors(AccpacSession)
    MsgBox "Errors reported in POReceipt61.CreateLot: " & m_sMsg
    Resume Cleanup

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top