cancel
Showing results for 
Search instead for 
Did you mean: 

Copy From Option

Former Member
0 Kudos

Hi Users,

I want to use a button like 'Copy From' on Sales Order etc. How can i use it.? Is it a simple button.?

Regards

Accepted Solutions (1)

Accepted Solutions (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Kuldeep,

This button is refered as 'Button Combo'. You can use it very easily on the Combo select event. I am sharing a code with you. You can make changes according to your needs.

if (pVal.ItemUID == enControlName.btnCombo)

                                    {

                                        SAPbouiCOM.ButtonCombo btnCombo = (SAPbouiCOM.ButtonCombo)this.m_SBO_Form.Items.Item(enControlName.btnCombo).Specific;                                       

                                        SAPbouiCOM.EditText oEditVendor = (SAPbouiCOM.EditText)m_SBO_Form.Items.Item(enControlName.txtVendorCode).Specific;

                                        SAPbouiCOM.EditText OEditVenName = (SAPbouiCOM.EditText)m_SBO_Form.Items.Item(enControlName.txtVendorName).Specific;

                                        SAPbouiCOM.ComboBox oType = (SAPbouiCOM.ComboBox)m_SBO_Form.Items.Item(enControlName.ComboType).Specific;

                                        SAPbouiCOM.EditText oReqNum = (SAPbouiCOM.EditText)m_SBO_Form.Items.Item(enControlName.txtDocEntry).Specific;

                                        SAPbouiCOM.EditText oProject = (SAPbouiCOM.EditText)m_SBO_Form.Items.Item(enControlName.txtPrjCode).Specific;

                                        SAPbouiCOM.EditText oRemarks = (SAPbouiCOM.EditText)m_SBO_Form.Items.Item(enControlName.txtTabRemarks).Specific;

                                        string VendorCode = oEditVendor.Value;

                                        string VendorName = OEditVenName.Value;

                                        string ReqNum = oReqNum.Value;                                       

                                        string str = btnCombo.Selected.Value;

                                        string Type = oType.Selected.Value;

                                        string Project = oProject.Value;

                                        string Remarks = oRemarks.Value;

                                        btnCombo.Caption = "Copy To";

                                        m_SBO_Form.Mode = BoFormMode.fm_OK_MODE;

                                         SAPbouiCOM.ComboBox oCombo = (SAPbouiCOM.ComboBox)this.m_SBO_Form.Items.Item(enControlName.comboApp).Specific;

                                         string combo = oCombo.Selected.Value.Trim();

                                         if (combo == "Pending")

                                         {

                                             this.SBO_Application.SetStatusBarMessage("Approve the document", SAPbouiCOM.BoMessageTime.bmt_Short, true);

                                             BubbleEvent = false;

                                         }

                                         else

                                         {

                                             if (str == "Inventory Transfer")

                                             {

                                                 if (Type == "Service")

                                                 {

                                                     Program.oMainSAPDI.ShowMessage("A document of Service Type can not be copied to Inventory Transfer.", BoStatusBarMessageType.smt_Error);

                                                     BubbleEvent = false;

                                                     return;

                                                 }

                                                 if (Type == "Item")

                                                 {

                                                     SAPbouiCOM.EditText edDocEntry = (SAPbouiCOM.EditText)this.m_SBO_Form.Items.Item(enControlName.txtDocEntry).Specific;

                                                     SAPbouiCOM.Form oForm = default(SAPbouiCOM.Form);

                                                     SAPbouiCOM.MenuItem oMenu = (SAPbouiCOM.MenuItem)SBO_Application.Menus.Item("3080");

                                                     oMenu.Activate();

                                                     oForm = (SAPbouiCOM.Form)SBO_Application.Forms.GetForm("940", pVal.FormTypeCount);

                                                     oForm.Mode = BoFormMode.fm_ADD_MODE;

                                                     SAPbouiCOM.Matrix oMatrixIP = default(SAPbouiCOM.Matrix);

                                                     oMatrixIP = (SAPbouiCOM.Matrix)oForm.Items.Item("23").Specific;

                                                     int rowCount = oMatrixIP.VisualRowCount;

                                                     K = rowCount;

                                                     SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)SBO_Company.GetBusinessObject(BoObjectTypes.BoRecordset);

                                                     string strIP = "Select U_ItemCode,U_ItemName,U_ReqQty from [@REQUISITIONDETAIL] where DocEntry = '" + edDocEntry.Value + "'";

                                                     oRecSet.DoQuery(strIP);

                                                     oMatrixIP = (SAPbouiCOM.Matrix)oForm.Items.Item("23").Specific;

                                                     while (oRecSet.EoF == false)

                                                     {

                                                         if ((oRecSet.Fields.Item("U_ItemCode").Value.ToString() != "") & (oRecSet.Fields.Item("U_ReqQty").Value.ToString() != "0"))

                                                         {

                                                             ((SAPbouiCOM.EditText)oMatrixIP.Columns.Item("1").Cells.Item(K).Specific).Value = Convert.ToString(oRecSet.Fields.Item("U_ItemCode").Value);

                                                             ((SAPbouiCOM.EditText)oMatrixIP.Columns.Item("10").Cells.Item(K).Specific).Value = Convert.ToString(oRecSet.Fields.Item("U_ReqQty").Value);

                                                             ((SAPbouiCOM.EditText)oMatrixIP.Columns.Item("U_ReqNumber").Cells.Item(K).Specific).Value = ReqNum;

                                                             ((SAPbouiCOM.EditText)oMatrixIP.Columns.Item("20").Cells.Item(K).Specific).Value = Project;

                                                             K = K + 1;

                                                         }

                                                         oRecSet.MoveNext();

                                                     }

                                                 }

                                             }

Hope it helps for you.

Thanks

Former Member
0 Kudos

Hi Ankit,

Thanks for the support. But what happening in my case is that when I select something through this button, the caption gets changed. Please help me in this.

Regards

edy_simon
Active Contributor
0 Kudos

Hi Kuldeep,

Combo button is not the same as the normal button.

Go into the screenpainter, there are 2 types of button.

Regards
Edy

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Kuldeep,

Set the oItem.AffectFormMode = false;

This will help you out.

Thanks

Former Member
0 Kudos

Thank you so much, I got it...........

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Good Job...U are Welcome............

Thanks

Answers (0)