Skip to Content
0
Jul 23, 2020 at 12:15 AM

B1 9.3 DI API Inventory Transfer Error: -10::Enter a valid value in "Whse" field [??????? 0-0]

459 Views Last edit Jul 23, 2020 at 04:56 AM 2 rev

Hello Experts,

I am receiving this error "-10::Enter a valid value in "Whse" field [??????? 0-0]" when calling the Add method of the Stock Transfer Object. I have verified and re-verified that both the Stock Transfer object and the Stock Transfer Lines object have the warehouse codes set for both To & From warehouses. The warehouses and these codes are correct and do exist. Some similar posts for this error message have stated information regarding item cost or unit price but that doesn't correlate with the error message. However, when I perform this action within SAP itself, I do not have issues.

For this item, the valuation method is set to Standard and the Item Cost is not set. As well, "Allow Stock Release Without Item Cost" is checked.

Any and all help that can be provided is greatly appreciated.

$bPass = true;
$trfnObj = $this->Useful->apiConfig->GetBusinessObject($this->Useful->aSAPB1Objects['Inventory Transfer']);
//Let's add to the obj
$trfnObj->CardCode = $request->CardCode;
$trfnObj->CardName = $request->CardName;
$trfnObj->ContactPerson = (int) $request->CntctCode;
$trfnObj->Address = $request->Address;
$trfnObj->PriceList = $request->GroupNum;
$trfnObj->Comments = "Service Call ".$request->U_JC1_PrintJob;
$trfnObj->FromWarehouse = $request->FromWhsCode;
$trfnObj->ToWarehouse = $request->ToWhsCode;
$trfnObj->DocDate = date('m/d/Y');
$trfnObj->JournalMemo = 'Inventory Transfers - '.$request->CardCode;
$trfnObj->UserFields->Fields->Item('U_NB_PortalCreateUser')->Value = $this->getRequest()->getSession()->read('Auth.User.full_name');
$trfnObj->UserFields->Fields->Item('U_NB_PortalUpdateUser')->Value = $this->getRequest()->getSession()->read('Auth.User.full_name');
 
$linesObj = $trfnObj->Lines;
 
$binAllocatObj = $linesObj->BinAllocations;
$binAllocatObj->BinAbsEntry = $getData['bin'];
$binAllocatObj->Quantity = $trnLine['Quantity'];
$binAllocatObj->BinActionType =  1;
$binAllocatObj->AllowNegativeQuantity = 1;
 
$linesObj->BaseEntry = $request->DocEntry;
$linesObj->BaseType = 5;
$linesObj->ItemCode = $trnLine['ItemCode'];
$linesObj->ItemDescription = $trnLine['Dscription'];
$linesObj->Quantity = $trnLine['Quantity'];
$linesObj->WarehouseCode = $request->ToWhsCode;
$linesObj->FromWarehouseCode = $request->FromWhsCode;

if ($linesObj->Add() != 0)
{
    $this->Flash->error(__(__LINE__.'::The items could not be transfered because of SAP criteria: '.$this->Useful->apiConfig->GetLastErrorCode()."::".$this->Useful->apiConfig->GetLastErrorDescription()));
    $bPass = false;
}

if ($bPass)
{
    if ($trfnObj->Add() == 0) //this is where the failure is occurring
    {
        //proceed on 
        $this->Flash->error(__('Inventory Transfer successfully created.'));
    }
    else
    {
        $this->Flash->error(__(__LINE__.'::The transfer could not be saved because of SAP criteria: '.$this->Useful->apiConfig->GetLastErrorCode()."::".$this->Useful->apiConfig->GetLastErrorDescription())); 
    }
}