Specifying invoice unit price for RMA import

SUGGESTED

I have a BOI that we've been using successfully for a couple years now to import RMA from our website.  Due to our particular business process, we have to deal with consolidated customer returns and so our standard practice is to set INVOICENO = "NOF".  We would like to preserve that but pass a specifc value into INVOICEUNITPRICE when importing.

Example:  I import a RMA with INVOICENO = "NOF" and specify $19.95 for INVOICEUNITPRICE.  There are no errors generated when I import, but when opening the RMA the price on the line is set to the Std Price, not $19.95.

So to summarize, I don't seem to be able to specify the INVOICEUNITPRICE when importing an RMA with BOI, is this expected behavior?  Is there a way I can do it?  Thanks!

  • 0

    In the RA_ReturnDetail table the field 'PriceOverridden' should be set to a value of 'Y' and that should allow your custom price to be saved.

  • 0 in reply to PSP-Craig

    Unfortunately this doesn't appear to work.  In my BOI I am setting PRICEOVERRIDDEN = Y before I specify the invoice unit price, and when I look at the RA_RETURNDETAIL table after importing that flag is set to Y.  However the Unit Price in the RMA line is the Std Price, not the price in my import table.

  • 0 in reply to codell3

    Here is my BOI:

    Function logerror(ref,err)

    Set db=CreateObject("ADODB.Connection")

    db.Open("DSN=HydrowebDev2")

    set r=db.execute("INSERT INTO boi_errors (script,ref,error) values ('RMAScript','"+ref+"','"+err+"')")

    set r=db.execute("update rma_entry set import_error = 1 where rmano = '"+ref+"'")

    set r=db.execute("EXEC msdb.dbo.sp_send_dbmail @profile_name = 'exchange', @recipients = '[email protected]', @subject = N'RA Import Failure', @body = N'"+ref+"  "+err+"'")

    o.DropObject()

    oSS.nCleanup()

    oSS.DropObject()

    Set oSS = Nothing

    Set oScript = Nothing

    WScript.Quit(99)

    End Function

    Function pd(n, totalDigits)

           if totalDigits > len(n) then

               pd = String(totalDigits-len(n),"0") & n

           else

               pd = n

           end if

       End Function

    On Error Resume Next

    Do 'infinate loop

    Set db=CreateObject("ADODB.Connection")

    db.Open("DSN=Hydrowebdev2")

    db.CommandTimeout = 600

    if Err.Number = 0 then

    On Error Goto 0

    'set r=db.execute("SELECT * FROM RMA_ImportView order by rmano")

    set r=db.execute("SELECT TOP (1) RMANO FROM RMA_ImportView WHERE (ISNULL(import_error, 0) <> 1) AND ((SELECT cur_value FROM web_config WHERE (Name = 'webRMAimport_run')) = 1) ORDER BY RMANO")

    if not r.eof then NextOrderNo = CStr(r.Fields("RMANO").Value)

    if not r.eof then

    set r=db.execute("update Web_config set cur_value = '"&NextOrderNo&"' where Name='webRMAimport_nextno'")

    On Error Resume Next

    'Create ProvideX COM Object

    Set oScript = CreateObject ("ProvideX.Script")

    oScript.Init("\\hydromas\mas90\Home\")

    Set oSS = oScript.NewObject("SY_Session")

    rv = oSS.nLogon()

    if rv = 0 then logerror OrderNo,o.slasterrormsg

    If rv=0 Then

    ' Please remember to correct the username, password

    rv = oss.nSetUser("###","###")

    if rv = 0 then logerror OrderNo,o.slasterrormsg

    End If

    'Set the company, module date and module for the Session

    'Format today's date

    todayDate = YEAR(Date()) & Pd(Month(date()),2) & Pd(DAY(date()),2)

    rv = oss.nsetcompany("HYD")

    if rv = 0 then logerror OrderNo,o.slasterrormsg

    rv = oSS.nSetDate("R/A", todayDate)

    if rv = 0 then logerror OrderNo,o.slasterrormsg

    rv = oSS.nSetModule("R/A")

    if rv = 0 then logerror OrderNo,o.slasterrormsg

    ' Instantiate a RMA Order business object

    oSEC = oSS.nSetProgram(oSS.nLookupTask("RA_Return_UI"))

    Set o = oScript.NewObject("RA_Return_bus", oSS)

    set r=db.execute("SELECT * FROM RMA_ImportView where rmano = (select cur_value from web_config where name = 'webRMAimport_nextno') order by createdate")

    r.MoveFirst()

    RMANo = CStr(r.Fields("RMANO").Value)

    rv = o.nSetKey(CStr(r.Fields("RMANO").Value))

    if rv = 0 then logerror RMANo,"RMANO: "+o.slasterrormsg

    rv = o.nSetValue("ARDivisionNo$", CStr(r.Fields("ARDIVISIONNO").Value))

    if rv = 0 then logerror RMANo,"ARDivisionNo: "+o.slasterrormsg

    rv = o.nSetValue("CustomerNo$", CStr(r.Fields("CUSTOMERNO").Value))

    if rv = 0 then logerror RMANo,"CustomerNo: "+o.slasterrormsg

    rv = o.nSetValue("ShipToCode$", CStr(r.Fields("SHIPTOCODE").Value))

    if rv = 0 then logerror RMANo,"ShipToCode: "+o.slasterrormsg

    rv = o.nSetValue("ShipToName$", CStr(r.Fields("SHIPTONAME").Value))

    if rv = 0 then logerror RMANo,"ShipToName: "+o.slasterrormsg

    rv = o.nSetValue("ShipToAddress1$", CStr(r.Fields("SHIPTOADDRESS1").Value))

    if rv = 0 then logerror RMANo,"ShipToAddress1: "+o.slasterrormsg

    rv = o.nSetValue("ShipToAddress2$", CStr(r.Fields("SHIPTOADDRESS2").Value))

    if rv = 0 then logerror RMANo,"ShipToAddress2: "+o.slasterrormsg

    rv = o.nSetValue("ShipToCity$", CStr(r.Fields("SHIPTOCITY").Value))

    if rv = 0 then logerror RMANo,"ShipToCity: "+o.slasterrormsg

    rv = o.nSetValue("ShipToState$", CStr(r.Fields("SHIPTOSTATE").Value))

    if rv = 0 then logerror RMANo,"ShipToState: "+o.slasterrormsg

    rv = o.nSetValue("ShipToZipCode$", CStr(r.Fields("SHIPTOZIPCODE").Value))

    if rv = 0 then logerror RMANo,"ShipToZipCode: "+o.slasterrormsg

    rv = o.nSetValue("EmailAddress$", CStr(r.Fields("EMAILADDRESS").Value))

    if rv = 0 then logerror RMANo,"EmailAddress: "+o.slasterrormsg

    rv = o.nSetValue("CONFIRMTO$", CStr(r.Fields("CONFIRMTO").Value))

    if rv = 0 then logerror RMANo,"ConfirmTo: "+o.slasterrormsg

    Do While Not r.eof

    rv = o.oLines.nAddLine()

    if rv = 0 then logerror RMANo,"nAddLine: "+o.oLines.slasterrormsg

    rv = o.oLines.nSetValue("InvoiceNo$", CStr(r.Fields("INVOICENO").Value))

    if rv = 0 then logerror RMANo,"InvoiceNo: "+o.oLines.slasterrormsg

    rv = o.oLines.nSetValue("ItemCode$", CStr(r.Fields("ITEMCODE").Value))

    if rv = 0 then logerror RMANo,"ItemCode: "+o.oLines.slasterrormsg

    rv = o.oLines.nSetValue("QuantityReturned", CDbl(r.Fields("QUANTITYRETURNED").Value))

    if rv = 0 then logerror RMANo,"QuantityReturned: "+o.oLines.slasterrormsg

    rv = o.oLines.nSetValue("WarehouseCode$", CStr(r.Fields("WAREHOUSECODE").Value))

    if rv = 0 then logerror RMANo,"WarehouseCode: "+o.oLines.slasterrormsg

    rv = o.oLines.nSetValue("CustomerAction$", CStr(r.Fields("CUSTOMERACTION").Value))

    if rv = 0 then logerror RMANo,"CustomerAction: "+o.oLines.slasterrormsg

    rv = o.oLines.nSetValue("ReturnReasonCode$", CStr(r.Fields("RETURNREASONCODE").Value))

    if rv = 0 then logerror RMANo,"ReturnReasonCode: "+o.oLines.slasterrormsg

    rv = o.oLines.nSetValue("UDF_SERIAL$", CStr(r.Fields("UDF_SERIAL").Value))

    if rv = 0 then logerror RMANo,"UDF_SERIAL: "+o.oLines.slasterrormsg

    rv = o.oLines.nSetValue("PRICEOVERRIDDEN$", CStr("Y"))

    if rv = 0 then logerror RMANo,"PriceIsOverriden: "+o.oLines.slasterrormsg

    rv = o.oLines.nSetValue("InvoiceUnitPrice", CStr(r.Fields("INVOICEUNITPRICE").Value))

    if rv = 0 then logerror RMANo,"InvoiceUnitPrice: "+o.oLines.slasterrormsg

    rv = o.oLines.nWrite()

    if rv = 0 then logerror RMANo,"o.oLines.nWrite: "+o.oLines.slasterrormsg

    r.MoveNext()

    Loop

    rv = o.nWrite()

    if rv = 0 then logerror RMANo,"o.nWrite nWrite: "+o.slasterrormsg

    set r=db.execute("INSERT INTO RMA_Entry_Log (RMANO) values ("&CDbl(RMANo)&")")

    o.DropObject()

    oSS.nCleanup()

    oSS.DropObject()

    Set oSS = Nothing

    Set oScript = Nothing

    End If

    Wscript.Sleep(30000)

    Else

    o.DropObject()

    oSS.nCleanup()

    oSS.DropObject()

    Set oSS = Nothing

    Set oScript = Nothing

    WScript.Quit(99)

    End if

    Loop

  • 0 in reply to codell3
    SUGGESTED

    In the Detail (lines) section add the value InvoiceNotOnFile equal to 'Y' and your special pricing should save.  This value needs to be set before the priceoverridden flag comes into play.