cancel
Showing results for 
Search instead for 
Did you mean: 

MaterialRevaluation

Former Member
0 Kudos

Hello All:

Doing a material revaluation pcs which use itemcode, warehouse and new price to update item prices in the warehouse level and couldn't find any sample code. Can anyone help? Thank You! Any direction or documentation will be appreciated.

the _line object doesn't seem to be accessible via DI-API..

Message was edited by: Bo Peng

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Bo,

Herewith a sample:

        Dim oVal As SAPbobsCOM.MaterialRevaluation
        oVal = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oMaterialRevaluation)
        oVal.Reference2 = "Test"
        oVal.Lines.ItemCode = "XXXXX"
        oVal.Lines.WarehouseCode = "02"
        oVal.Lines.Price = "1000"
        oVal.Lines.RevaluationDecrementAccount = "100000"
        oVal.Lines.RevaluationIncrementAccount = "100000"
        If oVal.Add <> 0 Then
            MessageBox.Show(oCompany.GetLastErrorDescription)
        Else
            MessageBox.Show("Success")
        End If

Hope it helps,

Adele

Answers (1)

Answers (1)

Former Member
0 Kudos

Thank You Adele as always:

However I encountered following error message.

" - The data area passed to a system call is too small.\r\n"

My code is below:

oMR = (SAPbobsCOM.MaterialRevaluation)(global.ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oMaterialRevaluation));

oMR.Lines.ItemCode = itemcode;

oMR.Lines.WarehouseCode = whs;

oMR.Lines.Price = price;

try

{

if (oMR.Add() != 0)

{

global.ocompany.GetLastError(out global.interr, out errcode);

if (errcode != "")

<u>global.oapplicaiton.MessageBox(errcode, 1, "OK", "", "");</u> else

global.oapplicaiton.MessageBox("No output error", 1, "OK","","");

}

else

{

global.oapplicaiton.SetStatusBarMessage("Successful", SAPbouiCOM.BoMessageTime.bmt_Short, false);

}

}

catch (Exception ex)

{

global.oapplicaiton.MessageBox(ex.Message, 1, "OK", "", "");

}

Actually in above line with underline lines. I have server thrown an exception! It something like

{"The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))"}

This is very weired. Am I missing something in the parameter? Also, I would like to add new lines under the same oMR before add. Is there a way to do it? Thank You!

Sincerely Yours

Bo Peng