on 05-18-2009 3:58 PM
Hi forum!
I'm novice in programming with SAP, and I can't add data in a matrix.
This is my code
if ((pVal.FormTypeEx == "146") & (pVal.EventType == SAPbouiCOM.BoEventTypes.et_COMBO_SELECT) & (pVal.BeforeAction == true))
{
if (pVal.ItemUID == "112")
{
string sMonto = "3";
oItem = oForm.Items.Item("112");
oItem.Enabled = true;
oMatrix = ((SAPbouiCOM.Matrix)(oItem.Specific));
oColumns = oMatrix.Columns;
oColumn = oColumns.Item("51");
oColumn.Editable = true;
oCell = oColumn.Cells.Item(1);
oEditText = ((SAPbouiCOM.EditText)(oCell.Specific));
oEditText.Value = sMonto;
}
}
Why this code is not valid?, What should do I for add a static data in a matrix?
Thanks
Edy, I need the data because this program prints a ticket, and the ticket must include the differents way of pay. I need to catch the credit cards. Using the values added earlier I don't have problems, but the problem is How can I store the data of many credit cards?
Thanks
Regards
Victor Navarro
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vitoko,
Hahaha.... Sorry... even when i think i get you, still i missed your point... this is becoming more of like guessing games... haha...
Okay... my last shot...
You have already store the first credit card data in the previous code, now
You want to code, to store the second credit cards data. is it correct ?
If i am wrong again, I might as well give up.. sorry
Regards
Edy
At last....
Ok, After you input your first credit card data, you add this code to the bottom of the previous code
oItem = oForm.Items.Item("55");
oMatrix = oItem.Specific;
oMatrix.Columns.Item("25").cells.item(2).Click();
Then you repeat the previous code for inputing the second credit card data.
That should work, again please excuse me C syntax....
Try it and let me know.
Regards
Edy
I know about the existences of these tables, but I was thinking, and the data should be stored in memory (I suppose) because this data is temporal, and the sale still has not being created.
Do you think in what place this data is "stored"?
Thank you Edy, and don't worry, your help has served me so much.
Regards
Victor Navarro
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vitoko,
Oh... I see.
But why would you want to retrieve this data back, since you are the one who put in the value ? Using the Code earlier ?
Anyway,
Since this data is in a matrix, there is no temporary memory to retrieve this. You can only get this data by accessing the matrix and reading from the column.
Regards
Edy
Mmmm...
I pay with two credit cards, the [first|http://i42.tinypic.com/t5q5q8.jpg] and the [second|http://i41.tinypic.com/149uv4j.jpg], but I don't know how catch the ammount and the type of card, that values is stored in "any place" and the matrix next to the card information only shows 2 cards. I need the amount too.
Do you understand me now?
Thank you so much Edy
Regards
Victor Navarro
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, In my country we have many ways to pay a sale, specially with cards.
We have credit cards of banks, stores, supermarkets, debit cards,
and in a sale we can pay an amount with a bank card, and the rest with debit card.
The control is a simple matrix, but the row 2, in English is Define again.
I need to know where are stored the data of credit cards pay.
Thank you so much, my English is not good but I try to explain like I can.
Regards
Victor Navarro
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The program works!
Thanks Edy
The problem with the combobox was solved, but I have another question.
¿How can I catch the pay with cards?
If I pay with many cards, these pays are stored in this control
The localization is next to the trasposed matrix.
I don't know how is called this control and how catch values of this.
Regards
Victor Navarro
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Edy, yesterday it was a bank holiday in my country (I'm Chilean) and I could not answer you.
Now I have a problem.
When I select an item of the combo in column 41, this value is ""
Look at this image: [Imagen|http://i42.tinypic.com/v8oehg.jpg]
If I have the description of the combo like "", the program does not works.
How can know I the value of the combo when I choose some of them?
The event is the COMBO_SELECT, but curiously I don't have the value of the combo.
In the new code I have added the values of the other Edit, but always going to be locked (Because the combo fails)
Regards
Victor Navarro
I don't know how to edit the wrong post.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vitoko,
Of course the combo will give you a "" value, because you catch it in BeforeAction = True,
For combo_select, the value will be something only when BeforeAction = False.
Also in your code, I do not see you put in the value of Combo 65. without this value, the column 46 will always be locked.
BTW. you do not need to set the cells editable to True.. in system form, you cannot set this property.
And also, in system form, you do not need to bind it to any data source. it is done automatically by SBO.
here i try to edit your code, and repost it. But please excuse me if there is some typo or anything, Because I am not so fluent in C language.
if ((pVal.FormTypeEx == "146") & (pVal.EventType == SAPbouiCOM.BoEventTypes.et_COMBO_SELECT) & (pVal.BeforeAction == False) & (pVal.ColUID == "41"))
{ if (pVal.ItemUID == "112")
{
string sFecha = "10/10";
string sMonto = "CLP 3";
string sRut = "1-9";
string sTarj = "2567";
string sBodega = "CD";
oItem = oForm.Items.Item("112");
oMatrix = ((SAPbouiCOM.Matrix)(oItem.Specific));
oColumns = oMatrix.Columns;
oColumn = oColumns.Item("41");
oCell = oColumn.Cells.Item(1);
oComboBox = ((SAPbouiCOM.ComboBox)(oCell.Specific));
string sCombo = oComboBox.Selected.Description;
oColumn = oColumns.Item("63");
oCell = oColumn.Cells.Item(1);
oEditText = ((SAPbouiCOM.EditText)(oCell.Specific));
oEditText.Value = sTarj;
oColumn = oColumns.Item("64");
oCell = oColumn.Cells.Item(1);
oEditText = ((SAPbouiCOM.EditText)(oCell.Specific));
oEditText.Value = sFecha;
oColumn = oColumns.Item("21");
oCell = oColumn.Cells.Item(1);
oEditText2 = ((SAPbouiCOM.EditText)(oCell.Specific));
oEditText2.Value = sRut;
oColumn = oColumns.Item("65"); '<--- Add these lines
oCell = oColumn.Cells.Item(1); '<--- Add these lines
oCBO = ((SAPbouiCOM.ComboBox)(oCell.Specific)); '<--- Add these lines
oCBO.select("*TCRD_3CUOTAS",SAPbouiCOM.BoSearchKey.psk_ByDescription); '<--- Add these lines
oColumn = oColumns.Item("46");
oCell = oColumn.Cells.Item(1);
oEditText3 = ((SAPbouiCOM.EditText)(oCell.Specific));
oEditText3.Value = sMonto;
oColumn = oColumns.Item("60");
oColumn.Editable = true;
oCell = oColumn.Cells.Item(1);
oEditText3 = ((SAPbouiCOM.EditText)(oCell.Specific));
oEditText3.Value = sBodega;
}
}
In your code, i added some lines and deleted some lines.
Please try it and let me know.
Regards
edy
Edy, yesterday it was a bank holiday in my country (I'm Chilean) and I could not answer you. Now I have a problem.
When I select an item of the combo in column 41, this value is ""
Look at this image: [Imagen|http://i42.tinypic.com/v8oehg.jpg]
This is my new code:
if ((pVal.FormTypeEx == "146") & (pVal.EventType == SAPbouiCOM.BoEventTypes.et_COMBO_SELECT) & (pVal.BeforeAction == true) & (pVal.ColUID == "41"))
{
if (pVal.ItemUID == "112")
{
userDS = oForm.DataSources.UserDataSources.Add("montoPago", SAPbouiCOM.BoDataType.dt_SHORT_TEXT,20);
string sFecha = "10/10";
string sMonto = "CLP 3";
string sRut = "1-9";
string sTarj = "2567";
string sBodega = "CD";
oItem = oForm.Items.Item("112");
oItem.Enabled = true;
oMatrix = ((SAPbouiCOM.Matrix)(oItem.Specific));
oColumns = oMatrix.Columns;
oColumn = oColumns.Item("41");
oCell = oColumn.Cells.Item(1);
oComboBox = ((SAPbouiCOM.ComboBox)(oCell.Specific));
string sCombo = oComboBox.Selected.Description;
oColumn = oColumns.Item("63");
oColumn.Editable = true;
oColumn.DataBind.SetBound(true, "", "montoPago");
oCell = oColumn.Cells.Item(1);
oEditText = ((SAPbouiCOM.EditText)(oCell.Specific));
oEditText.Value = sTarj;
oColumn = oColumns.Item("64");
oColumn.Editable = true;
oColumn.DataBind.SetBound(true, "", "montoPago");
oCell = oColumn.Cells.Item(1);
oEditText = ((SAPbouiCOM.EditText)(oCell.Specific));
oEditText.Value = sFecha;
oColumn = oColumns.Item("21");
oColumn.Editable = true;
oColumn.DataBind.SetBound(true, "", "montoPago");
oCell = oColumn.Cells.Item(1);
oEditText2 = ((SAPbouiCOM.EditText)(oCell.Specific));
oEditText2.Value = sRut;
oColumn = oColumns.Item("46");
oColumn.Editable = true;
oColumn.DataBind.SetBound(true, "", "montoPago");
oCell = oColumn.Cells.Item(1);
oEditText3 = ((SAPbouiCOM.EditText)(oCell.Specific));
oEditText3.Value = sMonto;
oColumn = oColumns.Item("60");
oColumn.Editable = true;
oColumn.DataBind.SetBound(true, "", "montoPago");
oCell = oColumn.Cells.Item(1);
oEditText3 = ((SAPbouiCOM.EditText)(oCell.Specific));
oEditText3.Value = sBodega;
}
}
If I have the description of the combo like "", the program does not works.
How can know I the value of the combo when I choose some of them? The event is the COMBO_SELECT, but curiously I don't have the value of the combo.
In the new code I have agree the values of the other Edit,
but always going to be locked (Because the combo fails)
Regards
Victor Navarro
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Edy, when I make a sale with a ticket, I have many ways to pay (money, credit card, check...),
the form 146 is the form to pay the sale, and the combo is for the credit card.
I don't know how post images here, so I put the links of them:
[Form 146|http://i39.tinypic.com/2zhlhcw.jpg]
The language of SBO in my enterprise is Spanish.
Well, answering the question 1, I added the code in the line 1, but I still have the error.
In the first image the combo has focused, and the value is showed in the bottom
And, with the question 2, please see this image
[Value 3|http://i41.tinypic.com/z4o4g.jpg]
My code is bad, and the column that I want to add the value is the 46.
Now I corrected the code and I have the error. The column 46 row 1 has focused and
I can insert the value "3" using SBO manually.
If you watch the images, you see the rows are vertically and
the columns horizontally (I don't know why)
And if you want to access to this form,
the [icon|http://i42.tinypic.com/2ivfvvc.jpg] (of the center) must to be activated.
Greetings.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vitoko,
OK, I've seen what you want to do.
Before you set the value of Item 46,
You have to set the Value of Combo in column 41 and Combo in column 64.
I've seen in your code that you/user have set the column 41. But have you set the combo in column 64 ?
Before setting a value to these both combo, the item 46 is locked. You cannot edit it,
Regards
Edy
BTW. The matrix item is a transposed matrix.
Edited by: Edy Simon on May 21, 2009 3:34 AM
Yes Edy, is a system form and the matrix too. If I can't bind it,
How should do I to add a static data in the system matrix?
Mi idea is, when I select an item of the combo, add values to the matrix.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vitoko,
Can you tell me what form is this 146 ?
Maybe I can get clearer picture if we are looking at the same thing.
I dont see anything wrong with the code you post orignally, except :
1. You are not specifying the pval.coluid of the combo box you are trying to catch the event in your first line.
if ((pVal.FormTypeEx == "146") & (pVal.EventType == SAPbouiCOM.BoEventTypes.et_COMBO_SELECT) & (pVal.BeforeAction == true) & (pval.ColUID= "???"))
{
if (pVal.ItemUID == "112")
2. If user is selecting the combo, you are trying to update matrix 112, column 51, row 1 to show Value '3'
Can you try to type in '3' into this column 51 row 1 using the SBO screen manually?
Please try it and let me know.
Regards
Edy
Well, my new code is this:
if ((pVal.FormTypeEx == "146") & (pVal.EventType == SAPbouiCOM.BoEventTypes.et_COMBO_SELECT) & (pVal.BeforeAction == true))
{
if (pVal.ItemUID == "112")
{
userDS = oForm.DataSources.UserDataSources.Add("montoPago", SAPbouiCOM.BoDataType.dt_SHORT_TEXT,20);
string sMonto = "3";
oItem = oForm.Items.Item("112");
oItem.Enabled = true;
oMatrix = ((SAPbouiCOM.Matrix)(oItem.Specific));
oColumns = oMatrix.Columns;
oColumn = oColumns.Item("51");
oColumn.Editable = true;
oColumn.DataBind.SetBound(true, "", "montoPago");
oCell = oColumn.Cells.Item(1);
oEditText = ((SAPbouiCOM.EditText)(oCell.Specific));
oEditText.Value = sMonto;
}
}
But in the moment of set bound in the column, the program crashes. If I set bound in EditText, the program crash too. I don't know what to do
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to have data sources behind most controls in sap b1 to have the value stored. Try it with a simple edittext - if you don't set the data source, after you leave the control (using tab or clicking somewhere else) the text you wrote is gone.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was looking the sample, and I don't understand the binding. Why do I need to use binding to add a static value in a matrix?. The cell that I need to fill isn't related with a table (Amount of pay).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Vitoko,
Have a look at the documentation on matrices in the SAP Business One SDK Help Documentation under the UI API. Also there is a sample that comes with the SDK for Matrices and Datasources that you may want to review. You can find the sample if you have the SAP Business One SDK installed at ...
..\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\06.MatrixAndDataSources
Eddy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you bind your matrix to a datasource ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
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.