cancel
Showing results for 
Search instead for 
Did you mean: 

How to move the cursor to next displayed column after set the value to UDF?

Former Member
0 Kudos

Hi,

I have problem after setting default values to margeting document lines in B1 8.81 PL05

My addon sets the default values to udfs after user enters tab key from Itemcode on sales order form.

Addon sets default values to udfs then cursor moves to next column of itemcode in B12007.

ex) oMatrix.Columns.Item(ColName).Cells.Item(RowNumber).Specific.String = "TEST"

But addon sets default values to udfs then cursor stays still in the last UDF column in B1 8.81 PL05.

So user has to move the cursor to next column of itemcode manually.

How to handle this situation?

Curosr must move to next column of itemcode.

Joanne

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Yes, it could be the solution,

Set cursor to "itemCode" after I set all the default values. Then send a tab key to next logical column with if condition.

Problem is this upgraded addon is very big and I use this technique on many places.

I'd like to know whether this is a B18.81 SDK changes or bug.

Joanne

former_member201110
Active Contributor
0 Kudos

Hi Joanne,

It is unfortunately not a bug but a design decision by SAP for 8.81 (and 8.8 after a certain patch). I asked SAP support and they confirmed that it is intentional behaviour.

Personally I think it's a really weird thing to change and it has caused me a lot of work fixing existing addons, particularly where I was working with system forms. I would have thought that it would have been better to add a parameter to the method so the programmer could choose whether to set focus to the newly updated field or not. I'm hoping they'll change this 'feature' back.

Here's how I got around it:


try
{
    // Freeze the form to avoid flickering
    form.Freeze(true);
    SAPbouiCOM.Matrix matrix = (SAPbouiCOM.Matrix)form.Items.Item("38").Specific;
    // Retrieve the column I want to update and set a value
    SAPbouiCOM.EditText edit = (SAPbouiCOM.EditText)matrix.GetCellSpecific("U_XXXX", 1);
    edit.Value = "MYVALUE";
    // Retrieve the column that the user was on previously - in this case the Item Code field
    edit = (SAPbouiCOM.EditText)matrix.GetCellSpecific("1", 1);
    // Use the active property to set focus and then move focus to next available field
    edit.Active = true;
    edit.Active = false;
}
finally
{
    form.Freeze(false);
}

Kind Regards,

Owen

Answers (5)

Answers (5)

Former Member
0 Kudos

Thanks so much Owen.

Former Member
0 Kudos

Hi Owen

It gets even worse when setting values in the matrix triggered from outside forms

(e.g. a custom price selector form which writes back the value to the price column)

I'm really hoping as well they fix it back to the last 5 years behaviour

Kind Regards

Philipp

Former Member
0 Kudos

Hi Shafi,

Thanks for your help.

I problem is how to set the cursor to next column of itemcode if I don't know the column id of next itemcode column.

For example,

User A : itemCode, Qty, Unit price columns order form

User B : Itemcode, Unit Price, Qty columns order form

Addon needs to know which column iid of next itemcode.

IN B12007

1. Enter itemcode

2, Enter Tab key

3. set the "XXXX" value to "U_XXX"

4. Cursor is in the column of next itemcode

IN B1.8.81

1. Enter itemcode

2, Enter Tab key

3. set the "XXXX" value to "U_XXX"

4. Cursor is in "U_XXX"

sdk sets the value to "U_UDF1"

former_member689126
Active Contributor
0 Kudos

Hi

IN B1.8.81

1. Enter itemcode

2, Enter Tab key

3. set the "XXXX" value to "U_XXX"

after this step try this, it is not an elegant solution

oMtx.Columns.Item("1").Cells.Item(pVal.Row).Click(SAPbouiCOM.BoCellClickType.ct_Regular, 0);

Regards

Arun

Former Member
0 Kudos

Hi Joanne,

Try This.......


'To move the cursor from itemcode column to U_poqty column when TAB is pressed
 If pVal.ItemUID = "38" And pVal.ColUID = "1" And pVal.FormType = "142" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_KEY_DOWN And pVal.CharPressed = "9" And pVal.BeforeAction = False Then
   oform = sbo_application.Forms.GetFormByTypeAndCount("142", 1)
   Dim oMatrix As SAPbouiCOM.Matrix = oform.Items.Item("38").Specific
oMatrix.Columns.Item("U_poqty").Cells.Item(1).Click(SAPbouiCOM.BoCellClickType.ct_Regular)

        End If

Thanks

Shafi

Former Member
0 Kudos

Hi Pari,

Thanks for your reply.

oMtx.Columns.Item(ItemCode_ColumnId).Cells.Item(pVal.Row).Click(SAPbouiCOM.BoCellClickType.ct_Regular, 0)

oMtx.SetCellFocus(pVal.Row, Qty_ColumnId)

I've tried the source code as above.

I have 2 issues.

1. I can't hardcode for next column id of ItemCode because user can have different columns setting form.

2. oMtx.SetCellFocus(pVal.Row, Qty_ColumnId) : Cursor does not set to Qty_ColumnId

Joanne

Former Member
0 Kudos

Hi

You can try the following

oMtx.Columns.Item("ItemCode").Cells.Item(pVal.Row).Click(SAPbouiCOM.BoCellClickType.ct_Regular, 0);

oMtx.SetCellFocus()

Regards