PdcMasterData.AddStock

From External Bemet Wiki
Jump to navigation Jump to search

Declaration

PdcMasterData.AddStock(rstrMatNo as String, rstrCertNo as String, rstrLocation as String, rstrSerNo as String, rdblUnitAmount as Double, rdblLength as Double, rdblWidth as Double, rdblHeigth as Double, rintNumber as integer, rdblWeigth as Double, rbooBlocked as Boolean, rdtExpireDate as Date, rintMutCode as Integer)

Description

This method adds stock to a material. Function returns new LMV_ID.

Notes

Code example

This code example adds stock with the help from LMV Line 161 with 0.125 m3 and code ID1 (CORRECTION). If the LMV line is already in use, it returns an error msg.

'USEUNIT  pdcTables
Sub btnReduceStockClick(Sender)
dim strError
dim strMatNo
dim strLMV_ID
dim strCertNo
dim strLocation
dim strSerNo
dim dblUnitAmount
dim dblLength
dim dblWidth
dim dblWeigth
dim dblHeigth
dim intNumber
dim booBlocked
dim dtExpireDate
dim intMutCode

  strLMV_ID     = "161"
  strMatNo      = GetAnyField("LMV_MAT", "LMV_ID", strLMV_ID, "LMV_MATN")
  strCertNo     = GetAnyField("LMV_MAT", "LMV_ID", strLMV_ID, "LMV_CERTNR")
  strLocation   = GetAnyField("LMV_MAT", "LMV_ID", strLMV_ID, "LMV_LOK")
  strSerNo      = GetAnyField("LMV_MAT", "LMV_ID", strLMV_ID, "LMV_USER1")
  dblUnitAmount = 0.125
  dblLength     = 0.5
  dblWidth      = 0.5
  dblHeigth     = 0.5
  dblWeigth     = 0
  intNumber     = 1
  booBlocked    = false
  dtExpireDate  = 0
  intMutCode    = 1

  if not fbooAddStock(strMatNo, strCertNo, strLocation, strSerNo, dblUnitAmount, dblLength, dblWidth, dblHeigth, intNumber, dblWeigth, booBlocked, dtExpireDate, intMutCode, strError) then
    msgbox strError
  end if
End Sub


Function fbooAddStock(rstrMatNo, rstrCertNo, rstrLocation, rstrSerNo, rdblUnitAmount, rdblLength, rdblWidth, rdblHeigth, intNumber, rdblWeigth, rbooBlocked, rdtExpireDate, rintMutCode, rstrError)

  pdc.MasterData.AddStock rstrMatNo, rstrCertNo, rstrLocation, rstrSerNo, rdblUnitAmount, rdblLength, rdblWidth, rdblHeigth, intNumber, rdblWeigth, rbooBlocked, rdtExpireDate, rintMutCode
  rstrError = pdc.LastError

  if rstrError = "" then
    fbooAddStock = true
  else
    fbooAddStock = false
  end if

End Function

Availability

5.2