cancel
Showing results for 
Search instead for 
Did you mean: 

'Invalid Field Name' error when attempting to insert record to UDT of document type

guardian01
Member
0 Kudos

Hi,

I am new to SAP B1 SDK and I have been trying to insert record into an UDT of document type. I retrieve the Purchase Order number in the edit text field using Choose From List which works fine.

But I get 'Invalid Field Name' when adding the record. I debugged the code and it shows the error at this code piece,

oUserTable = oCompany.UserTables.Item("TEST"); // Debug line- 'Invalid Field Name' 

Here's my full code and image of the udf:

public Company oCompany;
public UserTable oUserTable;
private void Button0_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            oCompany = new Company();

            oUserTable = null;
            oUserTable = oCompany.UserTables.Item("TEST"); // Debug line- 'Invalid Field Name' 
            oUserTable.Code = Convert.ToString(1);
            oUserTable.UserFields.Fields.Item("U_PONo").Value = EditText0.Value;
            oUserTable.Add();
            oUserTable = null;

            GC.Collect();

        }


Accepted Solutions (0)

Answers (0)