on 10-29-2013 12:31 PM
Hi Expert
How to Change Row level Warehouse of Good Receipt PO Form through SDK.
Once you select Item in matrix of Good Receipt PO form WhsCode fill Automatically But Iwant to Change that WhsCode through code.
Hi Akshaya,
On After Choose From List event of Item Code insert this code :
Dim oMtx as SAPbouiCOM.Matrix = oform.Items.Item("38").Specific
oMtx.GetCellSpecific("24",pVal.Row).Value = "NewWhsCode"
Regards
Edy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
thanks for reply
I write same line but its show error "Item - Form item is not editable"
if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST && pVal.Before_Action == false && pVal.ItemUID == "38" && pVal.ColUID == "1")
{
try
{
oForm = clsAddOn.LDNA_Application.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount);
SAPbouiCOM.DBDataSource oDBS_Details;
oDBS_Details = oForm.DataSources.DBDataSources.Item("PDN1");
oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal;
sCFL_ID = oCFLEvento.ChooseFromListUID;
oForm = clsAddOn.LDNA_Application.Forms.Item(pVal.FormUID);
oCFL = oForm.ChooseFromLists.Item(sCFL_ID);
oDataTable = oCFLEvento.SelectedObjects;
if (oDataTable != null)
{
oForm.Select();
string Wharehouse = oForm.Items.Item("edtWhsCd").Specific.value;
oMat = oForm.Items.Item("38").Specific;
try
{ oMat.GetCellSpecific("24", 1).Value = "Wharehouse"; }
catch (Exception ex)
{ //form - bad value issue
}
}
if (oForm.Mode != SAPbouiCOM.BoFormMode.fm_ADD_MODE)
oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE;
}
catch (Exception ex)
{
BubbleEvent = false;
clsAddOn.LDNA_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, true);
}
}
Hi Akshaya,
oMat.GetCellSpecific("24", 1).Value = "Wharehouse";
remove the QuotationMark (") on the Wharehouse.
oMat.GetCellSpecific("24", pVal.Row).Value = Wharehouse;
And go to your GoodReceiptPO Screen, goto form setting-table format. check and make sure your Warehouse column is active.
Regards
Edy
Hi Akshaya,
can you try this instead of cfl event use validate event and pVal.Before_Action == false in item code column .
if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_VALIDATE && pVal.Before_Action == false && pVal.ItemUID == "38" && pVal.ColUID == "1")
{
try
{
oForm = clsAddOn.LDNA_Application.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount);
SAPbouiCOM.DBDataSource oDBS_Details;
oDBS_Details = oForm.DataSources.DBDataSources.Item("PDN1");
string Wharehouse = oForm.Items.Item("edtWhsCd").Specific.value;
oMat = oForm.Items.Item("38").Specific;
try
{
oMat.GetCellSpecific("24", pval.Row).Value = Wharehouse;
}
catch (Exception ex)
{ //form - bad value issue
}
}
catch (Exception ex)
{
BubbleEvent = false;
clsAddOn.LDNA_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, true);
}
}
Regards
Arun
Hi Akshaya,
Try this code it is not the straight way but for me it works , i used this many times. Also make sure that warehouse column is visible in the form as suggested by Edy
private string oldItem = string.Empty;
private string newItem = string.Empty;
private void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
{
BubbleEvent = true;
if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST && pVal.Before_Action == true && pVal.ItemUID == "38" && (pVal.ColUID == "1" || pVal.ColUID == "3") && pVal.FormTypeEx == "143")
{
newItem = string.Empty;
}
if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST && pVal.Before_Action == false && pVal.ItemUID == "38" && (pVal.ColUID == "1" || pVal.ColUID == "3") && pVal.FormTypeEx == "143")
{
SAPbouiCOM.DataTable oDataTable = default(SAPbouiCOM.DataTable);
SAPbouiCOM.IChooseFromListEvent oCFLEvento = default(SAPbouiCOM.IChooseFromListEvent);
try
{
oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal;
oDataTable = oCFLEvento.SelectedObjects;
if (oDataTable == null)
return;
newItem = oDataTable.GetValue("ItemCode", 0).ToString().Trim();
}
}
catch (Exception ex)
{
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, true);
}
}
if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_VALIDATE && pVal.Before_Action == false && pVal.ItemUID == "38" && (pVal.ColUID == "1" || pVal.ColUID == "3") && pVal.FormTypeEx == "143")
{
SAPbouiCOM.Form oForm;
SAPbouiCOM.Matrix oMat;
SAPbouiCOM.EditText edittext;
try
{
oForm = SBO_Application.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount);
if (!oldItem.Trim().Equals(newItem.Trim()))
{
oldItem = newItem;
string Wharehouse = oForm.Items.Item("edtWhsCd").Specific.value;
oMat = (SAPbouiCOM.Matrix)oForm.Items.Item("38").Specific;
try
{
edittext = (SAPbouiCOM.EditText)oMat.GetCellSpecific("24", pVal.Row);
edittext.Value = Wharehouse;
}
catch (Exception ex)
{ //form - bad value issue
}
}
}
catch (Exception ex)
{
BubbleEvent = false;
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, true);
}
}
}
Regards
Arun
Hi Arun,
Thanks for Fast Reply
Still when I run my solution SAP get Closed when I open Good Receipt Form 2 time
Please Check my Code and tell me what the wrong in that
public static void LDNA_Application_ItemEvent(SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
{
BubbleEvent = true;
if (pVal.FormTypeEx == "143")
{
try
{
if (pVal.Before_Action == false)
{
if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_VALIDATE && pVal.ItemUID == "38" && pVal.ColUID == "1")
{
try
{
oForm = clsAddOn.LDNA_Application.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount);
oDBS_Details = oForm.DataSources.DBDataSources.Item("PDN1");
oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal;
sCFL_ID = oCFLEvento.ChooseFromListUID;
oForm = clsAddOn.LDNA_Application.Forms.Item(pVal.FormUID);
oCFL = oForm.ChooseFromLists.Item(sCFL_ID);
string Wharehouse = oForm.Items.Item("edtWhsCd").Specific.value;
oMat = oForm.Items.Item("38").Specific;
try
{
oMat.GetCellSpecific("24", 1).Value = Wharehouse;
}
catch (Exception ex)
{
BubbleEvent = false;
clsAddOn.LDNA_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, true);
return;
}
}
catch (Exception ex)
{
BubbleEvent = false;
}
}
}
catch (Exception ex)
{
}
}
}
Hi
I tried to attach the complete solution i created to check your issue , but it is not allowed . Please send your mail id i will forward the code or send me test mail to my id aruntb@gmail.com.
Regards
Arun
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
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.