Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert OE detail line in the middle of the OE lines 1

Status
Not open for further replies.

vbdbcoder

Programmer
Nov 23, 2006
247
US
Hello,

Version Sage v2017, Working on a custom app to insert to OE detail. The requirement is to insert a new OE line after a certain OE line. I can't get it to work. Could you please provide some pointer ?


//2017-09-21 for printing order fix
//Set where to start in order detail....
OEORD1detail1.Fields.FieldByName["LINENUM"].PutWithoutVerification(sOrderDetailLineStartFrom); // ' Line Number
OEORD1detail1.Read();
temp = OEORD1detail1.Exists;
//Then.... the back order lines
//2017-09-21
for (int i = lst_BackOrderLine.Count - 1; i >= 0; i--)
{

string sItem = lst_BackOrderLine.Component; //lstOEDetail.ItemNo;

decimal decQtyOrdered = decimal.Parse(lst_BackOrderLine.ComponentQtyInBOM);//
decimal decUnitPrice = decimal.Parse("0");
string sUnit = lst_BackOrderLine.Unit; // "1"; // lstOEDetail.PriceUnit;
string sLocation = lst_BackOrderLine.Location; // "1"; // lstOEDetail.Location;
//string sPriceList = lstOEDetail.PriceList;

//bool temp = OEORD1detail1.Exists;

OEORD1detail1.RecordClear();
temp = OEORD1detail1.Exists;
OEORD1detail1.RecordCreate(tagViewRecordCreateEnum.VIEW_RECORD_CREATE_NOINSERT); // 0

OEORD1detail1.Fields.FieldByName["ITEM"].set_Value(sItem); // ' Item
OEORD1detail1.Fields.FieldByName["PROCESSCMD"].PutWithoutVerification("1"); //' Process Command
OEORD1detail1.Process();

//OEORD1detail1.Fields.FieldByName["PRICELIST"].set_Value(sPriceList); //Price list
OEORD1detail1.Fields.FieldByName["QTYORDERED"].set_Value(decQtyOrdered); //' Quantity Ordered

OEORD1detail1.Process();
OEORD1detail1.Fields.FieldByName["PRIUNTPRC"].set_Value(decUnitPrice); //' Pricing Unit Price
OEORD1detail1.Fields.FieldByName["LOCATION"].set_Value(sLocation); //' Pricing Unit Price
OEORD1detail1.Fields.FieldByName["PRICEUNIT"].set_Value(sUnit); //' Pricing Unit of Measure

OEORD1detail1.Insert();

OEORD1detail1.Fields.FieldByName["LINENUM"].PutWithoutVerification("-1"); //' Line Number
OEORD1detail1.Read();

OEORD1detail1.RecordClear();
temp = OEORD1detail1.Exists;
OEORD1detail1.RecordCreate(tagViewRecordCreateEnum.VIEW_RECORD_CREATE_NOINSERT); // 0
}

OEORD1header.Fields.FieldByName["OECOMMAND"].set_Value("0"); //' Process O/E Command
OEORD1header.Process();
temp = OEORD1header.Exists;
OEORD1header.Update();
 
OEORDD.LINENUM needs to be set to the LINENUM of the record that you want to insert in front of, just before you .RecordCreate.



Sage 300 Whisperer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top