BOM Header changes via BOI?

Hello and thank you in advance for your help and advise.

I am trying to create a program that uses the BOI to insert a RMA at the time of arrival. The issue I am running into is the BOM is set to "inactive" in Bill of Materials Maintenance.

What objects do I need to use to perform a lookup of a specific Bill Number so I can change the value of a field? Below is some sudo-code to help you understand my problem:

#BEGIN CODE SAMPLE

/* log into sage */

// mas90 is the path to our mas90 directory on the network

pvx.GetType().InvokeMember("Init", flgMethod, null, pvx, new object[] { mas90 });

oSS = pvx.GetType().InvokeMember("NewObject", flgMethod, null, pvx, new object[] { "SY_Session" });
oSS.GetType().InvokeMember("nSetUser", System.Reflection.BindingFlags.InvokeMethod, null, oSS, new object[] { "<some_user>", "<some_password>" });
oSS.GetType().InvokeMember("nSetCompany", flgMethod, null, oSS, new object[] { "<XYZ>" });
oSS.GetType().InvokeMember("nSetDate", flgMethod, null, oSS, new object[] { "R/A", accDate });
oSS.GetType().InvokeMember("nSetModule", flgMethod, null, oSS, new object[] { "R/A" });

TaskID = (int)oSS.GetType().InvokeMember("nLookupTask", flgMethod, null, oSS, new object[] { "RA_Return_UI" });
oSS.GetType().InvokeMember("nSetProgram", flgMethod, null, oSS, new object[] { TaskID });

// get the SalesOrderBus Object
oSOB = pvx.GetType().InvokeMember("NewObject", flgMethod, null, pvx, new object[] { "RA_Return_bus", oSS });


// sales order header object
oSOB.GetType().InvokeMember("nSetKey", flgMethod, null, oSOB, new object[] { NewOrder.orderno });

/* set other RA Entry header fields ....*/

...

/* Start adding lines*/

oSOL = oSOB.GetType().InvokeMember("oLines", flgGetProperty, null, oSOB, null);

foreach (Items item in NewOrder.items)
{

// add a new line for each item.
oSOL.GetType().InvokeMember("nAddLine", flgMethod, null, oSOL, null);

oSOL.GetType().InvokeMember("nSetValue", flgMethod, null, oSOL, new object[] { "ItemType$", "1" });

oSOL.GetType().InvokeMember("nSetValue", flgMethod, null, oSOL, new object[] { "ItemCode", item.itemno });

string  Error = (string)oSOL.GetType().InvokeMember("sLastErrorMsg", System.Reflection.BindingFlags.InvokeMethod, null, oSOL, null);

/* SUDO CODE STARTS HERE */

if(Error){

open BOM;

Set BOM field->BillType = 'active';

//set required fields for RA_Entry_oLine;

Set BOM field->BillType = 'inactive';

}else{

set required fields for RA_Entry_oLine;

continue;

}

/* END SUDO CODE */ 

// save the line
linesErr = (int)oSOL.GetType().InvokeMember("nWrite", flgMethod, null, oSOL, null);

}

BusErr = (int)oSOB.GetType().InvokeMember("nWrite", flgMethod, null, oSOB, null);

#END CODE SAMPLE

Is it possible to Change BOM Status via BOI?

Again thanks for the help! If you have done it in another language, please share as I can usually adapt it to learn what I need to do.

-Jim