Skip to Content
0

Disabling the text box fields

Nov 29, 2016 at 05:28 AM

59

avatar image

In sap b1 visual studio add on the value of first two column should multiply and third column should be added and fourth column should be subtracted mean while the total(Last)column should get disabled with the value getting from the other column . Any one could help using visual studio coding??

image.png (43.8 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Edy Simon Nov 29, 2016 at 06:44 AM
1

Attach an event listener for the After Validate of the 4 columns
Calculate however you want inside this event handler.
Set the Value using the DBDataSource.SetValue("Column",Row,Value);

You can disable the column from B1Studio or via coding oMatrix.Columns.Item("LastColUID").Editable = false;


Regards
Edy

Share
10 |10000 characters needed characters left characters exceeded
Hariharan Angamuthu Nov 29, 2016 at 08:31 AM
0

Hi Edy Simon

This is my coding , And what i have to add to calculate and bring the sum of value while the answer displayed in the last column should not be editable

If pval.ItemUID = "Item_24" And (pval.ColUID = "Col_5" Or pval.ColUID = "Col_1" Or pval.ColUID = "Col_2" Or pval.ColUID = "Col_3") Then Dim mat As SAPbouiCOM.Matrix mat = OForm.Items.Item("Item_24").Specific

Dim Seats As Double = mat.Columns.Item("Col_5").Cells.Item(pval.Row).Specific.value

Dim Price As Double = mat.Columns.Item("Col_1").Cells.Item(pval.Row).Specific.value

Dim vat As Double = mat.Columns.Item("Col_2").Cells.Item(pval.Row).Specific.Value

Dim Discount As Double = mat.Columns.Item("Col_3").Cells.Item(pval.Row).Specific.value

mat.Columns.Item("Col_4").Cells.Item(pval.Row).Specific.value = Seats * Price + vat - Discount

End If

Share
10 |10000 characters needed characters left characters exceeded
Edy Simon Nov 29, 2016 at 09:11 AM
0

When you draw this form, set :

mat.Columns.Item("Col_4").Editable = false

And instead of setting

mat.Columns.Item("Col_4").Cells.Item(pval.Row).Specific.value = Seats * Price + vat - Discount

Set the DataSource that this matrix column is bound to
ie. if the column is bound to a UserDataSource, use

mat.GetLineData
Form.DataSources.UserDataSource.Item("udsUID").Value = Seats * Price + vat - Discount
mat.SetLineData

if the column is bound to a DataTable, use

mat.FlushToDataSource<br>Form.DataSources.DataTable.Item("dtUID").SetValue("colUID",pVal.Row-1, Seats * Price + vat - Discount)mat.LoadFromDataSource

Regards

Edy

Show 2 Share
10 |10000 characters needed characters left characters exceeded

This editor is frustrating...
The last code should read

mat.FlushToDataSource
Form.DataSources.DataTable.Item("dtUID").SetValue("colUID",pVal.Row-1, Seats * Price + vat - Discount)
mat.LoadFromDataSource
1

I feel your pain :(

0
Hariharan Angamuthu Nov 29, 2016 at 12:56 PM
0

Thank you Edy Simon

Share
10 |10000 characters needed characters left characters exceeded