Replace choosefromlist from SAPB1

Erik van Dongen

What i try to achieve is the following. When we go to the order form, i want to change the query from the choosefromlist linked to the Business Partner. I want the input to be compared with the CardCode, CardName and Block field.
Therefore, i catch the choosefromlist event as follow:

TextEdit.GetFromUID(e.Form, "4").AddHandler_ChooseFromList(ModeComponent.FormModes.ALL, modifyBusinessPartnerCFL);
This handler opens a Choosefromlist from coresuite and cancels the SAP B1 execution of the method to avoid the SAP choosefromlist from showing.
The code for the handler is as follow:
private void modifyBusinessPartnerCFL(ChooseFromList e)
SwissAddonFramework.UI.Dialogs.ChooseFromList cfl =
new SwissAddonFramework.UI.Dialogs.ChooseFromList(
new SwissAddonFramework.UI.Dialogs.ChooseFromList.DefaultSQLQuery(
"SELECT CardCode, CardName, Block AS Name2, City, Country FROM OCRD WHERE FrozenFor='N' AND (CardCode LIKE '[%constraint]' OR CardName LIKE '%[%constraint]' OR Block LIKE '%[%constraint]') ORDER BY [%ordercolumn] [%order]"),
"CardCode", true, false, TextEdit.GetFromUID(e.Form, "4"));
cfl.ShowInstance(false, TextEdit.GetFromUID(e.Form, "4").Value);
e.ExecuteSAPAction = false;

With the code above, i achieved the following.
The choosefromlist is opened and the filtering goes maybe a bit slow but the result is ok. After selecting a BP, the value is filled in the cardcode textbox. So far so good. The problem is that after this moment, i am not able anymore to move the cursor from the CardCode textbox. I can change the value into something else but it will never be moved from it. Even if i click somewhere else with the mouse.... What can i do to fulfill my requirement?
All help is appreciated.



Please sign in to leave a comment.

Didn't find what you were looking for?

New post