Cannot populate user defined column

I try to get the selected Item's AvgPrice on et_validate event with the following code. After orecordset.doquery the item's avgprice will not be displayed.
How can achieve this?
Any help would be appreciated.
Regards
Zoltan Sutto
Set oItem = oInvoiceForm.Items.Item("38")
Set oMatrix = oItem.Specific
oMatrix.DeleteRow (1)
Set oColumns = oMatrix.Columns
Set oColumn = oColumns.Add("AvgPrice", it_EDIT)
oColumn.TitleObject.Caption = "AvgPrice"
oColumn.Width = 100
oColumn.Editable = False
oMatrix.AddRow
Set oUserDataSource = oInvoiceForm.DataSources.UserDataSources.Add("dsAvgPrice", dt_LONG_NUMBER, 10)
oColumn.DataBind.SetBound True, "", "dsAvgPrice"
Select Case pVal.EventType
    Case et_FORM_LOAD
         AddColumnToInvoice
         BindDataSources
    Case et_VALIDATE
         If pVal.ItemUID = 38 And pVal.ColUID = "1" Then
             If pVal.Row <= oMatrix.RowCount Then
                 Set oEdittext = oMatrix.Columns(pVal.ColUID).Cells.Item(pVal.Row).Specific
                 oRecordSet.DoQuery "Select avgprice from oitm where itemcode='" & oEdittext.String & "'"
                 oUserDataSource.Value = oRecordSet.Fields(0).Value
             End If
         End If               
End Select

Ok!
As i understatnd you issue, you don't want to store avgprice in doc_table, you want just to show to user AVG price, probably it'll help him to deside, what price shold he put in price-column..
So, what for you want to use SDK UI??
I suppose it'll be more effective and nicely to create formated search, relate it with price-column, and then when user select an Item then in price-column AVG price will appear (or user press Sh-F2 on price-column).
The query for format search is too simple:[code]SELECT avgprice from OITM where itemcode = $[OINV.ItemCode][/code]By the way, you can create more cool query to show user extra info about that Item...
You can even allow user to see last prices.. It is a standard feature, just press Ctrl-TAB on price-column..
what do you think about it?
Hope it'll solve you issue!

Similar Messages

  • Add data in a user defined column in System matrix

    Hello All,
    I have created a User defined column in the Goods Issue Form
    When I choose a particular order, I get values in the matrix defined by system
    Based on this selection, I fire a query which returns a value and this value has to be
    displayed in the user defined column.
    I am trying to add a value to this column but I get the following error message
    Form Item is not Editable
    Here is the code written in form activate event
           code = (EditText)matrix.Columns.Item(1).Cells.Item(i).Specific;
                    string strcode = code.Value.ToString();
                    string str;
                    str = "select itemCode from owor where Docnum='" + strcode + "'";
                    RecSet.DoQuery(str);
                    e = (EditText)matrix.Columns.Item(15).Cells.Item(i).Specific;
                    strcode = RecSet.Fields.Item(0).Value.ToString();
                    try
                        matrix.Columns.Item(15).Editable = true;
                        e.String = strcode;
                        matrix.Columns.Item(15).Editable = false;
                    catch (System.Runtime.InteropServices.COMException com_err)
    Regards
    Nirmala B

    On system forms, you cannot update the DataSource (DBDataSource) of system matrixes, SAP blocks it.
    The only solution is to set the column visible and editable, and write in it with the matrix cell set value method.
    The downside is that the user will be able to see and edit the values (unless you catch all edit and click events to that cell).

  • How can I access user defined column(in query) inside the trigger?

    Hi
    I have 3 unions and each query displays different records on some criteria. I also have a column hard-coded
    Ex:
    select a.col1, a.col2,
    add as update
    from table1 a
    where ...
    union
    select a.col1, a.col2,
    change as update
    from table1 a
    where ...
    union
    select a.col1, a.col2,
    del as update
    from table1 a
    where ...
    And I need to display a column in the report only if update is Add. I was thinking of writing a format trigger for that field. But I do not know how can I access this user defined column named update in the trigger?
    Any help?

    Try ":update" minus the double-quotes. Ex:
        IF :update = 'add' THEN
          RETURN(TRUE);
        ELSE
          RETURN FALSE;
        END IF;
    You'll want to place your hard-coded values in single-quotes. Ex:
        select a.col1, a.col2,
        'add' as update
    - Brian

  • How to Insert a User Defined Column with CheckBox In ADF Swings

    I have create JTable by dragging a view object from Data Control Palette .But apart from columns listed in JTable i need to insert a User Defined column with Check Box selection option in each row .
    Can any one help me out to sort the problem.
    Regards
    Bhanu Prakash
    Message was edited by:
    user579125

    I retrieve 10 column from Database and build JTable. But apart from 10 column displayed i need to display one more column( User Defined) at run time with the check box option for each row . Because on select of corresponding check box i need to do some mathematical calculation. add also How do i know whether check box is selected or not.
    Regards
    Bhanu Prakash

  • Is it Possible to link user defined column of system matrix ?

    HI All,
    Is it possible to link (with ExtendedObject) user defined column  of system matrix?
    For Example, In purchase order form, I have added one column called U_ItemCode (through Tools-User Defined Fields-Marketing Doc). I want to give drill down to Item master.
    Here is the code:
    OColumn = OMatrix.Columns.Item("U_ItemCode")
    olink = OColumn.ExtendedObject
    olink.LinkedObject = SAPbouiCOM.BoLinkedObject.lf_Items
    the last line gives me 'Object refrence not set to an instance of the object' error.
    For user form, it works fine (since it has the column defined as LinkedColumn in screen painter). How can we do this in system matrix?
    thanks in advance
    regards,
    Binita

    Hi Binita,
    nice to see you
    i mean the following:
    1.) add the field in marketing document lines -> you need this to store the values in database
    but this user field column will not have the arrow so we do ...
    2.) you also add a linked column to the system matrix. you can copy the values from the udf column
    to your manual added column and than you can use the arrow. (maybe you should disabled this column)
    the result is you have two columns - the udf column and the linked manual column
    i hope you know what i mean - very complicated
    regards
    David

  • Is posible to do a choosefromlist in a user defined column of system matrix

    Hi all,
    I have a question that i can´t solve. Is posible to do a choosefromlist in a
    user defined column of system matrix?How can i do it?and i can use a datatable?How? 
    Thank you all again!
    Regard.

    The answer is No , that I know of.  The matrix permits ony the it_EDIT, it_COMBO_BOX, PICTURE, and CHECKBOX types.  Additionaly it has an LINK_BUTTON type
    Choosefrom list works best with UDOs.  Which means that you have to create your table and specify it in an UDO in order for the choosefromlist to have access to it.
    Maybe there's a manual workaround, like say for instance that if the user clicks the Tab button you can then pop up another screen with a list of items.
    Hope it helps!

  • Cannot logon user defined in header variable!

    Dear Guru's
    I'm seeing this this error when I type the URL. "Cannot logon user defined in header variable!"
    I have stopped and sterted the portal.
    I could not find the authschemes.xml (if this is related)
    Thanks,
    EP6 SP2
    Naren

    Hi ,
    Please explain what exactly you want to do ..If you want to use  Header Variables for User Authentication  go through this links
    http://help.sap.com/saphelp_nw2004s/helpdata/en/68/5ddc40132a8531e10000000a1550b0/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/68/5ddc40132a8531e10000000a1550b0/frameset.htm
    Thanks n Regards
    Santosh
    Reward if helpful !!!

  • Populate User Defined Fields

    Hello everyone,  I have an add on that puts a button on the invoice that when clicked, brings up a screen to fill in some information and submits the information.  The add-on then takes some of that info and populates UDFs on the invoice and submits the invoice.  1.  My first question is, do I have to have the UDF's visible in order to populate them?  I found that I received an error when I tried to set their value when they were not visible, but wasn't sure if there was a way around that.  2.  I am finding that it is difficult to track which UDF form links to the invoice form.  Is there a way to tie back the UDF form (-133) to the invoice (133)?  It is not FormTypeCount, because that goes solely by the order in which the screens were displayed...  Please let me know.  My true goal here is for someone to be able to have multiple invoices up with multiple versions of my add on and when they submit, they all submit the right thing. 
    Your assistance as always is greatly appreciated.  Thank you so much.

    Hi, today I've also looked for a solution to be sure that the UDF-Form (in my case for sales quotation) is always open.
    Now I do it with activating View User Defined Fields:
    SboUI.Menus.Item("6913").Activate()
    when the Form is opened.
    Catching Item-Event et_FORM_LOAD seems to be too early for that.
    Now I'm catching the Menu-Event ('after') for Sales Quotation:
    MenuEvents:
    If pVal.MenuUID = "2049" And Not pVal.BeforeAction Then
       SboUI.Menus.Item("6913").Activate()
    End If
    And preventing the UDF-Form to be closed
    Item Events:
    If pVal.FormTypeEx = "-149" (....) Then
       If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_CLOSE And pVal.BeforeAction Then
          BubbleEvent = False
       End If
    endif
    I'm still not sure if this is really a good solution...

  • Cannot Apply User Define Serial for ITEMS

    hi ,
    we have to generate user define serial # for items . for that we need to upload the MAC addresses as serial number from a excel spread sheet can any one help regarding that please
    Thanks & regards
    Moni.

    Moni,
    You have to do some coding to achieve this:
    1. Create a table with three columns like serial_id, serial_number,taken_sts.
    2. Load your serial numbers from spreadsheet to this table using an insert or SQL Loader.
    3. Oracle gives you this package user_pkg_serial with nothing coded in package body. Add your logic to this body to return only one serial number at a time. That is the reason I asked you to create table with three columns. Maintain taken_sts column as N for only one serial number at a time and return that serial number (out parameter of the package body).
    4. It is extremely important to return the x_return_status as 'S' otherwise this will not work.
    5. Run the Generate Serial Numbers program and your serial numbers can be seen in the mtl_serial_numbers table.
    Please let me know if you need more info.
    Thanks
    Nagamohan

  • Cannot comile user defined classes

    Hello i have a problem on compiling user defined classes .
    example
    file x.java
    public class x{
    file y.java
    import x;
    public class y{
    I first compile x.java and everything is OK .
    Then i compile y.java and the compiler gives the folowing
    y.java:2: '.' expected
    import y
    I have tried to put the classes on a package and added the folowing line yo each file
    import /home/bill/test
    Then i puted the java files on that dir
    and compiled with
    javac -classpath /home/bill/test y.java
    AGAIN THE SAME
    y.java:2: '.' expected
    import y
    WHAT I DO WRONG PLEASE HELP!!!!!!!!!!!!

    1. Since J2SDK 1.4, you can not import classes that are in the default (or unnamed) package. You are getting the error because the compiler expects something after y like y.*;
    2. You do not need to import classes that are in the same package, and all classes in the default package are in the same package.
    In your case, your classes are in the default package so remove the import statement.

  • 1.5.5 Cannot add user defined report to folder

    Hello,
    the context menu on folders in user defined report show only two options: copy and export. No way to add new folders or reports. I migrated my settings from 1.5.1.
    Though I can add a new folder directly at the root of user defined reports. But then SQL Developer won't restart (using 100% of my dual core until I kill the process).
    Running WIN XP JDK 1.6.10
    Regards
    Marcus

    Hello Sue,
    I already tried the current production version 2.1.0.63.73 and the problem is still there.
    In addition I did yet another test without migrating the old reports, connections etc. by renaming the appropriate folder in C:\Documents and Settings\michael\Application Data.
    Afterwards I imported my own reports.
    However there was no chance to move or delete any sub folders containing my reports. I only could copy or export sub folders or delete single reports.
    And after restarting sqldev the same behavior occurred on the new folders just created: Only export and copy are available accessing the context menu.
    Any suggestions? Do I have to re-create every single report?
    Regards,
    Peter
    Edited by: petmichael on Jan 15, 2010 12:27 PM
    Today I found out that changing the language settings for sqldev to English by adding the appropriate settings in sqldeveloper.conf located in \...\sqldeveloper-2.1.0.63.73\sqldeveloper\bin (mentioned below) does solve the problem.
    AddVMOption -Duser.language=en
    AddVMOption -Duser.country=US
    AddVMOption -Duser.region=US
    AddVMOption -Dfile.encoding=GBK
    By deleting these additional settings the error is reproducible.
    In addition with the English language settings the "Tip of the Day" appears running version 2.1.0.63.73 first time and it doesn't work that way without the additional settings mentioned above.
    Hth everybody running in that feature!

  • Cannot create user defined report

    Guys,
    For an unknown reason, I'm unable to create new reports in some subfolder inside the "User defined report". When I rigth-click on the subfolder, the contextual menu contains only "Copy" and "Paste". But If I'm going to the root folder (User defined report), I'm able to create a new subfolder and new report. I'm even able to create an new report in the subfolder.
    Did you already encounter the same issue and how did you solve it ?
    Thanks

    I vaguely remember someone having issues with user defined report operations, the problem there was solved by changing the user language to English by adding
    AddVMOption -Duser.language=ENto the sqldeveloper.conf file normally located in
    SQLDEVELOPER_INSTALL_DIR/sqldeveloper/binIf you are not already running in English try changing this.

  • Cannot salve User Defined Reports

    There's a bug in EA 08.04.
    After create (or modify) an user defined report, in next time that you launch Raptor the new report (or the modification) it's not salved.

    What OS are you using and do you have a space in your path? We had previously had a bug where the User Defined Reports were not being saved if there was a space in the path but that was fixed for 796/804. I just tested on Windows XP and it worked fine.
    Did you do a clean install of 804 or did you install over your old 715? If you did not do a clean install - can you please clean out and install again.
    -- Sharon

  • Cannot remove user define fields

    Hi,
    I am trying to remove a user defined field (U_Prirev) in Table (OHEM) and am getting the following error:
    Ref count for this object in higher then 0. Error No -1120
    The code is as follows :
            Dim sRequete As String
            Dim errCode As Long
            Dim errMsg As String
            Dim IdField As Integer
            Dim oUFields As SAPbobsCOM.UserFieldsMD
            oUFields = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)
            Dim oRecordSet As SAPbobsCOM.Recordset
            oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            sRequete = "SELECT FieldID FROM CUFD where TableId = '" & pNomTable & _
                       "' and AliasID = '" & pNomChamp & "'"
            oRecordSet.DoQuery(sRequete)
            If (oRecordSet.EoF = False) Then
               IdField = CType(oRecordSet.Fields.Item(0).Value, Integer))
                If (oUFields.GetByKey(pNomTable, IdField) = True) Then
                    If (oUFields.Remove() <> 0) Then
                        oCompany.GetLastError(errCode, errMsg)
                        Console.WriteLine("Erreur => Code = " & errCode.ToString + " Message = " + errMsg)
                    End If
                End If
            End If
                 System.Runtime.InteropServices.Marshal.ReleaseComObject(oUFields)
            oRecordSet = Nothing
        End Sub
    Anyone knows why i am getting this error.
    Thanks
    Laurent.

    Hi Laurent
    That error you are getting is the error that you get is when there is more than one instance of meta data object open. You see only one metedata object can be open at a time.....if it's higher than zero it means others are available. I see you have,
    System.Runtime.InteropServices.Marshal.ReleaseComObject(oUFields)
    oRecordSet = Nothing
    this is good and what closes the meta data object. But check that you have done this in previous funtions where you might of added other things.Also your recordset, close it before adding.....move oRecordSet = Nothing to before your Remove of the field. that has be the case for me before. Do it without the recordset as a test and you'll see it works.
    Hope it helps

  • User defined column heading

    Hello Every1,
    The following is a peice of code produces a report. At the moment the heading of the column is GBCCCL15/16_CSAHEPA because it has been hard coded that way. However what i would like instead, is the heading of the column to be what ever the user selects. What i mean by this is, what ever the user chooses to search in the text fields will then be displayed as the column heading when the report is exicuted.
    select schema_name,
    max(GBCCCL1516_CSAHEPA) as "GBCCCL15/16_CSAHEPA"
    from     
         select     schema_name, created_time,
         case when
              server_name||'_'||db_name='GBCCCL15/16_CSAHEPA'
              then DB_PATCH_NUMBER||'v'||VERSION_NUMBER else null end GBCCCL1516_CSAHEPA
    from      version_control
    group by schema_name
    order by SCHEMA_NAME
    Does anyone know how to get this done?
    Thanks in advance.

    Hi,
    Headings can be created dynamically. Change the headings type to PL/SQL. You then see a "Function returning colon delimited headings" setting - enter in something like:
    DECLARE
    v_headings VARCHAR2(2000);
    BEGIN
      v_headings := '';
      SELECT USER_HEADING INTO v_HEADINGS FROM TABLEX;
      RETURN v_headings;
    END;The string returned must be a colon-delimited string with one value for each column. eg:
    COL1:COL2:COL3Andy

Maybe you are looking for

  • Page up and page down in ALV

    Hi all ,      Page up and page down are not working automatically in my ALV Grid report. I have all set in my pf-status. Do i need to explicitly write any code for that or do i need to any setting for that plz let me know . regards rao

  • SSO with Analysis for MS Excel?

    Hi, We are in the process of setting up our new BO4 environments and we will be integrating BO with the SAP Netweaver Portal, so our users will log on to the Portal and then open up a tab that will display the BI Launch Pad logging on to BO with SAP

  • Interesting thread bug

    Hi, I'm developing a client/server whiteboard system for my term project. I've hit to an interesting threading bug. The very brief description of the goal is like this: A client has a method (getActiveUsers) to get the list of active(logged in) users

  • How can i use Catalog in Method Type?

    Dear Experts, How can i use Catalog in Method Type? I want to use Multiple method type mean require selection option(help from catalog)and also need to entere the result against certain parameters. So how can i do this possible ? Except use of additi

  • How do you take information from one layer and switch it to another?

    I am trying to figure out how to take pictures and text that I have already placed on one layer and switch it to another layer. I have like 50 pages worth of information and I am trying to look for the easiest way to do this. In illustrator and Photo