Skip to Content
author's profile photo Former Member
Former Member

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

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 04:54 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 13, 2007 at 07:17 AM

    Hi

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

    Regards

    Senthil

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.