cancel
Showing results for 
Search instead for 
Did you mean: 

LinkButton column - How to insert value??

Former Member
0 Kudos

hi, i changed the type of one column in my matrix from EDIT to LINKBUTTON. but know, when i start my form, i cannot manually insert a value in this column.

i have a new row in the matrix, which is empty. but when i insert a value in this cell and leave it with TAB, the value disappears.

what can i do instead?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi...

If Ur using CFL uid or link button object = 2 means

example:

u bind cardcode means that only store in matrix or display.if u want to enter manuly is not possible.

Regards...

Billa 2007

Former Member
0 Kudos

not possible?

so what can i do?

Former Member
0 Kudos

I have added an example for columns here:

[]

Use the pval.Row (or in the linked example: "oCflEvent.Row") property to identify the Matrix-Row in the CFL-column. It can be used to update the right row in a Matrix with UserDataSources or DataTable or DBDataSource with the CFL-value.

Adding the CFL to a column is described in my last answer above...

Former Member
0 Kudos

Thank you it finally worked. But, only in DEBUG environment!!

that is my code:

if (oData != null)
                        {
                            if (cflID == "Nutzer" || cflID =="Projectcod")
                            {
                                string sErg;
                                cflBefore = oDBFB2.GetValue("U_abc_Nutz", pVal.Row);
                                if (cflID == "Nutzer")
                                {
                                    sErg = oData.GetValue(0, 0).ToString();
                                    oDBFB2.SetValue("U_abc_Nutz", pVal.Row, sErg);
                                }
                                else
                                {
                                    sErg = oData.GetValue(0, 0).ToString();
                                    oDBFB2.SetValue("U_abc_Proj", pVal.Row, sErg);
                                }
                                oForm = SBO_Application.Forms.Item(FormUID);
                                UpdateCells(oForm, pVal.Row, sErg, cflID);
                            }
                        }

private bool UpdateCells(SAPbouiCOM.Form oF, int iRow, string sCode,string sColumn)
        {
            SAPbouiCOM.Matrix oMatrix = (SAPbouiCOM.Matrix)oF.Items.Item("Beleg").Specific;
            SAPbouiCOM.Cell oCell;
            SAPbouiCOM.EditText oText;
            SAPbouiCOM.Column oCol;
            
            try
            {
                oCol = oMatrix.Columns.Item(sColumn);
                oCell = oCol.Cells.Item(iRow);
                oText = (SAPbouiCOM.EditText)oCell.Specific;
                oText.String = sCode;

                oCol = null;
                oCell = null;
                oText = null;

                System.GC.Collect();
            }
            catch (Exception ex)
            {
                return false;
            }
            return true;
        }

when i make an addon, it doesn't get the value back!?!

Former Member
0 Kudos

hmm, now it works even as an addon in my development-environment with 2005A SP 01 PL 27. But on the users system with PL19 the value from the cfl are not taken to the Cell.

What could that be??

Former Member
0 Kudos

Have you debugged the code? What does not work:

1. Getting the CFL Data from the DataTable:

sErg = oData.GetValue(0, 0).ToString();

(this should also work with sErg = oData.GetValue("CardCode", 0).ToString(); if it's a Bus.-Partner for example)

2. or setting the data:

oDBFB2.SetValue("U_abc_Nutz", pVal.Row, sErg)

Why do you write the data two times? First time as oDBFB2.SetValue and second time in UpdateCells via EditText.String?

If it's only at your customers side then one way could be to make a special version of your AddOn with MessageBoxes at each step of the CFL-event and show the relevant variables in the MessageBox to find out where the CFL-value is lost.

And you may have a look at the descriptions of the updates in the B1-download-area. Maybe there's some CFL related fix since PL19?

Former Member
0 Kudos

Sorry, I don't know at the moment - only some questions (sometimes questions can help...;-)

Have you debugged the code? What does not work:

1. Getting the CFL Data from the DataTable:

sErg = oData.GetValue(0, 0).ToString();

(this should also work with sErg = oData.GetValue("CardCode", 0).ToString(); if it's a Bus.-Partner for example)

2. or setting the data:

oDBFB2.SetValue("U_abc_Nutz", pVal.Row, sErg)

Why do you write the data two times? First time as oDBFB2.SetValue and second time in UpdateCells via EditText.String?

If it's only at your customers side then one way could be to make a special version of your AddOn with MessageBoxes at each step of the CFL-event and show the relevant variables in the MessageBox to find out where the CFL-value is lost.

And you may have a look at the descriptions of the updates in the B1-download-area. Maybe there's a CFL related fix since PL19?

Former Member
0 Kudos

Hi Philipp,

do you DataBind the Column? Without DataBind a LinkedButton Column does not work as expected.

In case of a column for Businespartner-CardCodes I would do somewhere on form load (or already saved in .xml/.srf):


            oForm.DataSources.UserDataSources.Add("UDS_CARDCD", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 15)
            oMtx.Columns.Item("24").DataBind.SetBound(True, "", "UDS_CARDCD")

...if a UserDataSource fits your needs (a DataTable-Bind or a DBDataSource should work too)

Cheers,

Roland

(DataBind-Preacher)

PS.: ups...a minute too late

Edited by: Roland Toschek on Sep 25, 2008 10:08 AM

Former Member
0 Kudos

ok, well i don't know how to describe it.

the column is bound to a user table, yes. it displays the values of the table, that is good like it is. but i also want, that it is possible to insert values to the matrix. and after "update" the values shall be transferred to the db. that worked fine, when the types of all columns were EDIT.

but now, since the type of 2 columns are LINKBUTTON, i am not able to insert values to these columns manually.

Former Member
0 Kudos

to make it more clear, i have a matrix and the first column is the employee. it is now of type linkbutton with a choosefromlist. it shall be possible to choose an employee. which also doesn't work right. because the choosefromlist opens when i insert a *, but then when i choose an employee nothing happens except for closing of the choosefromlist.

what did i do wrong?

Former Member
0 Kudos

Plz use a Try catch block in ur code so that if any error is popping up we can advise u to solve it.

Vasu Natari.

Former Member
0 Kudos

a try and catch block??

it is user action! the user puts in a value in this field, but when he leaves the cell it disappears. the values, which are already in the table, are displayed correctly!

maybe i did something wrong in the screen painter?!

Edited by: Philipp Igler on Sep 25, 2008 10:46 AM

Former Member
0 Kudos

now i found out something!!

when i leave the column with clicking on a different cell, the values don't disappear. they only disappear when i leave the cell with TAB!

Former Member
0 Kudos

Tell what is the thing that ur entering in the col and is there a CFL with that col..??

Vasu Natari.

Former Member
0 Kudos

>

> to make it more clear, i have a matrix and the first column is the employee. it is now of type linkbutton with a choosefromlist. it shall be possible to choose an employee. which also doesn't work right. because the choosefromlist opens when i insert a *, but then when i choose an employee nothing happens except for closing of the choosefromlist.

>

> what did i do wrong?

Former Member
0 Kudos

HI,

Instead of entering the Employee name in that col just enter the Emp NO and check if its working correctly.

Hope it helps,

Vasu Natari.

Former Member
0 Kudos

no, i always enter the empID!

Former Member
0 Kudos

>

it is now of type linkbutton with a choosefromlist. it shall be possible to choose an employee.

Just to clarify things: You know that LinkedButton (orange arrow) and ChooseFromList are different things?

Maybe you should deactivate all CFL-related things to check the LinkedButton functionality seperatly first....

Former Member
0 Kudos

yeah, look. i have a matrix with columns and the type of two of these columsn is "it_LINK_BUTTON"". furthermore this 2 columns also have a cfl attached. to one is the employee data and to the other the project data linked.

the linkbuttons work! so i can see the arrows in the cells and can navigate to the corresponding data. AND when i insert a "*" in these columns the cfl opens correctly.

BUT i have two problems:

First problem is, that when i chose a record of the cfl it won't be transfered to my cell in the form.

Second problem is, that when i insert a value manually without the cfl and the leave the cell with TAB, the value disappears. but when i leave the cell by clicking on a different cell, the value keeps in and the arrow appears correctly.

Former Member
0 Kudos

>

> First problem is, that when i chose a record of the cfl it won't be transfered to my cell in the form.

Do you catch the CFL-Not-BeforeAction Event for...

...getting the selected CFL-Vals from the provided DataTable and...

...add them to your Matrix (this must be done by code - not automatically) ?

Former Member
0 Kudos

no, i didn't do that

thank you.

do you have an idea for the other problem?

Former Member
0 Kudos

Hello Phillip,

for problem No. 1 I've written an example here:

[]

Problem No.2:

I only can reproduce this when I omit the DataBinding of the CFL-EditText-Field or -Column.

When CFL works correctly with "empty-field-and-TAB" then the behaviour for manually entered numbers is...

...entering an existing (in DB) code into the CFL-Field and leaving the field also activates the CFL-Event

(if the CFL-event-code fills additional fields then this is also done here - see my Service-MTX-example at the link above).

...entering a wrong (not existing) No. opens the CFL-PopUp with empty lines.

Maybe you forgot sth. when defining the CFL (on form initialize/load) for the MTX-Column?

This is what I do (I've tried to extract the essential things from my code - could be a little bit shorter ;):


        Dim FormCfls As SAPbouiCOM.ChooseFromListCollection = oForm.ChooseFromLists
        Dim LinkedObj As SAPbouiCOM.BoLinkedObject = SAPbouiCOM.BoLinkedObject.lf_Items
        Dim CflCol As SAPbouiCOM.Column = oMtxSrv.Columns.Item("xy")
        Dim CflUidCol As String = "CFL_ITNO1" ' CFL-UID for identifying the CFL at the CFL-Event
        Dim CflAliasCol As String = "ItemCode" ' the main DB-column for CFL
        Dim oCons As SAPbouiCOM.Conditions = Nothing ' set if needed

        Dim oCfl As SAPbouiCOM.ChooseFromList
        Dim oCflCreationParams As SAPbouiCOM.ChooseFromListCreationParams

        oCflCreationParams = SboCon.SboUI.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
        oCflCreationParams.MultiSelection = False
        oCflCreationParams.ObjectType = LinkedObj 
        oCflCreationParams.UniqueID = CflUidCol
        oCfl = FormCfls.Add(oCflCreationParams)

        '### OPTIONAL:
        '# restrict shown ChooseFromList-items by conditions
        If Not oCons Is Nothing Then
            oCfl.SetConditions(oCons)
        End If
        '#
        '###

        CflCol.ChooseFromListUID = CflUidCol
        CflCol.ChooseFromListAlias = CflAliasCol

Former Member
0 Kudos

thank you for your help.

but does this example for the first problem also work for a cfl in a column? how can i write the choosen element back?

Former Member
0 Kudos

Make sure that col is bounded to a data source.

Vasu Natari.