cancel
Showing results for 
Search instead for 
Did you mean: 

How to Change Row level Warehouse of Good Receipt PO Form through SDK.

former_member917522
Participant
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

edy_simon
Active Contributor
0 Kudos

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

former_member917522
Participant
0 Kudos

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);

}

}

edy_simon
Active Contributor
0 Kudos

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


former_member689126
Active Contributor
0 Kudos

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

former_member917522
Participant
0 Kudos

Hi

Thanks for reply

I used your code but still get Same error Item - Field is not Editable

edy_simon
Active Contributor
0 Kudos

Hi akshaya,

Can you try to  change the warehouse code from SBO application manually ?

See if you have the same error ?

Also try to put the event on after validate event as suggested by

Regards
Edy

former_member917522
Participant
0 Kudos

Hi

Thanks for Reply

I used validate event because of this when i run my solution first time, i open Good Receipt PO form  its show current new value of warehouse which i want but when i open same form second time SAP get Closed automatically.

former_member917522
Participant
0 Kudos

Hi

Thanks for Reply

I used validate event because of this when i run my solution first time, i open Good Receipt PO form  its show current new value of warehouse which i want but when i open same form second time SAP get Closed automatically.

former_member689126
Active Contributor
0 Kudos

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


former_member917522
Participant
0 Kudos

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);

  1. 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);

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;

  1. clsAddOn.LDNA_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, true);

}

}

}

catch (Exception ex)

{

  1. clsAddOn.LDNA_Application.MessageBox(ex.Message);

}

}

}

former_member689126
Active Contributor
0 Kudos

Hi Akshaya,

Could you please tell you SAP B1 Version and Patch .

Regards

Arun

former_member917522
Participant
0 Kudos

Hi Arun

Thanks so much for Reply

SAP B1 9.0 Patch -5

former_member689126
Active Contributor
0 Kudos

Hi,

Yes there is a problem with  that code , it will create a recursive call to the same event . you must handle that, please see the code sent by me it will work , i have handle this scenario in that code .

or please send me your complete code i will check it .

Thanks

Arun

former_member917522
Participant
0 Kudos

Hi Arun

Realy thanks so much

I used your ur both code but same error get from both the code.

please send me correct code .

former_member689126
Active Contributor
0 Kudos

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

former_member917522
Participant
0 Kudos

Hi

Thanks For Reply

former_member689126
Active Contributor
0 Kudos

Hi

Is that code worked ?

Regards

Arun

former_member917522
Participant
0 Kudos

Hi Gm

thanks So much For Reply

Your code is work.

former_member689126
Active Contributor
0 Kudos

GM ......

former_member917522
Participant
0 Kudos

Hi Gm

Thanks for reply

Answers (0)