You are on page 1of 65

B1 SDK New Features

B1 SDK chapter of the new control ButtonCombo


Monday, May 30th, 2011

Author: Warren Jiang In B1 8.8, there is a new control appears.Such as the following form to switch the company's "New" control, the control left side, like a Button, right-click on the small side, after a drop-down list (ComboBox), when you select an item when the drop-down list, this one The text on the left side of Button's title:

In the 8.8 SDK, we have developed this new control (which is the SDK UIAPI 2007A / B, 8.8, 8.8SP1 three versions on the market only developed a new control), here we have to introduce it, first of all we look at this new object of class diagram: As previously mentioned, when we introduce the object of, ButtonCombo to some extent a combination of Button and ComboBox, so it's methods, properties, and the corresponding information can also be seen, respectively, the shadow Button and ComboBox, for example: Selected, ValidValues, DataBind properties, and Select, SelectExclusive methods, and ItemEvent following et_COMBO_SELECT news comes from the ComboBox, the Caption and et_ITEM_PRESSED other to some extent comes from the Button.

Here we use an example to introduce, first of all we create a ButtonCombo, sample code is as follows: oItem = oFirstForm.Items.Add ("bc", SAPbouiCOM.BoFormItemTypes.it_BUTTON_COMBO); oItem.Top = (oFirstForm.Height - oItem.Height) / 2 - 30; oItem.Left = (oFirstForm.Width - oItem.Width) / 2; SAPbouiCOM.ButtonCombo oBC = oItem.Specific as SAPbouiCOM.ButtonCombo; The results are:

If the title with the words: oBC.Caption = "set value";

If you click ButtonCombo this time on the left half, there will be a settlement of the action, this time the background is item_pressed messages sent; if we click ButtonCombo the right part, the interface does not have any reaction, because there is not any drop-down list RMS, we have to add the following valid values, as shown in the following code: oBC.ValidValues.Add ("Shanghai Heavy Industry," "heavy-duty factory"); oBC.ValidValues.Add ("Hunan TV", "mass media"); oBC.ValidValues.Add ("Little Sheep", "food industry");

If you click on the right this time, the drop-down list, there will be three valid values to start, if the selected one of the valid values, the selected value will appear in ButtonCombo title, the new operating results as shown below:

However, controls are often the direct source and background data binding, not hard-coded manually add the following, we will use the DataBind method, the use of the code is as follows: oFirstForm.DataSources.DBDataSources.Add ("OCRD"); oBC.DataBind.SetBound (true, "OCRD", "CardType"); The results are shown below:

And there are a prerequisite for the field itself is OCRD of CardType there are three valid values.For the case of pure custom, customers typically can add your own user-defined fields, and then userdefined fields in the effective value added above, can refer to DIAPI of UserFieldsMD user manual as shown below, this is not how to add user-defined fields RMS detail.

To illustrate the use of information and ButtonCombo the Select method, here we introduce a slightly more complex example, at the interface and then add a text box EditText, as shown below:

The function we want to achieve is that when selecting a value in ButtonCombo inside when the description of this option to fill in the inside left EditText:

if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_COMBO_SELECT & & pVal.Before_Action == false) { (OFirstForm.Items.Item ("edit"). Specific as SAPbouiCOM.EditText). Value = oBC.Selected.Description; } The results are:

In fact the above scenarios have partners like to use the following method, instead of using the Selected property: (OFirstForm.Items.Item ("edit"). Specific as SAPbouiCOM.EditText). Value = oBC.ValidValues.Item (pVal.PopUpIndicator). Description; Here PopUpIndicator valid serial number identifies the choice, for example, the figure is 2. If we need to deal with the ButtonCombo Click above logic, we need to deal with ITEM_PRESSED news, there is code sample is as follows: if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED & & pVal.ItemUID == "bc" & & pVal.Before_Action == false) { SBO_Application.MessageBox (oBC.Caption, 1, "OK", "Cancel", ""); } Select and SelectExclusive on usage and Combobox object of no difference, the user also can index, value and description of three dimensions to choose if you want the choice of these three dimensions can be applied one by one, until you find the line Valid values for the conditions, you should choose Select, if you want to choose a particular certain dimensions, you can use the latter. In short, ButtonCombo is that not only need to click, and select the scene with RMS provides a good choice, the user may wish according to their needs, to the scene before the need to replace both controls this control, let more simple interface provides more functionality.

Interpretation of batch numbers on sales receipts choice


Monday, May 30th, 2011

SAP Business One 8.8 in the serial number and batch management compared to the previous version has changed a lot.In particular, batch management, relative to the serial number, because the

number of variable batch, batch number during selection, the interface is more complex.The purpose of this paper is the interpretation of sales orders, delivery orders and other sales documents on the batch number of choices. Sales orders and invoices receivable reserve material impact the number of documents have been committed to the batch number on the choice Let us take sales orders, for example: Material "batchItem" through batch management, inventory a total of 100, lot number is "b1", now we create a sales order that contains 2 lines, each line has five " batchItem ".

Choice during the batch number, as shown above, the system will display various information to help users choose, respectively, evidence the line, can be selected batches and batches. Certificate showing the sales order line for each row corresponding material information, including item number, warehouse, quantity, etc. Select the first line of evidence the line, we can "Available Batch" column to see the current available is 99.This value is subtracted from the inventory of 100 on the first line we have chosen one ("Selected Batch" column choice number) to get."Selected Batch" column total is equivalent to the choice of the number line on the first line of evidence "has been selected a total of"; "Selected Batch" column equal to the number of batches of documents on the line "total batch" .Certificate line "aggregate demand" equal to "number" - "have chosen the total." Need to explain is "available batch" column of the assigned amount.This value represents all of the batch assigned by the number of other documents, including other sales orders, invoices and

accounts set aside the sales order number assigned to other lines.In our case, this sales order is the second line "has selected aggregate." Now let's read the second line:

As the second line of the selected batch column has selected two, then the corresponding number of available lots is available for 98 (100-2), assigned amount is the first line of one, the certificate is the aggregate demand line 3 ( 5-2). Users can fill out the batch of "the number of selected" best of the batch can not exceed "the number of available" - "assigned amount." Just described is reserved for sales orders and invoices and other accounts material impact on the number of documents have been committed on the batch number selection.Next we see the impact of material documents the amount of inventory, what is the situation. Delivery orders and invoices and other accounts material impact on the amount of inventory receipts batch number on the choice Let us take the delivery order as an example: Create a sales order that contains 2 lines, each line has five "batchItem".

Batch number and sales order selection interface is similar, the difference is "selected batch" column does not affect the number of options "available batch" but the available quantity of assigned amount.This is because the delivery orders and other documents do not affect the number of materials have been committed, but the inventory.So we can see is always assigned the number 3 (which goes on sale before the order is due).Number 93 is currently available inventory quantity 100 minus the first line of the second line 3 minus 4 calculated. Note that delivery orders and other documents are all requirements must be met before it is added to the database.That is, the total demand for all lines must be 0.Sales orders and other documents is not the limit. Just introduced a common delivery order, then we see if it is copied from the sales order delivery order is what happens. Delivery based on a single sales order batch number on the choice The normal delivery than in a single complex, allow us to sales orders prior to delivery a single copy, for example:

Beginning, delivery orders will inherit the batch number on the sales order number of choices (the first line of a second line 2).At this point we can see the assigned number becomes 0, and the number becomes available 97.This is because the number of sales orders for the distribution of this delivery order will be cleared, and the delivery order the current distribution of the three materials, the available number of 100-3. But do not forget the delivery order can modify the selected sales order batch.For example the first line choice of a number of "<" button to return, then we can see:

As the second row selection is currently only two, the number became available 98 (100-2), or the number assigned to 0.However, if we choose to document the line second line, you can see:

At this point the number assigned to 1, since the corresponding sales order number on the distribution of the first line of not being cleared.

We have just seen is copied from a sales order to delivery a single case.Here we come to understand the sales order invoice copy to the case of reserved receivables. Receivables based on sales order batch number on the invoice reserve selection Personally manifest to keep up with different accounts set aside the invoice only affect the number of materials have been committed.This is the same and sales orders.So when we copied from the sales order invoices receivable reserve, inherited the same batch Xuanze.Let's first sales order or to an example.Please note that before the delivery order does not really add.

The first line, and sales orders are identical.

The second line is identical. Let us now give a second line of multi-distribution:

At this point the second line select 3, so the number of available 97 (100-3), or an assigned number (from the first line).Let's go back to see the first line:

You can see the number assigned into 3 (from the second line changes). Here, like everything related to sales orders.Next is a different place, so we will select 1 into the second line, as shown below:

At this point, when we return to the first line, you can see the first line of the assigned amount and not become one, is still 2.

The reason is: is the behavior of units to submit documents, submitted as the first line, second line has not been submitted (not from the 2 into 1), so we must ensure that the assigned amount for the second line of the left margin .So we will choose the second row the current selection number (1) and the second choice of the number of rows in the database (2) the maximum amount of the allocation.Therefore, in the example is 2, while in the previous example is 3.

Holidays and lead-time impact on the material availability check


Monday, May 30th, 2011

Foreword SAP Business One 8.8 Check the availability of materials, including for holidays and the lead time calculation, if the material is later than the earliest available date results, the system will give advise.This paper describes the set of holidays and lead can affect the results. Holidays set

As shown above, the leave the system through the "Manage" -> "System Initialization" -> "Company Details" to access.

Users can choose to define new holidays or click the yellow arrow to modify the current holidays.Holidays, including the definition of weekend and holiday.Such as the current set 2011 October 1 to 7 for the National Day, the weekend is Saturday and Sunday. Materials lead set

In the material master data "program data" settings page, the user may need to set lead time.This setting will be used to check the MRP or materials are based on availability. Check material availability and lead time for holidays in the calculation of Assuming the current system date is September 28, 2011 Wednesday.Material lead time is 3 days, the weekend is Saturday and Sunday the festival is October 1, 2011 to 7 days.Then check the availability of materials will be calculated as follows:

Sunday Monday WeekendFestival +3 (2011.10.10 Weekend)

Wednesda Tuesday y ThursdayFriday Saturday 2011.9.28 +1 +2 Weekend Festival Festival Festival Festival Weekend

According to calculations, October 10, 2011 as the due date.If the material is the earliest available date after the due date, such as the October 11, 2011, then check the availability of materials will be prompted to "pay attention to the earliest available delivery date is later in the project cycle" as shown below:

If the material is the earliest available date before the due date, then the prompt will not appear. As for the material availability check how to calculate the earliest available date material, please refer to our previous blog post: "available to promise inventory status reports and enhanced material availability check"

B1 SDK 8.8 SP1 special line of summary columns and articles


Monday, May 30th, 2011

Author: Warren Jiang Unlike any previous version, this version of the B1 8.8 SP1, we interface to the Matrix and Grid focus on enhancing the functionality to do, including cell-based configuration, a special line, and the matrix columns, these features are on the market expectations long feature article devoted to the special line and summary columns. What is the special line?B1 line is not a special or exclusive control terminology, such as the link button (LinkButton) be a B1-specific controls, special line is our custom, a small feature set, specifically in the Marketing Document on the following conditions:

In the "Type" column (by default "type" column is not displayed, the user can set the form shown in the column to), different from the drop-down list displays only the text of the function, the dropdown list which can also display the icon.In addition, the second column in the Matrix, we see a very long inside the cell like Excel merged cells, which can put a long text.When you need to add and when, above the line in Canada and there is a separation of the bold line to indicate that it is added and the line, and is a common line for the plus and above.Here we introduce how the SDK UI API to Matrix / Grid to achieve the drop-down list shows the icon, and split the merged cell line functions. Drop-down list shows the icon oColumn = oMatrix.Columns.Add ("Picture", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX); oColumn.TitleObject.Caption = "col1"; oColumn.ColumnSetting.DisplayType = APbouiCOM.BoColumnDisplayType.cdt_Picture; oColumn.DataBind.SetBound (true, "", "user1"); oCombo = SAPbouiCOM.ComboBox) oColumn.Cells.Item (1). Specific; oString = "C: \ \ Bitmap \ \ myvalidvalue.bmp"; oCombo.ValidValues.Add (oString, "non-B1 system image"); oCombo.ValidValues.Add ("T", "Text"); oCombo.ValidValues.Add ("A", "Alternative"); oCombo.ValidValues.Add ("S", "SubTotal"); The above code the results below:

The most important line of code is: oColumn.ColumnSetting.DisplayType = APbouiCOM.BoColumnDisplayType.cdt_Picture; For the Grid, this part of the code is slightly different, as follows: oGridColumn = oGrid.Columns.Item (0); oGridColumn.Type = SAPbouiCOM.BoGridColumnType.gct_ComboBox; oComboColumn = SAPbouiCOM.ComboBoxColumn) oGrid.Columns.Item (0); oComboColumn.ColumnSetting.DisplayType = SAPbouiCOM.BoColumnDisplayType.cdt_Picture; In addition, according to B1 UI API's usage (in fact, determined the structure of B1), all of the recommended back-interface controls are bound to a data source, so here we are bound to a user data source: oColumn.DataBind.SetBound (true, "", "user1"); Drop-down list on the inside of the picture, there are two types: One is the B1 system, which appeared in the picture, such as the above Text, Alternative and SubTotal pictures are pictures that appear in the system, users can directly use the symbol within the logo "T", "A", and "S", but B1, and identifiers of all internal correspondence between the images do not open it, we can consider the future or help documents provided by SDN. Another type is the user to use their own images, this should be more general, the user can put their own picture of the path as the first parameter input, the other bmp or png formats are supported. oCombo.ValidValues.Add ("C: \ \ Bitmap \ \ myvalidvalue.bmp", "non-B1 system image"); B1 system comes with the drop-down list icon is 10 * 10 size, in this case I provide a custom icon is 19 * 13 size, so the requirements for the icon is not mandatory, but can not be too far behind such systems LOGO picture B1 is 266 * 132, as shown below:

If the drop-down list with the following code into the inside,

oCombo.ValidValues.Add ("LOGO", "test the big picture"); Can not be a good show:

So the image size must be appropriate in a certain range can be, I tried, people can be arbitrarily large width, for example, 200 + still to complete the image above shows that height must be less than 15 pixels can only be a good show. Merge Cells oMatrix.CommonSetting.MergeCell (1, 2, true); oCells = oMatrix.Columns.Item (2). Cells; / / second column oEditText = oCells.Item (1). Specific as SAPbouiCOM.EditText; / / first line oEditText.Value = "This is a very long long text"; oMatrix.CommonSetting.MergeCell (3, 2, true); oEditText = oCells.Item (3). Specific as SAPbouiCOM.EditText; / / third line oEditText.Value = "This is another longer longer longer longer longer text"; The above code the results below:

The most important code is as follows: oMatrix.CommonSetting.MergeCell (1, 2, true); The first parameter is the line number, the second parameter is the starting position of the merged cell, the third parameter is UIAPI feature parameters, the equivalent of switching the function of the function parameters.That is here to address the first line, second column to the fifth column of four cells to merge.To cancel this merger, we can use the third parameter: oMatrix.CommonSetting.MergeCell (1, 2, false);

Perhaps the experience of the SDK and have a careful user will find why we feature only the second parameter of this merged cell starting position, there is no end of the merged cell?That is because B1 is designed for starting position at the back not to redraw all of the columns, so the following code on the map and the result is the same. oMatrix.CommonSetting.MergeCell (1, 2, true); oCells = oMatrix.Columns.Item (2). Cells; / / second column oEditText = oCells.Item (1). Specific as SAPbouiCOM.EditText; / / first line oEditText.Value = "This is a very long long text"; oMatrix.CommonSetting.MergeCell (3, 2, true); oEditText = oCells.Item (3). Specific as SAPbouiCOM.EditText; / / first line oEditText.Value = "This is another longer longer longer longer longer text"; oCells = oMatrix.Columns.Item (4). Cells; / / fourth column oEditText = oCells.Item (1). Specific as SAPbouiCOM.EditText; oEditText.Value = "test"; Even the first line of the fourth column of the cell is set to the "test" the value, because when the first row, second column of the cell is set to merge after the beginning of the cell, the cells that line the back no longer perform heavy painted, so the back set of values do not appear in the interface. Therefore, the behavior of this function is a column from a row beginning to the end of the line out of the cell merger. Split line oMatrix.CommonSetting.SeparateLine (1, 0, SAPbouiCOM.BoSeparateLineType.slt_Top, true); oMatrix.CommonSetting.SeparateLine (2,0, SAPbouiCOM.BoSeparateLineType.slt_Bottom, true); int redBackColor = Color.Red.R | (Color.Red.G << SAPbouiCOM.BoSeparateLineType.slt_Top, true); oFirstForm.Update (); The result of running the code as shown below: | (Color.Red.B <<16); oMatrix.CommonSetting.SeparateLine (4, redBackColor,

Note about the above code, there are two points to note: CommonSetting in the 8.8 SP1 version of the SDK to add new infrastructure objects / interfaces, to be shared between the Matrix and Grid with a property or method designed.In addition the code to use on red, of course, there are two color

techniques can be used.The two points of more detailed content, you can refer to another article I wrote "B1 SDK 8.8 SP1 form of control cell set up articles." For CommonSetting on SeparateLine method, the first parameter is the line number, the second parameter represents the color, because black is RGB (0,0,0) so the inside can be entered directly in the parameter 0.The third argument is that the location of dividing line, because the line number for the first line of argument indicated, there are two separate top and bottom lines.Therefore, as shown in the figure the second dividing lines, the following two code can produce the same effect: oMatrix.CommonSetting.SeparateLine (2,0, SAPbouiCOM.BoSeparateLineType.slt_Bottom, true); OroMatrix.CommonSetting.SeparateLine (3,0, SAPbouiCOM.BoSeparateLineType.slt_Top, true); However, the figure for the first split line, except the first and third parameters are used 1 and slt_Top, no other way. The fourth parameter and the previously mentioned MergeCell third parameter, are switching parameters, when this parameter is set to false, when you can get rid of the interface has been drawn dividing lines. Summary Column B1 as a business software often do aggregate calculations, like the B1 form below:

So in 8.8 SP1, SDK has developed this functionality, refer to the following code: oUsrDS3 =oFirstForm.DataSources.UserDataSources.Add ("user0", SAPbouiCOM.BoDataType.dt_PRICE, 20); oUsrDS =oFirstForm.DataSources.UserDataSources.Add ("user1", SAPbouiCOM.BoDataType.dt_PRICE, 20); oUsrDS2 =oFirstForm.DataSources.UserDataSources.Add ("user2", SAPbouiCOM.BoDataType.dt_PRICE, 20); oColumn = oMatrix.Columns.Add ("test1", SAPbouiCOM.BoFormItemTypes.it_EDIT); oColumn.TitleObject.Caption = "col1";

oColumn.Width = 80; oColumn.Editable = true; oColumn.DataBind.SetBound (true, "", "user0"); oColumn = oMatrix.Columns.Add ("test2", SAPbouiCOM.BoFormItemTypes.it_EDIT); oColumn.TitleObject.Caption = "col2"; oColumn.Width = 80; oColumn.Editable = true; oColumn.DataBind.SetBound (true, "", "user1"); oColumn2 = oMatrix.Columns.Add ("test3", SAPbouiCOM.BoFormItemTypes.it_EDIT); oColumn2.TitleObject.Caption = "col3"; oColumn2.Width = 80; oColumn2.Editable = true; oColumn2.DataBind.SetBound (true, "", "user2"); oMatrix.AutoResizeColumns (); oDBDS.Query (null); oMatrix.LoadFromDataSource (); oMatrix.AddRow (5, 0); for (int i = 1; i <= 5; i + +) { oUsrDS3.ValueEx = "" + 3.1 * i; oUsrDS.ValueEx = "" + 2.1 * i; oUsrDS2.ValueEx = "" + 1.1 * i; oMatrix.SetLineData (i); } oColumn.ColumnSetting.SumType = SAPbouiCOM.BoColumnSumType.bst_Auto; oColumn2.ColumnSetting.SumType = SAPbouiCOM.BoColumnSumType.bst_Auto; The above code the results as shown below:

The previous code is made to build a summary of the Matrix, the most critical code is the following oColumn.ColumnSetting.SumType = SAPbouiCOM.BoColumnSumType.bst_Auto It can be seen as setting out this line of code, automatically has a column on the bottom of the summary of the cell, and automatically do a summary.However, in many cases, the bottom of the column is not a simple summary of the above summary of the data line, but there are intermediate calculations.Given this situation, we have a manual summary type, refer to the following code: oColumn.ColumnSetting.SumType = SAPbouiCOM.BoColumnSumType.bst_Manual; oColumn.ColumnSetting.SumValue = "999.1"; Add the above code to the code behind, running can get the following results:

B1 SDK of 8.8 (PL13, PL19) introduced a new feature article (II)


Monday, May 30th, 2011

Author: Warren Jiang In "B1 SDK introduces new features of the 8.8 patch article (a)" was mentioned at the beginning, the SDK in the 8.8 patch which features three new features: voice of the high market demand, the code is relatively simple and low risk.Readers can get few of the features described in this article further understand these characteristics, it is precisely because such features, partners and friends, you can quickly and more easily to these new features into your application system, the solution for you program building blocks. Type the password text box (PL13) In the absence of this feature, partners often use ItemEvent inside et_KEY_DOWN subtype to capture keyboard input, to force any keyboard input into a "*", this practice is not good is to increase the complexity of the code (since had to deal with the species of special keys, key combinations, etc.), in addition to making the performance will fall.So we in the EditText object / interface above to add a new read-write property IsPassword able to convert ordinary text box type a password text box.See the following code:

oItem = oForm.Items.Add ("edit", SAPbouiCOM.BoFormItemTypes.it_EDIT); oItem.Top = oForm.Height / 2 - oItem.Height; oItem.Left = 20; oEditText = oItem.Specific as SAPbouiCOM.EditText; oItem = oForm.Items.Add ("pass", SAPbouiCOM.BoFormItemTypes.it_EDIT); oItem.Top = oForm.Height / 2 - oItem.Height; oItem.Left = oForm.Width - oItem.Width - 20; oEditText = oItem.Specific as SAPbouiCOM.EditText; oEditText.IsPassword = true; Other codes are designed to adjust the screen size for better display of this function, the last line of code is the key, the code the results as shown below:

Although the right of the Password text box can not see any input from the interface, but the programmer can use the following two lines of code in any way to obtain the true value of the password input box: oString = oEditText.Value; oString = oEditText.String; This is for the UIAPI which operate this function, the same can ScreenPainter which we operate, see the following design and preview:

Gets the default size (PL13) There is this feature, partner if you want to get the control's default size, they had to form inside the system to find a "model" control, and then check the size of the control as a custom size from the default value.This approach can work, but not very elegant, extreme, when the user opens a program had to first form will not be used, is to find a "model" control, and then get the size of the control after and then "secretly" to turn off this form, as if nothing had happened.Now you can forget about this method, please refer to the following example code: int defW1 = SBO_Application.GetFormItemDefaultWidth (SAPbouiCOM.BoFormSizeableItemTypes.fsit_BUTTON); int defH1 = SBO_Application.GetFormItemDefaultHeight (SAPbouiCOM.BoFormSizeableItemTypes.fsit_BUTTON); int defW2 = SBO_Application.GetFormItemDefaultWidth (SAPbouiCOM.BoFormSizeableItemTypes.fsit_COMBO_BOX); int defH2 = SBO_Application.GetFormItemDefaultHeight (SAPbouiCOM.BoFormSizeableItemTypes.fsit_COMBO_BOX); Here is the example of the type Button and ComboBox controls, in fact, two ways to support the following types of controls:

In fact to get space in the system to change the default font size when the even more useful, because when the font changes, B1 interface on a variety of space will be changed accordingly, so we can use UIAPI, AppEvent under the sub-message and then change the font with our new method above to get the current default font size under control, please refer to the following sample code: void SBO_Application_AppEvent (SAPbouiCOM.BoAppEventTypes EventType) { if (EventType == SAPbouiCOM.BoAppEventTypes.aet_FontChanged) { int fontSize = SBO_Application.FontHeight; String fontName = SBO_Application.FontName; int defW1 = SBO_Application.GetFormItemDefaultWidth (SAPbouiCOM.BoFormSizeableItemTypes.fsit_BUTTON); int defH1 = SBO_Application.GetFormItemDefaultHeight (SAPbouiCOM.BoFormSizeableItemTypes.fsit_BUTTON); oString = "Button default length is" + defH1 + ", default width is" + defW1; SBO_Application.MessageBox (oString, 1, "confirm", "Cancel", ""); } } Here is the font to 12, respectively to 10 and run time results, the reader can note changes in the value of the pop-up box:

Practice the user will capture the message, save all the current font under the control's default value for the below form and its controls to build preparation. With this feature, we also opened up the font size and font name on two such properties, making the whole more functions, as shown below: int fontSize = SBO_Application.FontHeight; String fontName = SBO_Application.FontName; System Matrixcustom field column ChooseFromList (PL19) All along, UIAPI Matrix on the system custom field column defined as a system tray (although it is the custom, but it is the user to add fields in the child table, the system automatically generated to help), so this column do much the same as the restrictions on the system, but as customers of this column is not like the system columns not pure user needs more and more, we have gradually improved on it new features, such as "B1 SDK New Features of the 8.8 patch article (a) "the introduction of performance for this column, of course, include in this section ChooseFromList function. Assuming there is no existing binding ChooseFromList a custom field as follows:

Create and bind ChooseFromList:

oForm = SBO_Application.Forms.GetForm ("142", 1); SAPbouiCOM.ChooseFromListCollection cflCollection = pForm.ChooseFromLists; SAPbouiCOM.ChooseFromListCreationParams cflParams = (SAPbouiCOM.ChooseFromListCreationParams) SBO_Application.CreateObject (SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams); cflParams.MultiSelection = false ; cflParams.ObjectType = "2"; cflParams.UniqueID = "mycfl"; SAPbouiCOM.ChooseFromList cfl = cflCollection.Add (cflParams); SAPbouiCOM.Conditions oConditions = cfl.GetConditions (); SAPbouiCOM.Condition oCond = oConditions.Add () ; oCond.Alias = "CardType"; oCond.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; oCond.CondVal = "C"; cfl.SetConditions (oConditions); oMatrix = (SAPbouiCOM.Matrix) oForm.Items.Item ("38" ). Specific; oColumn = oMatrix.Columns.Item ("U_TEST"); oColumn.ChooseFromListUID = "mycfl"; Messaging: private void SBO_Application_ItemEvent (String FormUID, REF SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent) { IF (pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) { SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; oCFLEvento = ((SAPbouiCOM.IChooseFromListEvent) (pVal) ); String sCFL_ID = null; sCFL_ID = oCFLEvento.ChooseFromListUID; oForm = null; oForm = SBO_Application.Forms.Item (FormUID); SAPbouiCOM.ChooseFromList oCFL = null; oCFL = oForm.ChooseFromLists.Item (sCFL_ID); IF (oCFLEvento. BeforeAction == false) { SAPbouiCOM.DataTable oDataTable = null; oDataTable = oCFLEvento.SelectedObjects; String Val = null; try {

Val = System.Convert.ToString (oDataTable.GetValue (0, 0)); } catch (Exception EX) { } oItem = oForm.Items.Item (pVal.ItemUID); IF (oItem.Type == SAPbouiCOM.BoFormItemTypes.it_MATRIX) { oMatrix = (SAPbouiCOM.Matrix) oItem.Specific; oMatrix.SetCellWithoutValidation (1, "U_TEST", Val); } } } } Pieces of the results as shown below:

Obviously this is very useful, because the use of custom user list is very extensive, but the SDK implementation is concerned, we do not add any new methods or properties, we have done all the changes in the lower, the user need only Add-on to add the code inside the Matrix ChooseFromList message handling on the line, the code is related to the above there have been over this a few lines of code: IF (oItem.Type == SAPbouiCOM.BoFormItemTypes.it_MATRIX) { oMatrix = (SAPbouiCOM.Matrix) oItem.Specific; oMatrix.SetCellWithoutValidation (1, "U_TEST", Val); }

B1 SDK of 8.8 (PL12-PL13) introduced a new feature article


Friday, May 27th, 2011

Author: Warren Jiang

In B1 8.8 version after the official release, B1 has launched many patch, different from the past practice of only bug is in the repair patch which we have many good features, these functions usually have the following three characteristics: The first is the market needed features such as performance, such as partners, a feature so that they urgently need a solution to be more perfect.The second is that these functions are relatively small, the smaller is the concept?For the SDK, usually these features will not add a new object / interface, but in the current object / interface to add new methods / properties.The third is the structure of these functions do not change will not affect other functions, use very low risk of breaking compatibility. Here I am on the selection of which are more representative of the function to tell you, because 8.8 version of the market adoption rate has been relatively high, and hope that the partners can take advantage of these useful features, developing a more complete solution to satisfy our customers B1 . The main form and the "plug" in the custom field form (PL13): When a system object / form to add user-defined fields, and the main form that we can "plug" form (for the Chinese localized version of the main form to the right) to use these user-defined field, we can refer to the following "business partners" example:

Although we can type 134 and -134 were taken to the left and right form, but when open the form, when multiple business partners, will naturally be more custom fields in the form, we can not know which business partners to form Which is the custom field form and "hang" together.In order to facilitate the partners to obtain information in this section, we in the Form object / interface on the development of a new property UDFFormUID, by following simple code will be able to get business partners, the main form of custom fields corresponding instance of the form: oForm = SBO_Application.Forms.GetForm ("134", 1); oString = oForm.UDFFormUID; oForm = SBO_Application.Forms.Item (oString); When the custom field form is closed, the UDFormUID will be empty, so it can be used to determine whether the empty way to determine a corresponding "external" form is open. Drag event (PL12): We ItemEvent which developed a new sub-event is a drag event, when the drag some controls (the current main EditText control) when the drag event is thrown out with the specific parameters of this event as the favorite for the development of more brilliant features and extraordinary user experience partners is undoubtedly a weapon (first need to note is that this feature is currently only in the main control room and a small set of tools function is enabled when it is open).I once read a German partner to use this new feature developed a dynamic combination of the query function drag (the shape of tablet), is indeed extraordinary, as the author of this feature, I also did not expect.But this article easy to understand and to simplify the description, we will use the following example of a straightforward but plain to tell this new feature: private void SBO_Application_ItemEvent (string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent) { BubbleEvent = true; if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_Drag) { SAPbouiCOM.ItemDragEvent pItemDrag; pItemDrag = (SAPbouiCOM.ItemDragEvent) pVal; IF pItemDrag.TargetFormUID.ComPareto ("")! = 0) { oString = pItemDrag.TargetFormType; string formuid = pItemDrag.TargetFormUID; SAPbouiCOM.Form targetForm = SBO_Application.Forms.Item (formuid); oForm = SBO_Application.Forms.Item (FormUID); oItem = oForm.Items.Item (pVal.ItemUID);

SAPbouiCOM.Item targetItem; if (oItem.Type == SAPbouiCOM.BoFormItemTypes.it_EDIT) { targetItem = targetForm.Items.Add ("newitem", SAPbouiCOM.BoFormItemTypes.it_EDIT); targetItem.Top = pItemDrag.Top; targetItem.Left = pItemDrag.Left; targetItem.Width = oItem.Width; targetItem.Height = oItem.Height; SAPbouiCOM.EditText targetEdit = targetItem.Specific as SAPbouiCOM.EditText; targetEdit.Value = (oItem.Specific as SAPbouiCOM.EditText). Value; } } } } When we drag on business partners, business partners form a control code when the result of the above code as shown in the following Photos, when dragging a control and did not release the mouse, a rectangular goal frame generation, According to the target box the user can know the drag produced by the target event location, as shown below:

After releasing the mouse, drag and drop events with parameter values will be thrown again, the user can be programmed according to these parameters to produce the following effects:

Of course, this news is in the B1 drag on effective, so we can drag across the form, the form is selfevident is in the system and between user-defined form drag, as shown below:

Here we explain the code above: We ItemEvent of et_Drag subtype to drag the event filter. Corresponding sub-type is ItemDragEvent, the interface is inherited Itemevent interface, use the following type conversion required when: SAPbouiCOM.ItemDragEvent pItemDrag; pItemDrag = (SAPbouiCOM.ItemDragEvent) pVal; Here, incidentally, why not directly to the needs of the methods or properties on the ItemEvent inside it?The reason is because the SDK has been ItemEvent subtype ChooseFromListEvent exist, if

the method or property is placed directly inside ItemEvent, has been ChooseFromListEvent the call will run when the Add-on Crash, because the server and client binary sequence has been subjected to damage, it would be compatible as a typical case is destroyed. We only select the code behind the new functions or properties about.The following two lines of code and objectives form the so-called drag and drop target when the form is where the form ultimately rests with the cursor, which TargetFormType type of form is often used to filter a particular form.TargetFormUID is used to get an instance of the form: oString = pItemDrag.TargetFormType; string formuid = pItemDrag.TargetFormUID; The following two lines of code can get when you release the mouse when dragging the cursor coordinates, here is the consistent continuation of UI API use the traditional upper left coordinates: targetItem.Top = pItemDrag.Top; targetItem.Left = pItemDrag.Left; As shown above, drag the target form can be either source form, the system can also be other forms or custom forms, you can use TargetFormUID and FormUID are the same to be judged. User-defined fields in the column performance (PL13) We take a practical example to introduce the performance of the functions.Marketing certificates for the three lines to add user-defined fields, as shown below:

Open to cope with the invoice form, you can see the last three user-defined columns have been added automatically, and we have to add in the Matrix good material line 500, as shown below:

Here we are to compare the old methods and new methods of these three user-defined columns of 500 rows of data are needed to add more time. First we see the old way: oForm = SBO_Application.Forms.GetForm ("141", 1); oMatrix = oForm.Items.Item ("38"). Specific as SAPbouiCOM.Matrix; System.DateTime time1 = System.DateTime.Now; for (int i = 0; i <500; i + +) { oEditText = oMatrix.GetCellSpecific ("U_TEST", i + 1) as SAPbouiCOM.EditText; oEditText.Value = "test_" + i; oEditText = oMatrix.GetCellSpecific ("U_TEST2", i + 1) as SAPbouiCOM.EditText; oEditText.Value = "test2_" + i; oEditText = oMatrix.GetCellSpecific ("U_TEST3", i + 1) as SAPbouiCOM.EditText; oEditText.Value = "test3_" + i; } System.DateTime time2 = System.DateTime.Now; System.TimeSpan ts = time2 - time1; string result = ts.TotalSeconds.ToString (); System.Windows.Forms.MessageBox.Show (result); Spent a total of about 390 seconds, as shown below:

Then we look at the new approach: oForm = SBO_Application.Forms.GetForm ("141", 1); oMatrix = oForm.Items.Item ("38"). Specific as SAPbouiCOM.Matrix; System.DateTime time1 = System.DateTime.Now; for (int i = 1; i <= 500; i + +) { oMatrix.SetCellWithoutValidation (i, "U_TEST", "new_" + i); oMatrix.SetCellWithoutValidation (i, "U_TEST2", "new2_" + i); oMatrix.SetCellWithoutValidation (i, "U_TEST3", "new3_" + i); } System.DateTime time2 = System.DateTime.Now; System.TimeSpan ts = time2 - time1; string result = ts.TotalSeconds.ToString (); System.Windows.Forms.MessageBox.Show (result); Spent a total of about 1.2 seconds, as shown below:

390/1.2 = 325 times, the old method takes a new approach 325 times, in other words almost 100% performance increase for the above case there are four caveats: First I encountered the real case is a 10 + user-defined columns, thousands of lines of material, in this case the old and new performance comparison of two methods is even more striking, in order to save time, the author uses three, five hundred lines of such a case. Second above the old method is not in fact "old mess" because GetCellSpecific this method itself is through improved performance, compared to many of our partners used Matrix.Columns.Item (i). Cells.Item (j ). Specific, saving 4 * 3 * 500 = 6000 RPC call, if the new methods and take this "decrepit" method to compare, then it's not really mud cloud. The third is our new features thanks to Matrix objects / interfaces SetCellWithoutValidation way to get such a good performance, but as the name of this method, as it reduces the necessary logic verification, so the legitimacy of other data types also need programmers ready before the fill.However, users do not have to worry too much that in order to ensure the security of the system, our method is currently limited to only user-defined fields in the column to use. Finally, do an ad, if we can use GetCellSpecific do not go with the old stupid way Matrix.Columns.Item (i). Cells.Item (j). Specific, if we can use SetCellWithoutValidation, then forget GetCellSpecific it, because we Well has been in progress.

B1 SDK tool set of small articles


Thursday, May 26th, 2011

Author: Warren Jiang In "B1 SDK chapter of the main control room," a text, we have introduced the main control room related functions.Add-on for a real, I believe the light has the main control room is impossible, because the main control room is a container, the container's actual function still need a small tool set (Widget) to complete.This article is about and a small set of tools for interface, event partners, or

SDK programmers how to write their own small tools.In order to facilitate description and we understand that we still use the site interface to map below:

(Figure 1) Events from the interface and architecture to see, at the highest level Application interface below, a small set of tools have their own special events WidgetEvent, because the gadget can not be deployed in the existing set of windows, menus, status bars, etc. under any existing event.In this event, we have an event parameter as an interface WidgetEventData, the interface contains the sub-type of event, trigger the event and the location of the gadget window types and associated ID (on the associated window, we still talk back to.) addition to the new WidgetEvent, we also derive the following ItemEvent B1 ItemDragEvent to support drag and drop controls. The next level Cockpits (main control room set) interface, there are two and a small set of tools is related to: the type of registration and a small set of tools to get the gadget instance.In the Cockpit (single control room) interface the user can obtain the following set of interfaces Gadgets (Widgets),

you can move the assembly on the main control room, and you can save the changes in the assembly on the main control room, and finally we have created an instance of the gadget method. Adhering to the B1 UIAPI consistent design philosophy, in Widgets (small tools) Here we have a conventional interface, a collection of interfaces and some, such as taking a single object (Item), taking the number of individual objects in the collection (Count) two ways, of course, in order to facilitate programming context, which is also in the Widgets interface, where you can get to the current control room (Cockpit) interface type ID (Cockpit Type ID).In the Widget (single gadget) interface which has control of small tools minimize, maximize and close way, there are gadgets above a set of data persistence methods. Know the high-level structure, we discuss in detail the use and usefulness of these interfaces. How to register a gadget? About how to register in a small tool, we first clarify two concepts: the prototype gadgets and gadget instance.We sign up for a gadget that is actually registered for a class of small tools.

There are four types of default gadgets, "general purpose", "browser", etc. (shown above), which is a small tool type (prototype).For each type of gadget, the user can drag one or more instances of the gadget at the interface, for example, the user can drag a browser display the SAP home page, and you can drag a browser displays the current stock information. If you want to register a prototype of the gadget, we can use the interface to the following RegisterWidget Cockpits method, the specific code as follows: SAPbouiCOM.Cockpits wcs = SBO_Application.Cockpits; SAPbouiCOM.WidgetRegParams wrp = (SAPbouiCOM.WidgetRegParams) SBO_Application.CreateObject (SAPbouiCOM.BoCreatableObjectType.cot_WidgetRegParams); wrp.WidgetType = "AddonWidget"; wrp.CategoryUID = "own little set of tools"; wrp.WidgetName = "simple gadget"; wrp.ImagePath = "C: \ \ Bitmap \ \ mywidget.png"; wcs.RegisterWidget (wrp); The results are shown below:

Property is a small tool which WidgetType type ID, follow the news programming will be used to determine the value of this property as a condition or filter.CategoryUID is the gadget you want to add the parent directory.WidgetName is a gadget (menu) name.ImagePath As the name suggests, is the name of the gadget icon in front of the path. How to create a gadget instance? When the user drag the gadget to the interface work area when, UIAPI will throw WidgetEvent event, and bring the corresponding parameters.SDK programmer can capture this event, bound to custom window, creating a gadget instance. private void SBO_Application_WidgetEvent (ref SAPbouiCOM.WidgetData pWidgetData, out bool BubbleEvent) { BubbleEvent = true; if (pWidgetData.EventType == APbouiCOM.BoWidgetEventTypes.wet_created & & PWidgetData.WidgetType == "AddonWidget") { ... ... / / OForm UIAPI window is a standard variable, supposed to have been somewhere to achieve, not repeat them here pWidgetData.Form = oForm; oItem = tmpform.Items.Add ("Mygrid", APbouiCOM.BoFormItemTypes.it_GRID); oItem.Width = (int) (tmpform.Width * 0.9); oItem.Height = (int) (tmpform.Height * 0.9); oGrid = (SAPbouiCOM.Grid) oItem.Specific; oDataTable = tmpform.DataSources.DataTables.Add ("MyDataTable"); oDataTable.ExecuteQuery ("Select CardCode, CardName, CardType from OCRD"); oGrid.DataTable = oDataTable;

} } The results shown in the code:

Said earlier a small tool to drag and drop interface, workspace, UIAPI will throw an event, throw WidgetEvent accurate to say that the events of wet_created (another sub-type of event, we will be mentioned later), how to identify for which Gadget type of incident?We can use WidgetType conditional filter, where the "AddonWidget" is registered in front of us, when a small tool defined by the programmers themselves. Then we put a oForm bound to WidgetData the Form to go out type parameters.This design is mainly on account of a very simple Add-on to an existing form into a gadget instance - just a binding, migration is very convenient!We can look at this event debug outgoing WIdgetData structured as follows:

Note that we use the GUID to identify WidgetUID, the GUID is automatically returned. In addition to the use mouse to drag and drop interface to create messages generated Widet, create a small tool to capture the message instance.There is another way to generate an instance of the gadget, that is, use the following CreateWidgetInstance Cockpit object interface methods, as shown in the following code:

SAPbouiCOM.Widget oWidget = wcs.CurrentCockpit.CreateWidgetInstance ("AddonWidget", 2, 1); The first parameter "AddonWidget" is the previously mentioned types of ID, the second argument and third argument are the goal of creating an instance of the gadget should be placed where rows and columns. This method is called, the same code will execute the following message: private void SBO_Application_WidgetEvent (ref SAPbouiCOM.WidgetData pWidgetData, out bool BubbleEvent) { BubbleEvent = true; if (pWidgetData.EventType == APbouiCOM.BoWidgetEventTypes.wet_created & & PWidgetData.WidgetType == "AddonWidget") { ... ... oForm.Left = pWidgetData.Left; oForm.Top = pWidgetData.Top; pWidgetData.Form = oForm; ... ... } } It is important to pWidgetData.Left and pWidgetData.Top front CreateWidgetInstance function is based on the second and third parameters (2 and 1) the location corresponding to the pixel coordinates using the coordinates of the location can set the bound form. Persistence and anti-persistence A small tool to have data on the inevitable need for persistence, is not responsible for these programmers need their own infrastructure?No.(Of course, the pursuit of the perfect programmer's idea of nature can be constructed in accordance with their own persistence mechanism for a more complete, but we have to use the library for those inclined to consider the programmer).We have the Widget interface SetValue / GetValue methods.When closed, the B1, UIAPI throws WidgetEvent in wet_content_save subtype event, users can capture this event and call SetValue method to a key and the corresponding value stored in the database: IF (pWidgetData.WidgetType == "AddonWidget" & & pWidgetData.EventType == SAPbouiCOM.BoWidgetEventTypes.wet_content_save) { oWidget = SBO_Application.Cockpits.GetWidget (pWidgetData.WidgetUID); oWidget.SetValue ("Name", "WarrenJiang"); }

The next time gadget instances arise, users need to know if the key "Name" value when you can call GetValue ("Name") to get to the value (to the value obtained here is WarrenJiang) for use: IF (pWidgetData.WidgetType == "AddonWidget" & & pWidgetData.EventType == SAPbouiCOM.BoWidgetEventTypes. wet_created) { oWidget = SBO_Application.Cockpits.GetWidget (pWidgetData.WidgetUID); oString = oWidget.GetValue ("Name"); / / Do something with oString } Custom gadget menu Different from the general form, upper right corner of the gadget window is not maximized, minimize and exit buttons, replaced by a menu bar, click the menu item when the time pops up the corresponding function.For example, when the system is a gadget click the "browser" and "About" menu item when the pop-up company, version, etc., as shown above.Naturally, programmers and customers certainly want to customize the gadget inside has this feature, and can be customized, let's look at how to achieve it:

Simply put, when you click "menu item", the system will throw a specific message, customers can capture the expression of this news to build the appropriate information form, controls and so on.Words inside the "menu item," I marked the quotation marks, because these elements actually appear in the menu is not really the bottom B1 of Windows menus, so here we are not capturing MenuEvent, but ItemEvent, example code as follows: void buildParnterAbout () { oForm = SBO_Application.Forms.Add ("myabout", SAPbouiCOM.BoFormTypes.ft_Fixed, 0); oForm.Height = 188; oForm.Width = 411;

oForm.Title = "About"; oItem = oForm.Items.Add ("text1", SAPbouiCOM.BoFormItemTypes.it_STATIC); oItem.Width = 150; oItem.Left = 30; oItem.Top = 50; SAPbouiCOM.StaticText st = (SAPbouiCOM.StaticText) oItem.Specific; st.Caption = "This is a partner widget"; oItem = oForm.Items.Add ("text2", SAPbouiCOM.BoFormItemTypes.it_STATIC); oItem.Width = 150; oItem.Left = 30; oItem.Top = 70; st = (SAPbouiCOM.StaticText) oItem.Specific; st.Caption = "Version: XXX.XX.XXX.XXX"; oItem = oForm.Items.Add ("text3", SAPbouiCOM.BoFormItemTypes.it_STATIC); oItem.Width = 200; oItem.Left = 30; oItem.Top = 90; st = (SAPbouiCOM.StaticText) oItem.Specific; st.Caption = "copyright @ 2010 SSP, all rights reserved"; oItem = oForm.Items.Add ("1", SAPbouiCOM.BoFormItemTypes.it_BUTTON); oItem.Left = 10; oItem.Top = 125; oForm.Visible = true; } private void SBO_Application_ItemEvent (string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent) { BubbleEvent = true; if (pVal.FormTypeEx == "widgetform") { if (pVal.ItemUID == "PWC_SYS_ABOUT_ITM") { if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED & & pVal.BeforeAction == false) { oItem = SBO_Application.Forms.Item (FormUID). Items.Item (pVal.ItemUID);

buildParnterAbout (); } } } The above code the results as shown below:

Code "widgetform" is and gadget-bound form of the UID, which is captured by the user in a small form to create an event when the custom. "PWC_SYS_ABOUT_ITM" is on the menu fixed UID, all on the menu is the UID, because both the system or user-defined widgets (bound form of the container, so to understand) all the above menu system to create , so the UID can be fixed. Similarly, if the user wants to customize a "set" function, only need a UID of "PWC_SYS_SETTINGS_ITM" of ItemEvent for dealing with that, the same ideas and the above code will not repeat them here.

B1 SDK's 8.8 SP1 Matrix / Grid cell is set to articles


Friday, May 20th, 2011

Author: Warren Jiang Unlike any previous version, this version of the B1 8.8 SP1, we interface to the Matrix and Grid focus on enhancing the functionality to do, including cell-based configuration, a special line, and the matrix columns, these features are on the market expectations long feature article devoted to the cell configuration. In the past or whether Matrix Grid, all configuration is the smallest particle size column, the user if it is to a cell of a configuration, SDK will render you.(Except with Windows to handle directly over the B1 SDK Windows API programming, this programming effort and make the product introduction of uncertainty, like WPF and Winform 2.0, as well as joint programming Windows API, Microsoft in several cases are clearly instructions not to officially support same in B1 which, in particular with a form, the mixed use of B1 SDK and the Windows API is also not the right path.) Well now, there are

8.8 SP1 SDK for these functions, this part of the demand be solved Customers can "openly" in the B1 Matrix / Grid to do the above configuration developed. In introducing this part of the function, I first introduced in 8.8 SP1 this way, we introduce two versions of the infrastructure interfaces / objects, CommonSetting and ColumnSetting.Why introduce these two infrastructure?Because Matrix and Grid in many cases require the same functionality in the past we are in the Matrix and Grid to achieve the above set of COM interfaces, this design is clear from the code's appearance, maintainability and simplicity of the API point of view does not look good, so we introduced the Matrix and Grid in the above share so that the two sub-interfaces.CommonSetting in the Matrix and Grid objects that are shared between the two main controls, ColumnSetting suggests that it is in the Matrix Column and the Column Grid shared between, usually in the host-level properties and methods on CommonSetting, the column-level properties and methods on ColunSetting.Because of this shared object interface, making an already very different Matrix and Grid Code, to write very consistent, it is also based on this, this article uses all the sample code Matrix, for example, Grid above need only minor modifications. We say that the cell configuration includes the following: font color, font size, font style, background color, can edit and set the focus. Envisaged in the absence of any configuration, we have the following Matrix:

Font color: About the color, the color of all UIAPI values are shaping the interface type in the. Net, there are three ways you can set the color values The first is the direct use of integer values, such as a color value 22331 The second is to use C # macro calculation, this method only for the red, blue, green and other specific color. int greenForeColor = Color.Green.R | (Color.Green.G <<8) | (Color.Green.B <<16); The third is to construct any structure in RGB color: Color newRGBColor = Color.FromArgb (100, 100, 200); int rowForeColor = newRGBColor.R | (newRGBColor.G <<8) | (newRGBColor.B <<16);

Suppose on the front of the Matrix code set as follows: oColumn = oMatrix.Columns.Item (3); oColumn.ForeColor = greenForeColor; setting.SetRowFontColor (3, rowForeColor); int redBackColor = Color.Red.R | (Color.Red.G <<8) | (Color.Red.B <<16); setting.SetCellFontColor (3, 3, redBackColor); int color = setting.GetCellFontColor (3, 3); Will produce the following effects:

Explain the code below: In the new configuration previously developed in 8.8 SP1, Matrix's interface settings only for the column's.This version focuses on the development for us in cell configuration, but to the flexibility of the interface we have developed in line for the above configuration. So lines of code oColumn.ForeColor = greenForeColor was previously the old function is dyed green to the third column fonts.Lines of code setting.SetRowFontColor (3, rowForeColor) is a new feature, is the third line to the dye RGB (100, 100, 200) color.setting.SetCellFontColor (3, 3, redBackColor) is the third column to the third line of red dye cell.Note that the cell line of API and API, API has a column intersection, our design philosophy is the more effective the more the interface after the transfer, an example, let's use the API to set the third column as green, and then call the API to set the third line behavior RGB (100,100,200) color, then the API is because the line after the transfer, so the third line Limian the cell on the third column from the front of the green to RGB (100,100,200), Finally, we call the cell API, so this cell has been dyed red.If we reverse the order of these API calls, the interface is one of the colors will change.The last line of code setting.GetCellFontColor (3, 3) is to obtain the cell font color, return an integer value, used later in the cell also has a corresponding set value API cell value API, we will no longer be a a repeat. Background color: oColumn.BackColor = 34434; int redBackColor = Color.Red.R | (Color.Red.G << | (Color.Red.B <<16);

setting.SetRowBackColor (1, redBackColor); int blueBackColor = Color.Blue.R | (Color.Blue.G << setting.SetCellBackColor (1, 1, blueBackColor); The result of the code below: | (Color.Blue.B <<16);

Font-style: setting.SetRowFontStyle (4, SAPbouiCOM.BoFontStyle.fs_Italic); setting.SetRowFontStyle (3, SAPbouiCOM.BoFontStyle.fs_Strikeout); setting.SetCellFontStyle (2, 2, SAPbouiCOM.BoFontStyle.fs_Underline); setting.SetCellFontStyle (1, 4, SAPbouiCOM.BoFontStyle.fs_Bold); The result of the code below:

Font Size: oColumn = oMatrix.Columns.Item (2); setting.SetRowFontSize (5, 15); setting.SetCellFontSize (5, 2, 10); int fontSize = 0; fontSize = setting.GetCellFontSize (5, 2); oColumn.FontSize = 20;

The result of the code below:

Editable: setting.SetRowEditable (2, false); setting.SetCellEditable (2, 3, true); oColumn = oMatrix.Columns.Item (2); oColumn.Editable = false; The result of the code below:

Focus Settings: oMatrix.SetCellFocus (1, 2); oMatrix.SetCellFocus (2, 3); SAPbouiCOM.ICellPosition oPos = oMatrix.GetCellFocus (); int rowNum = oPos.rowIndex; int colNum = oPos.ColumnIndex; The result of the code below:

Get a slightly different approach and earlier, because the focus did not like the color of the front return an integer value, so we can return to a focus position of the ranks of the cell, so we add another new interface / object CellPosition, which RowIndex and ColumnIndex contain the ranks of the information. System Matrix: All of the above settings can be applied to B1 on the Matrix system.(Of course, depends on whether the success or set up their own original Matrix system set analogy, the system would have a Column Matrix are all not editable, this time on this Column can not any cell editable. ) the following code to set the sales order form on the Matrix cell background color, for example: oForm = SBO_Application.Forms.GetForm ("139", 1); oMatrix = oForm.Items.Item ("38"). Specific as SAPbouiCOM.Matrix; setting =oMatrix.CommonSetting; oColumn = oMatrix.Columns.Item (3); oColumn.BackColor = 34434; setting.SetRowBackColor (1, redBackColor); / / 1000 setting.SetCellBackColor (3, 20, blueBackColor); / / 8000 The result of the code below:

Note that our code inside the first three and 20 of a cell set, but the map corresponding to the first one did and 3, experienced developers know that this is because the system may be hidden out of the Matrix The reason a lot of columns.

B1 SDK chapter of the main control room


Friday, May 20th, 2011

Author: Warren Jiang Software applications are now personalized and easy to use toward the direction of development, along with this new trend in the 8.8 version patch12, SAP Business One launch control room (Cockpit) and gadgets (Widget) feature set, providing including personalized interface, common feature set, drag the extraordinary experience and the convenient search function, giving customers a different past operating practices and user experience (see below).

SAP Business One as a secondary development tools of the SDK, the same small set of tools based on the main control room and other functions to achieve a corresponding increase, taking into account the considerable amount of this part, a lot of new API, for narrative convenience, I In this paper, focusing on the main control room for discussion related to the SDK functions.Speaking from the big module, this part of the function is divided into two parts, one body in SDK UIAPI (shown in Figure 1. Note that taking into account the main control room and a small set of tools and drag functions are closely related, interface map which did not out of control room features a separate, later in the part about the small tool set, we have used this figure); take into account the settings and data persistence, which by the main control room, delete, change, release and list manipulation functions achieve DIAPI, the configuration into the database (Figure 2).

(Figure 1)

(2) From the architecture point of view, because the main control room (Cockpit) B1 does not belong to any existing window control, so we designed the entrance to the main control room located in the UIAPI the Application object, taking into account the number of main control room situation, this is a main entrance control room set (Cockpits), as all elements of the entrance window - the window set (Forms) the same. How to traverse all the main control room? SAPbouiCOM.Cockpits ckpts = sbo_Application.Cockpits; int iCkptsCount = ckpts.Count; IF (iCkptsCount> 0) { / / Cockpits Collection is zero based. for (int iLoop = 0; iLoop <iCkptsCount; + + iLoop) { SAPbouiCOM.Cockpit CKPT = ckpts.Item (iLoop); String strCkptTypeID = ckpt.CockpitTypeID;

} } As displayed in the current interface is only one main control room, many applications require the control room based on the current, so we can use the following UIAPI interfaces to get the current control room:
SAPbouiCOM.Cockpits ckpts = sbo_Application.Cockpits; SAPbouiCOM.Cockpit ckpt = (SAPbouiCOM.Cockpit) ckpts.CurrentCockpit; / / Store the Cockpit type ID for "SwitchCockpit" operation later. String strCurrentCockpitTypeID = ckpt.CockpitTypeID;

Note that because only one instance of each of the main control room, so the main control room here CockpitTypeID both types can be understood as the main control room a single identifier.Like other programming information as B1, when the mouse cursor in the main control room at the time of this CockpitTypeID B1 can also be from the bottom of the inside view into the system information to use for development partners.

Here CockpitTypeID = -1, be noted that, B1 system control room types are negative.Home is -1, -2 sales, service -3, and so on.As shown below:

If you need to add their own control room, in which B1 can be as follows:

Appropriate in the SDK, you can DIAPI to make the appropriate management (add / update / delete / get a list, etc.) to add a custom control room, for example:
SAPbobsCOM.CompanyService ComService = SAPbobsCOM.CompanyService) oCompany.GetCompanyService (); SAPbobsCOM.CockpitsService cockService = (SAPbobsCOM.CockpitsService) ComService.GetBusinessService (ServiceTypes.CockpitsService); SAPbobsCOM.Cockpit cptAdd = (SAPbobsCOM.Cockpit) cockService.GetDataInterface (CockpitsServiceDataInterfaces.csCockpit); cptAdd.Name = "their control room"; cptAdd.Description = "This is a customization of the main control room"; SAPbobsCOM.CockpitParams cockParamAdd = cockService.AddCockpit (cptAdd);

When you add is successful, see B1 of the main control room management form, you can see the newly added record (provided the restart B1, or call UIAPI Refresh method):

As for the update / delete / get a list of experienced programmers can be based on the SDK's DIAPI conventional programming techniques, respectively UpdateCockpit / DeleteCockpit / GetCockpitList to complete the corresponding function. On access list, in addition to GetCockpitList, DIAPI also provides GetUserCockpitList and GetTemplateCockpitlist B1, respectively, to obtain the current list of the client's control room, and published as a template for all clients to use the main control room list. If you want the main control room of the local user list, published as a template control room, you can use the following interface: cockService.PublishCockpit (cptAdd); DIAPI part of the introduction to the main control room here, we re-introduce UIAPI on the last two must be used to function. If the user DIAPI Add / Update / Delete the main control room, the interface is not immediately reflected on, unless the next time you log B1 will reload.But obviously this is not real-time load for this situation we can call the following code: SAPbouiCOM.Cockpits ckpts = sbo_Application.Cockpits; ckpts.Refresh (); In addition, as we mentioned earlier, because the main control room can have more than B1, so there is the main control room to switch between multiple issues.From the current control room is the main control room by switching to another to achieve the following statement: ckpts.SwitchCockpit ("-5"); By calling this line, we can present the main control room from the "Home" to "purchase."

Change the number of units purchased materials sales


Thursday, March 24th, 2011

Foreword In the 8.8 version of SAP Business One before, when the material received the cargo, and their number can not change the procurement unit; when the material sent over the cargo, and they can not change the number of units sold.For some users, this limitation may bring some inconvenience.SAP Business One 8.8 have made improvements.First let's look at how to define and change the number of units of materials. Material master data changes on the number of units In 8.8, we can always "inventory" -> "material master data" to access and modify the number of units of materials. Purchase the number of units in the "purchase data" options page:

Number of units sold in the "sales data" option page:

In SAP Business One 8.8, regardless of whether the material has been shipping and receiving records, both the number of units can be changed at any time to a value greater than 0, and their changes will not affect any of an existing document. Sales of materials on the procurement documents changes in the number of units When we create a new marketing procurement documents, the units of measure and quantity of materials per unit will be automatically obtained from the material master data. Sales of materials on the procurement documents the number of units in default does not appear in the user interface.When necessary, the user can purchase in the open sales documents, click "Table Settings" and "tabular" data page, check the "amount of materials per unit", as shown below:

Under normal circumstances, we can modify the number of documents directly to any value greater than 0.Please note that documents the inventory unit of measure must be "no."If "Yes" means that the documents directly using stock purchase units rather than sell units, then "the number of materials per unit" is fixed at 1.

Stock units are not displayed by default in the user interface.When necessary, the user can purchase in the open sales documents, click "Table Settings" and "tabular" data page, check the "stock units." In some special cases, we will not be able to modify the number of units of materials.For Chinese companies, these include: 1, the current sales copy in a sales procurement documents and procurement documents based documents that have affected the material "has committed", "ordered", "inventory" and other inventory data 2, part of the current document has been copied to other documents. Inventory transaction documents on the material change in the number of units Inventory transaction documents, including receiving, shipping and inventory allocation, inventory units are used by default.Purchase and sale documents, users need to open the stock when the transaction documents table settings and click the "tabular" data page, check the "stock units" and "amount of materials per unit", as shown below.

When checked, the user can inventory the documents in the unit of measurement is set to "no."At this point, receiving a single material master data will be obtained from the procurement unit of measurement and number of units per purchase, invoices, and inventory allocation will be obtained from the material master data in sales units and the number of units per purchase. Corresponding calculation support SAP Business One 8.8 In addition to allowing users to modify the number of units of materials, it also changes the material for the number of units to provide appropriate computing support, including unit prices, pick and pack quantity calculation: Sales receipts and inventory procurement transaction documents or information in the unit price is based on the original price and the number of units calculated.For example, in a single receipt, select a price list price of 2 materials, the actual price is the price list shows the price per unit multiplied by the amount of materials, as shown:

In the pick and pack manager, users can "set the table" -> "Document" -> "Table" shows the number of data pages on the decision mode, when you select "stock units", the display of the "amount of materials per unit "Fixed to 1, as shown:

When sales of units of measurement, then displays the corresponding sales documents "material per unit volume", as shown:

Note that if the sales document itself using the "stock units", then pick and pack manager will be displayed in the material master data is defined on the sale of units of measurement."Outstanding" and "ordered" two columns of data to be converted by the actual number, the number displayed when the user switch the mode, the two columns of data will change accordingly as shown above. No matter what kind of display, pick lists generated with a single delivery unit of measurement used and the number of units of materials and infrastructure is always consistent sales documents, and the number will change accordingly.

You might also like