cancel
Showing results for 
Search instead for 
Did you mean: 

Can UI API allow insert a new record in Sales Order UI Form

Former Member
0 Kudos

Hi,

Does anyone has the experience to insert record into Sales Order form via UI API.

Say, i need to auto insert a new record (next line) with Item no, qty and unit price as bundled, when user entering item sold qty exceeds 100 pcs in the first line.

Appreciate if can share the sample codes in vb.net.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Yes you can.

You just have to instanciate a Matrix object (For sales order the Item is 38) and a EditText

//strFormUID can be extracted from the item event handler

SAPbouiCOM.Form oForm = (SAPbouiCOM.Form)SBO_Application.Forms.Item(strFormUID);

SAPbouiCOM.Matrix oMatrix_Dto = (SAPbouiCOM.Matrix)oForm.Items.Item("38").Specific;

SAPbouiCOM.EditText ItemCodeEdit = (SAPbouiCOM.EditText)oMatrix_Dto.Columns.Item("1").Cells.Item(oMatrix_Dto.RowCount).Specific;

//strItemCode is the itemcode you want to add in the last line

ItemCodeEdit.Value=strItemCode

You also can set the quantity, at the moment you enter the info of the itemcode the system will put another line

SAPbouiCOM.EditText oQuantityEdit = (SAPbouiCOM.EditText)oMatrix_Dto.Columns.Item("11").Cells.Item(oMatrix_Dto.RowCount-1).Specific;

//db quantity is the quantity you want to put in the sales order.

oQuantityEdit.Value=dbQuantity

You can enter the information you need.

The logic to get the event that the quantity has exceed 100 pc is as the following.

SAPbouiCOM.Form oForm = (SAPbouiCOM.Form)SBO_Application.Forms.Item(strFormUID);

SAPbouiCOM.Matrix oMatrix_Dto = (SAPbouiCOM.Matrix)oForm.Items.Item("38").Specific;

SAPbouiCOM.EditText oQuantityEdit = (SAPbouiCOM.EditText)oMatrix_Dto.Columns.Item("11").Cells.Item(oMatrix_Dto.RowCount-1).Specific;

//You have to tae care with Culture info, because it is possible that a 6.00 would be brought as 6000000

if(Convert.ToDouble(oQuantityEdit.Value)>100)

{ do what you want}

the complete code will be:

SAPbouiCOM.Form oForm = (SAPbouiCOM.Form)SBO_Application.Forms.Item(strFormUID);

SAPbouiCOM.Matrix oMatrix_Dto = (SAPbouiCOM.Matrix)oForm.Items.Item("38").Specific;

//It is not the last, because when you entered the info of the first line the systems puts another line.

SAPbouiCOM.EditText oQuantityEdit = (SAPbouiCOM.EditText)oMatrix_Dto.Columns.Item("11").Cells.Item(oMatrix_Dto.RowCount-1).Specific;

if(Convert.ToDouble(oQuantityEdit.Value)>100)

{

int iRowCount=oMatrix_Dto.RowCount;

SAPbouiCOM.EditText ItemCodeEdit = (SAPbouiCOM.EditText)oMatrix_Dto.Columns.Item("1").Cells.Item(iRowCount).Specific;

//strItemCode is the itemcode you want to add in the last line

ItemCodeEdit.Value=strItemCode

oQuantityEdit = (SAPbouiCOM.EditText)oMatrix_Dto.Columns.Item("11").Cells.Item(iRowCount).Specific;

//db quantity is the quantity you want to put in the sales order.

oQuantityEdit.Value=dbQuantity

}

Best regards,

Guillermo Ocampo

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Can you manually insert one row in the matrix and fill the default cell values manually

Regards

Senthil

Former Member
0 Kudos

Sure i can do it manually.

I am asking for sample codes to auto insert a line record for the order.

Former Member
0 Kudos

if found the solution.

use matrix.add(1)

thanks