Update User Defined Field using DBDataSource

Hi All,
I'm trying to update the user defined field using the DBDataSource object.  However an error occurred - "Item is not a User-Defined Field".
The code used is as follows:
Dim oDS as SAPbouiCOM.DBDataSource
Dim oForm as SAPbouiCOM.Form
Set oForm = SBO_Application.Forms.GetForm("139", 1)
Set oDS = oForm.DataSources.DBDataSources.Item("ORDR")
oDS.SetValue("U_Field1",oDS.Offset,"abc")
Please help.

If you haven´t put the field directly in the standard form the user defined fields are in a different form. This form has the same type but with "-" before it.
So so should use this code to get the user defined fields form:
Set oForm = SBO_Application.Forms.GetForm("-139", 1)
Maybe this can be the cause

Similar Messages

  • Error -5002 when adding linked user defined field using DI API

    Hello,
    When I try to add a linked user defined field using DI API I get the error number -5002 with description:
    "The field 'Related Table' should consist of 8 alphanumeric characters with no valid or default values"
    I Get the error when I use the Add method.
    What is the solution for this problem? I use SBO 2005 A SP1 Patch 18
    The code I use is (.NET C# 2.0):
    SAPbobsCOM.IUserFieldsMD uf = (SAPbobsCOM.IUserFieldsMD)company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields);
    uf.Name = "S_BUCO";
    uf.TableName = "OPOR";
    uf.Type = SAPbobsCOM.BoFieldTypes.db_Memo;
    uf.SubType = SAPbobsCOM.BoFldSubTypes.st_Link;
    uf.LinkedTable = "S_BU";
    uf.Description = "Description";
    uf.Add()
    Regards,
    Jeffrey

    Hi Jeffrey,
    Your code above does not match the settings you are using in the UI. In particular, the type and subtype you are setting in code are not correct.
    To create the UDF via code, set the field types as follows:
    SAPbobsCOM.IUserFieldsMD uf = (SAPbobsCOM.IUserFieldsMD)company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields);
    uf.Name = "S_BUCO";
    uf.TableName = "OPOR";
    uf.Type = SAPbobsCOM.BoFieldTypes.db_Alpha;
    uf.EditSize = 8;
    uf.LinkedTable = "S_BU";
    uf.Description = "Description";
    uf.Add()
    There's no need to set the SubType property as you require a regular alphanumeric field.
    Kind Regards,
    Owen

  • Update user defined fields in MARA using bapi_material_savedata

    Hi,
    I have this problem:
    I am creating materials from a Z table filled by another application (not SAP). I am using the bapi "bapi_material_savedata" to create the materials and it is working fine. But now I need to fill user defined fields in the MARA table from this Z table, and this fields, are not filled after using the bapi.
    I am using the bapi tables "extensionin" and "extensioninx".
    I have modified the BAPI_TE_MARA structure adding the ZZ fields of the MARA and the BAPI_TE_MARAX structure with the same fields but different data elements. So I have this structures/tables:
    BAPI_TE_MARA:
       MATERIAL - MATNR
       ZZDIM1   - ZZCHDIM1
       ZZDIM2   - ZZCHDIM2
       ZZDIM3   - ZZCHDIM3
    BAPI_TE_MARAX:
       MATERIAL - MATNR
       ZZDIM1   - BAPIUPDATE
       ZZDIM2   - BAPIUPDATE
       ZZDIM3   - BAPIUPDATE
    MARA:
    ..(standard fields of the MARA)....
       ZZDIM1   - ZZCHDIM1
       ZZDIM2   - ZZCHDIM2
       ZZDIM3   - ZZCHDIM3
    Here is the code that i'm using to update the extensionin and extensioninx tables:
    DATA x_bapi_te_mara TYPE bapi_te_mara.
      DATA x_bapi_te_marax TYPE bapi_te_marax.
      it_extensionin-structure = 'BAPI_TE_MARA'.
      it_extensioninx-structure = 'BAPI_TE_MARAX'.
    * the internal table it_material contains the data of the
    * ZZ fields
      MOVE-CORRESPONDING it_material TO x_bapi_te_mara.
      x_bapi_te_mara-material = it_material-matnr.
      x_bapi_te_marax-material = it_material-matnr.
      x_bapi_te_marax-zzdim1 = 'X'.
      x_bapi_te_marax-zzdim2 = 'X'.
      x_bapi_te_marax-zzdim3 = 'X'.
      it_extensionin-valuepart1 = x_bapi_te_mara.
      APPEND it_extensionin.
      it_extensioninx-valuepart1 = x_bapi_te_marax.
      APPEND it_extensioninx.
    Also i have an entry in the table T130F that i'm not sure i need.
    Please help me to fill this user defined fields !!
    Regards,
    Jesus

    I'm using both,
    x_bapi_te_mara-material = it_material-matnr.
    x_bapi_te_marax-material = it_material-matnr.
    The first line is from the x_bapi_te_mara structure and the second for the x_bapi_te_maraX.
    Thanks

  • Modifying/Updating User Defined Field in a Scheduled Task

    I've written a notification task to send an e-mail to a manager who has a contract employee with a contract that is about to expire.
    Once we isolate a user who has a contract about to expire, we send a notification to the manager. The date that the notification is sent out should be stored in the USR table in a user-defined field, "USR_UDF_LASTSENT."
    Updating this USR_UDF_LASTSENT field is where I'm having difficulty.
    I've tried using the UserManager in a couple of ways. Suppose I've isolated a single user using SearchCriteria and the UserManager and have a single User object called "currentUser." I want to store a Date object in the user defined field "USR_UDF_LASTSENT". Date today = new Date();
    I've tried: currentUser.setAttribute("USR_UDF_LASTSENT", today); //This will run without error, but when I check the DB there is no change to the attribute.
    With a defined instance of UserManager userManager, I've tried: userManager.modify("USR_UDF_LASTSENT", today, currentUser); //This errored out with this error - oracle.iam.identity.exception.NoSuchUserException: IAM-3054135:No user found for the criteria USR_UDF_LASTSENT-9/24/13 2:58 PM.:USR_UDF_LASTSENT:9/24/13 2:58 PM. It looks like it's doing a search rather than a modification.
    I've also tried using the entity manager in the following way:
    Date today = new Date();
    HashMap<String, Object> mapAttrs = new HashMap<String, Object>(); 
    mapAttrs.put("USR_UDF_LASTSENT", today); 
    EntityManager entMgr = Platform.getService(EntityManager.class); 
    entMgr.modifyEntity("User", currentUser.getEntityId(), mapAttrs);
    But it returns with this error: Failed: oracle.iam.platform.entitymgr.UnknownAttributeException: User : [USR_UDF_LASTSENT]
    Is my entityType, "User" inappropriate in this case? What should be used here?
    How can I Set or Update this user defined field from a scheduled task?

    Thanks guys. I did go to Identity System Administration console and chose 'Export' from under "System Managment" which I believe Kevin may have been hinting at. I got an xml export of the AttributeDefinitions for our user defined fields. In this file, there was a header for the attribute I was looking for:
    <AttributeDefinition repo-type="API" name="LastSent" subtype="User Metadata">
       <multiValued>
       <backendName>usr_udf_lastsent</backendName>
    I put the string "LastSent" in place of USR_UDF_LASTSENT in the EntityManager version of my attempt at this task. I believe this is what Kevin and delhi were getting at.
    This didn't work:
    Date today = new Date();
    HashMap<String, Object> mapAttrs = new HashMap<String, Object>(); 
    mapAttrs.put("USR_UDF_LASTSENT", today); 
    EntityManager entMgr = Platform.getService(EntityManager.class); 
    entMgr.modifyEntity("User", currentUser.getEntityId(), mapAttrs);
    But this did:
    Date today = new Date();
    HashMap<String, Object> mapAttrs = new HashMap<String, Object>(); 
    mapAttrs.put("LastSent", today); 
    EntityManager entMgr = Platform.getService(EntityManager.class); 
    entMgr.modifyEntity("User", currentUser.getEntityId(), mapAttrs);
    I wonder if currentUser.setAttribute("LastSent", today); would work... Hmm.

  • IMPORT USER DEFINED FIELD USING DTW

    Hi
    I want to IMPORT USER DEFINED FIELD OF SALE ORDER THAT ARE PRESENT IN ROW LEVEL AND DOCUMENT LEVEL
    USING DTW.
    SO PLZ GIVE ME SOLUTION FOR THAT.
    THANK YOU

    Hi,
    What is your B1 version and PL? Please do not use all CAPS. It is not polite.
    Thanks,
    Gordon

  • Error while linking user defined table to user defined field using vb6.0

    Hi,
    I am creating a userdefined field on a SAPB1 table(PDN1) using vb 6.0
    I am trying to link this field to a user defined table.
    When i do that i get the following error:
    "The field 'Related table' should consist of 8 alphanumeric chracters with no valid or default values"
    When i try to do the same thing from SAPB1(not using code) there is no such problem.
    My vb code is as follows:
    Set oUserFieldsMD = oCmp.GetBusinessObject(oUserFields)
    oUserFieldsMD.TableName = "PDN1"
    oUserFieldsMD.Name = "OB_Locn"
    oUserFieldsMD.Description = "WH Location"
    oUserFieldsMD.Type = db_Alpha
    oUserFieldsMD.EditSize = 30
    lRetCode = oUserFieldsMD.Add
    If lRetCode <> 0 Then
        oCmp.GetLastError lErrCode, sErrMsg
        MsgBox sErrMsg
        GoTo Err_
    End If
    If Not oUserFieldsMD.GetByKey("PDN1", 0) Then
        MsgBox "Error"
        GoTo Err_
    End If
    oUserFieldsMD.LinkedTable = "OB_TEST"
    lRetCode = oUserFieldsMD.Update
    Your help will be much appreciated.
    Thanks.

    Great Sébastien!
    Looks like we could not survive here one day without your contribution
    Best regards,
    Frank
    PS: For readers of this thread who don't understand why
    EditSize
    must be "8":
    This is the size of the
    Code
    field in the user-defined table to which the new field OB_Locn (in the DB it will be U_OB_Locn) is linked to...
    So, it should be preferrably of the same size.

  • DI Server and User Defined Fields

    Hello experts,
    When I add user defined fields to an object, am I able to update those user defined fields using the UpdateObject command on the DI Server? I have looked for answers on this subject, but I only got answers from 2006 saying that it wasn't possible. Has this been resolved yet?
    I couldn't find any documents with best practices on this subject. Are any documents available?
    Thanks for your time!
    Vincent

    Vincent,
    Per the SDK Help Center Documentation for the 2007A SDK and DI Server, the documentation states...
    "After adding new user fields to the database (either through the application or the DI API), it is required to stop and start the DI service, so that  the object schema will be updated and the DI Server would identify those changes."
    Have you done this?
    Eddy

  • User defined fields via DI-API

    I want to read user defined fields using the DI-API.
    The following code works but lists only UDFs defined for articles:
    SAPbobsCOM.Items item =
    (SAPbobsCOM.Items) GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems);     
    int count = item.UserFields.Fields.Count;
    MessageBox.Show("count == "+anzahl.ToString(), "OK");
    for(int i=0; i<count; i++){
      MessageBox.Show("index == "+i.ToString(), "OK");
      MessageBox.Show("name == "+item.UserFields.Fields.Item(i).Name, "OK");
    If I try to list all UDFs defined in the system using the oUserFields object I get an exception when I assign the business object:
    try{
      SAPbobsCOM.UserFields ufd = (SAPbobsCOM.UserFields)
      GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields); // exception
      int count = ufd.Fields.Count;
    catch(System.Exception ex){
      MessageBox.Show("ex.ToString(), "OK");
    The exception says something like
    InvalidCastException: COM object of type 'System.__ComObject' can not casted into
    interface type SAPbobsCOM.UserFields
    Thank you for help,
    Frank Romeni

    Hi Vítor,
    thank you for the hint to UserFieldsMD - now the access works.
    You wanted to know what I am trying to do - let me explain the background even it is a bit complicated:
    I have to access a certain UDF defined for articles.
    To access this UDF I can't use a fixed index like e.g. '5' in
    item.UserFields.Fields.Item(5).Value
    because this index is 5 only on my local machine - it could be a different index on the target machine.
    I solved this in writing some sql-code to access table CUFD and to find the index of this UDF in CUFD.FieldID.
    But sometimes there is a problem when there are UDFs deleted from the database. It is possible that there are 'holes' between the FieldId of UDFs of one object, e.g.
    Initial entries in CUFD (Table, FieldId, Name  => code to access field):
    OITM 0 'myUDF1'   ==> item.UserFields.Fields.Item(0).Value
    OITM 1 'myUDF2'   ==> item.UserFields.Fields.Item(1).Value
    OITM 2 'myUDF3'   ==> item.UserFields.Fields.Item(2).Value
    After deletion of 'myUDF2':
    OITM 0 'myUDF1'
    OITM 2 'myUDF3'
    Now the access to 'myUDF2' with item.UserFields.Fields.Item(2).Value fails!
    You have to use index '1' in .Item(index) to access 'myUDF2' because this UDF is now the second UDF in the item object (zero based).
    After I realized this I didn't use the sql-code to get FieldID any longer and searched with a loop all existing indices and compared them with the name of my special UDF, e.g. (this code works as expected):
    public int getUDFIndex(string udfName){
      index = -1;
      for(int i=0; i<item.UserFields.Fields.Count; i++{
        if(item.UserFields.Fields.Item(i).Name == udfName){
          index = i;
          break;
      return index;
    Now I tried to make this method more general to find UDFs in any object - not only in item objects.
    This is the background I wanted to access SAPbobsCOM.UserFields for.
    The problem is that UserFieldsMD has no method like Item(index) as I used it in my example.
    Do you have an idea to solve the problem with the 'holes' between FieldId in the UFD-table CUFD?
    Frank Romeni

  • User Defined Field that gives the date output of the last price update.

    We would like to create a User Defined Field (UDF) with a Formatted Search (FMS) on the Item Master form that gives the date output of the last price update specifically the wholesale price.
    Last Price Update
    Pricelist 2 = Wholesale
    Is this feasible?
    If it is feasible what is the recommended approach?
    Current working UDF on Item Master.
    /* Date output is based on all the latest updates on the Item Master.*/
    select max(updatedate)
    from aitm
    where itemcode = $[oitm.itemcode]
    Resources that were helpful.
    1.(Note:1165947 - Tracking Item Price Changes.)
    2. Case 4-I6: Query on price updates. Mastering SQL Queries for SAP Business One By: Gordon Du

    Thank you Gordon,
    We are looking for the date output of the 'Last Price Update' based on 'Pricelist 2 = Wholesale' which is the challenge.
    These 2 are the parameters for the date output, I should have mentioned that in my original message.
    Last Price Update
    Pricelist 2 = Wholesale
    Per reading a bunch of other similar Forum Questions it looked like it is might not be possible to do. With there being no date on the AIT1 table and AITM.Updatedate is based on any and all updates not just last 'Last Price Update' and not sure how to use the loginstanc.
    Thanks,
    Vern

  • Use of user define field in Task list

    Hi,
    Please give the solution for the strange requirement of the client as:
    My client wants to define the operation for preventive maintenace in two parts like
    check temperature  :  45 deg celcius.
    check temperature should be like operation and rest what he has to check to be defined in other field  i.e. both should not be together.
    so i find the solution as user defined fields in the task list where i can define this second parameter.
    But the problem is that system is not proposing this second field in the preventive order, only operation field is proposed.
    Please suggest some solution, how can this requirement can be mapped.

    Both operations of the inspection lot will need to be completed at some point.  They are in the same lot so they belong together.  Both operations should be available to the user.  (Unless you used workcenters and security to limit users to specific workcenters).
    Once set up, it will only be available to new inspection lots.  Few things in SAP are retroactive.
    Craig

  • How do I refer to a user defined field in a query  (using $ notation) ?

    if i have a user defined field in Invoice header called U_Test, and if I need to read it using a query (to be used on a formatted search).
    I am not quite sure of the syntax. can anyone help please?
    I tried
    $[$U_Test.0.0]  which is the accepted way with fields with numerical ids such as $[$8.0.0] etc.
    appreciate any help,
    Indika.

    Hi all,
    Aliw, the 38 is not the form number, is the Item Number (which I guess is a matrix). In your case the User Defined Field is a line UDF. In Indika´s case is a header UDF.
    And that´s the issue. As the indika´s UDF is a header UDF, it lays in a different form (which is named "-" + Main Form Name). Formatted searches work with the $[$Field.Column.Format] notation ONLY in the same form. So, if you try to get the UDF from another UDF, it will work with that notation (they are in the same form). But if you try to get the UDF from the main form, it won´t find it (It is in another form).
    In that case you should use the other notation, as Andrea, Alexey and Salvador told you in the posts before.
    Hope this clears a bit the issue.
    Regards,
    Ibai Peñ

  • How to use User Options and User-Defined Fields in DC Group function?

    Dears,
    As title, when should I use above fields?  I did not see the related information in SAPME help library.
    Thanks!

    The user options fields are just information fields you can store at the Data Collection Maintenance activity. You can think of these as extra information fields for storage purposes only.  I can't give you a use case except to say 'information fields' only.
    With regards to the User-Defined fields in DC Group - you can think of these as extra data fields to be collected.  They will appear immediately underneath the data parameter they are defined in in the DC Plug-in for the POD.  They do not have limits but are just extra pieces of data you may want to collect about the specific parameter.

  • User-Defined Fields Window

    Hi All,
    I have one issue with the User-Defined Fields window of the ACTIVITY form.
    I had added some user defined fields (UDF) to the Activities so that the User-Defined Fields are displaying in a separate window just near to the Activity window with Type (-651). All the UDFs are bound to the table, "OCLG".
    I want to initialize the values in the User defined fields controls with a text when the form is loading.
    I had tried to do this using
    oForm.Datasources.DBDatasources.Item("OCLG").SetValue("U_CUST",0,"MyValue");When I executed this statement, i am getting HResult error.
    Then I tried this by using UserDataSources.
    The same error repeats.
    But the code with .Specific.String = NewVal is working fine.
    Can you please explain the scenarios that we are able to do it using .Specifc.String. Is this a true method for doing this?
    if not
    please tell me How can we do this using Datasources (DBDatasources/ UserDataSources),?
    Please Help.
    Thank you in Advance
    Anoop

    Anoop,
    when you have created UDF in master item data, the textbox you can see on left side of form (separate form) is bounded already to this field. You cannot rebound it (its system form).
    When you want to change the value, you must use specific.string or specific.value for that textbox (as you wrote), but the calcualted value will be stored into master table (change of udf will set formmode to update mode). If you dont need to update formmode, set the formmode by code to normal mode.
    hope it helps
    Petr

  • User defined field in SD and its link to Value field in COPA (??)

    Dear All,
    We have created one "Z" field i.e. user defined field and its in VBRP Table. This is a quantity field. to update the values in this field we have used an exit in sales and distribution module. Now, by defining this exit values are correctly populated in VPRP table on line item basis.
    Requirement here is we need to get this field in COPA, for same i have carried out the quantity field assignment to value field (KE4M).
    Even after this configuration profitability segment is not updated.
    Regards,
    Sayujya
    Edited by: sayu on Mar 15, 2010 10:13 AM

    In the past I did something similar and had to use function module EXIT_SAPLKEAB_001 in enhancement COPA0002 to populate the field.  To use this exit you'll first need to add a user exit id to your valuation strategy (transaction KE4U).  The help on the function module is pretty good, but if you run into a problem let me know.
    thanks,

  • User-defined field assignment  in Contact object

    Good Day
    Experts:
    I guess this might apply to all SAP Business Objects.  Specifically, I am working with the oContact object.  A User-defined field has been added to the OCLG table.  I need to populate the field with the current logged on User.  I see that I can do the following with the intellisense but I am not sure where to go from here.
    vContact.UserFields.Fields.Item
    I tried but I get a message "Expression is a value and therefor cannot be the target of an assigment:
    vContact.UserFields.Fields.Item("U_Creator") = (GetUserCodeSess(g_B1Connection.Company.UserName))
    It feels like I should be able to set the User-defined variable through the object but I don't think I am doing it correctly.
    Any helpful hints?
    Thanks,
    Ed

    Hi Robert,
    I think the only supported way is to give full rights to the users and block changing field in the Item Master Data form through your addon.
    A non supported way is to use a query to update the item master fields
    Regards
    Ad

Maybe you are looking for

  • Internal orders to WBS Element

    Hi, I,m working in a Project System implementation project, where all other modules are already in use.As per the existing process, Internal orders are created for asset accounting.Those are of statistical. All the purchase orders & costs are booked

  • Need inexpensive monitor for powermac G4... suggestions?

    I dont know much about compatibility of PC monitors with mac towers. what do i need to know to make sure a monitor will be able to connect to my G4 tower?

  • Flash Hang-ups

    CS3 Flash Hangs specifically while creating motion tweens. I usually have to quit the application and lose any data that wasn't saved prior. Any help in solving this issue would be great. Pwilson

  • Aligning dynamic text

    Hi, I've got a dynamic text box that retrieves text using Action script from an external PHP file. It works well except when I set the dynamic text in Flash to be centrally aligned it still aligns the text to the left when I play the movie. I'm guess

  • I am a Facebook/Zynga user. Firefox 5 is slow, How do I revert bach to previous version?

    Too slow, revert to previous firefox version please