cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

LinkedButton - show DocNum but link using DocEntry?

Former Member
0 Likes
1,304

I've seen this asked before with no answers that worked.

I have a matrix from a user table, so all fields start with U_. I have a U_DocEntry and U_DocNum field in my user table and I want to link to the appropriate document. Both fields are it_Linked_Button types.

Clicking on the link button for the U_DocEntry field works fine as expected since SAP assumes that a value for DocEntry is being used. Naturally, clicking on the U_DocNum field links to the wrong document since it finds using DocEntry.

If I have both fields displayed and perform a ct_Linked click on the DocNum cell then that works. In my example "Col11" is the column with DocEntry in it.


BubbleEvent = false;
SAPbouiCOM.Cell oClickCell =	(SAPbouiCOM.Cell)_oMatrix.Columns.Item("Col11").Cells.Item(pVal.Row);
oClickCell.Click(BoCellClickType.ct_Linked,0);

However, I don't want to display the DocEntry field and the user may hide the field anyway. Forcing a ct_Linked click on a non-visible cell causes the calling event to repeat itself and doesn't produce a "catchable" error. This causes the SAP client to crash.

So, does anyone have any ideas of how to accomplish this?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

You can achieve this by intercepting the et_MATRIX_LINK_PRESSED event.

In BeforeAction=True, freeze the form and change the "U_DocNum" cell value to contain the docentry value.

In BeforeAction=False, set the "U_DocNum" cell value back to its original value and unfreeze the form.

John.

Former Member
0 Likes

Thanks John,

That's what I came up with too

AdKerremans
Active Contributor
0 Likes

Hi William,

you can also add an extra column before the docnum that contains the docentry and make it's width just the size of the arrow, so it looks like it belongs to the docnum column,

Regards

Ad

ronnie_scott
Participant
0 Likes

John,

What is the syntax for changing the cell value? What is the property to use to get the cell that the link button is pointing to?

Former Member
0 Likes

Dim oCol As SAPbouiCOM.Column

Dim iLinkBtn As SAPbouiCOM.LinkedButton

oCol = oMatrix.Columns.Item("DocNum")

sDocNum = oCol.Cells.Item(pVal.Row).Specific.value

oCol.Cells.Item(pVal.Row).Specific.value = oMatrix.Columns.Item("DocEntry").Cells.Item(pVal.Row).Specific.value.ToString()

Answers (0)