on 07-13-2012 7:47 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.