cancel
Showing results for 
Search instead for 
Did you mean: 

use Gridview with dropdownlist

former_member319241
Participant
0 Kudos

Hi,

I am working on a web application and want to use Gridview for adding data to sap b1 matrix.

So the Gridview as follows.

  ItemName        Available Qty     UoM       Used Qty  

   dropdownlist     label                 label         textbox

When the web page is loaded the Gridview is shown and user can add any number of rows and it should be added to sap b1 matrix.

So can you please post sample code for this.

Please reply.Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Saurabh,

Actually your question is not clear. How do you want the data to SAP B1 ? Please elaborate.

1. Do you want to copy it to SAP B1 Matrix using UIAPI ?

2. Or you want that it should automatically write to SAP B1 database using DIAPI.

3. For which form you need this functionality ?

Thanks & Regards

Ankit Chauhan

former_member319241
Participant
0 Kudos

Hi,

I use web page and DIAPI to add data to a UDO in sap b1.

There is matrix in sap b1 as follows.

ItemName   Available Qty   UoM           Used Qty

abc           100               KG                Textbox

ItemName has CFL in matrix and user only enters used quantity.

So I want to use Gridview in ASP Net  c#   to add data using DIAPI and generalservice.

I am able to add non matrix data using DIAPI using generalservice.

Thanks.

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Saurabh,

Use below Code to write the data to matrix or Child Table:

SAPbobsCOM.GeneralService oGeneralService = null;

SAPbobsCOM.GeneralData oGeneralData = null;

SAPbobsCOM.GeneralDataParams oGeneralParams = null;

SAPbobsCOM.CompanyService sCmp = null;

SAPbobsCOM.GeneralData oChild = null;

SAPbobsCOM.GeneralDataCollection oChildren = null;

sCmp = SBO_Company.GetCompanyService();

oGeneralService = sCmp.GetGeneralService("YOURUDOCODE");

                                              

// Get UDO record 

                                                oGeneralParams = ((SAPbobsCOM.GeneralDataParams)(oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams)));

                                                oGeneralParams.SetProperty("Code", ContractCode);

                                                oGeneralData = oGeneralService.GetByParams(oGeneralParams);

                                                // Add lines on UDO Child Table 

                                                oChildren = oGeneralData.Child("YOURCHILDTABLEWITHOUT@");

                                                // Update an existing line 

                                                oChild = oChildren.Add();

                                                oChild.SetProperty("U_UnitNum", UnitNumber);

                                                oChild.SetProperty("U_Loctn", Location);

                                                oChild.SetProperty("U_Item", ItemCode);

                                                oChild.SetProperty("U_IDesc", ItemName);

                                                oChild.SetProperty("U_Quantity", Qty);

                                                oChild.SetProperty("U_Price", Price);

                                                oChild.SetProperty("U_TaxCode", TaxCode);

                                                oChild.SetProperty("U_Shift", FinalShift);

                                                oChild.SetProperty("U_Working", FinalWorkingHour);

                                                oChild.SetProperty("U_Templt", DocEntry);

                                                oChild.SetProperty("U_UnitID", UnitID);

                                                oChild.SetProperty("U_BILPRD", BillingFrequency);

                                                if (StartDate != "")

                                                {

                                                    DateTime StartDateNow = Convert.ToDateTime(oRecSet.Fields.Item("U_Start").Value);

                                                    oChild.SetProperty("U_STDate", StartDateNow);

                                                    oChild.SetProperty("U_Effect", StartDateNow);

                                                }

                                                oChild.SetProperty("U_STATS", "Open");

                                                DateTime dt = DateTime.Now;

                                                oChild.SetProperty("U_Updated", dt);

                                                oChild.SetProperty("U_Remarks", "New Service Added");

                                                //Update the UDO Record

                                                oGeneralService.Update(oGeneralData);

Hope it helps.

Thanks & regards

Ankit Chauhan

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Also check this:

Hope it helps.

Thanks & Regards

Ankit Chauhan

former_member319241
Participant
0 Kudos

Hi,

Thanks for reply.

I also need code for ASP Net page design and how to use Gridview for matrix.

Thanks.