How to Update UDO through DI API code

Hello,
I have created UDO through DI API successfully, now I want to update the UDO through DI API code, and want to add some more child tables, but I am unable to do that, its showing me message that UDO successfully updated but when I am checking through B1, I can see that newly created child tables are not ticked in the check boxes. I am pasting my code, Please some one tell me how to fix this problem.
Private Sub AddUDO()
Dim oUserObjectMD As SAPbobsCOM.UserObjectsMD
oUserObjectMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
oUserObjectMD.CanCancel = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.CanClose = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tNO
oUserObjectMD.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.CanFind = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.CanLog = SAPbobsCOM.BoYesNoEnum.tNO
oUserObjectMD.CanYearTransfer = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.ManageSeries = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.ChildTables.TableName = "DC3_N"
oUserObjectMD.ChildTables.Add()
oUserObjectMD.ChildTables.TableName = "DC4_N"
oUserObjectMD.Code = "UDO_CHECK_N"
oUserObjectMD.ManageSeries = SAPbobsCOM.BoYesNoEnum.tYES
oUserObjectMD.Name = "UDO_CHECK_N"
oUserObjectMD.ObjectType = SAPbobsCOM.BoUDOObjType.boud_Document
oUserObjectMD.TableName = "DMT_N"
oUserObjectMD.GetByKey("UDO_CHECK_N")
lRetCode = oUserObjectMD.Update()
If lRetCode <> 0 Then
If lRetCode = -1 Then
'chkUDOAfter.SetItemChecked(12, True)
Else
oCompany.GetLastError(lRetCode, sErrMsg)
MsgBox(sErrMsg)
End If
Else
MsgBox("UDO: " & oUserObjectMD.Name & " was updated successfully")
'chkUDOAfter.SetItemChecked(14, True)
End If
oUserObjectMD = Nothing
GC.Collect() 'Release the handle to the table
End Sub
Regards,
Sudeshna.

Hi Ian,
I have pasted the line "oUserObjectMD.GetByKey("UDO_CHECK_N")" immediately after "oUserObjectMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
" like below:
oUserObjectMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
oUserObjectMD.GetByKey("UDO_CHECK_N")
but this time it is adding the two new tables in UDO, but some how removing the first Master table from UDO.
Can you tell me how solve this, or can you provide some working code example regarding this.
Regards,
Sudeshna.

Similar Messages

  • How to register UDT into UDO through DI API?

    Hi All
    I am creating User Data tables and fields by using an Add on through DI API.
    Now i want to register these tables and fields into User Defined object in SAP B1 using add on through DI API.
    What are the possible ways for this?
    And can you provide me sample codes?
    Thanks in advance.

    UDO should be built on top of a UDT. So you need to create the UDT first and
    then the UDO. You need to use the metadata objects available in DI API, i.e.
    objects like UserTablesMD, UserFieldsMD, UserObjectsMD. All of these are
    fully documented in the SDK Help.

  • Insert a record into UDO through DI API

    Dear All,
    I have a UDO with the type document created. I would like to insert records through DI (Document header and Document Rows). Can you please guide me how to do it?
    Thanks,
    Tamizh

    Hi Tamizh,
    Please have a look at this article:
    /people/daniel.wroblewski/blog/2009/03/26/udo-access-via-di-api-in-pl46
    It should have everything you need to insert and update UDO data. You need to be using SBO 2007A Patch 46 or higher to use this object in the DI API.
    Kind Regards,
    Owen

  • How to update JAR through URL

    Hello,
    I have implemented a standalone JAR file for windows, that runs in a system tray for our users to use. The application is using URL class to connect to our server and feed information. Trouble is that from time to time it may be necessary to update files packed in this JAR to give it other features. Instead of asking our users to download the JAR, I would like to have an option to update this JAR with a new JAR from the server, consequently using URL class.
    Could somebody please give me an idea on how to "download" a new JAR version and "replace" it with the existing one? So essential this should work as your typical "check for updates" feature. Any ideas on this matter will greatly be appreciated.
    Thank you,
    Victor.

    Java Web Start

  • How to update XML file through UCCX script ?

    Hi,
    I have an UCCX script with MENU step. One of the step is for technical support team. When caller chose this step, information about date and time of the call and calling number should be recorded on a XML file located on the web server.
    This XML is uploaded into the web server , but I don't know how to update it through UCCX script.
    Here is how the XML file looks like:
    <?xml version="1.0" ?>
    <rss version="2.0">
    <channel>
    <title>CALL LOG</title>
    <link></link>
    <description>Support Call log</description>
    <ttl>1</ttl>
    <item>
    <title>2011-08-24 14:56:39 - 00044 123 123 123</title>
    <link></link>
    <description></description>
    </item
    </channel>
    </rss>
    Any idea?
    Thanks,
    O

    Hi
    The 'keyword transform' step uses the template XML file to generate the actual XML file you want to post... the template would be a plain text file uploaded to the repository, and would look like so:
    <?xml version="1.0" ?>
    CALL LOG
    Support Call log
    1
    %%calldatetime%% - %%clinumber%%
    Now - if you had that bit of XML, with correct time/number in it - have you verified know that you can definately just post that XML to a certain URL to get it on the server? Check with whoever manages that server exactly what you need to do to get it to appear - then worry about how you do that from UCCX. It may not be a matter of posting up that XML, you may need it in a different format or something..
    Aaron

  • How to update Business place & Section Code for posted Documents

    Hi,
    I want to update business place and section code in existing documents, How to update business place and section code in the posted Documents. Is there any validation to check business place and section code while posting Document.
    Thanks in advance
    Best Regards
    Raj

    Hi Raynaju,
    Business place is an organizational unit and  it below company code level that is primarily used for reporting taxes on sales/purchases.
    For that no need to go for validation.Go to the field status and give the Business place & Section Code as required fields.
    There is a option in SAP as Document change rules.There give the company code,field name and account type
    Now you can change the fileds in posted document itself.
    May be this information is useful to you
    If you have any doubt feel free to ask
    Regards
    Aneesh
    Edited by: Aneesh kumarA on Jul 22, 2009 12:45 PM

  • HT1222 How to update ios 7.0.4 software by PC ,I have try 2 time but download is completely than error code 9006 , the update through iPhone only wi-fi option not through data charge , why.......

    How to update iOS 7.4 through PC

    See this support document for restore errors. http://support.apple.com/kb/TS3694

  • How to Create Highlighted text through the API

    I am trying to create a script that goes through a document and cut/pastes specific elements to another document in FrameMaker 7.1.
    So far, I can open a document and if an element is already highlighted/selected, i can cut the whole element using F_ApiCut().
    I am having problems programatically trying to highlight the element that I want to copy.
    So far, I have tried using the exampe from the FDKRef:
            //grab the selected element and set it to the elementRange
            er = F_ApiGetElementRange(FV_SessionId, docId, FP_ElementSelection);
            parentId = F_ApiGetId(docId, er.beg.childId, FP_ParentElement);
            er.end.parentId = er.beg.parentId = F_ApiGetId(docId, parentId, FP_ParentElement);
            // if the selected element is a child of the highest level element, the client returns here
            if(!er.end.parentId) return;
            er.beg.childId = parentId;
            er.beg.offset = er.end.offset = 0;
            er.end.childId = F_ApiGetId(docId, parentId, FP_NextSiblingElement);
            F_ApiSetElementRange(0, docId, FP_ElementSelection, &er);
            F_ApiCut(docId, 0);
    but this only grabs an element that is already selected. Is there a way to select an element through the API?
    Thanks for any help!

    TrainingDeveloper,
    There most certainly is a way. You can set up any kind of selection that you want, although it is definately a tricky process that can throw off even an experienced FDK developer. Here are my observations based on the code you pasted...
    If you want to select an element, the first thing is that you need to have the ID of that element. I don't see anywhere in your code where an element ID is retrieved. All I see is the F_ApiGetElementRange which is getting the current selection, which in turn is likely why you just keep cutting the currently-selected element. If you want to get a specific element, that function call is not applicable. You only need to set up the element range structure to reflect the proper selection and then cut.
    With that, assume that "elemId" is the ID of the element you want to cut. To select an entire element, you would do this:
    F_ObjHandleT elemId, docId;
    F_ElementRangeT er;
    /* . . .   code here to get elemId, docId, etc. . . .  */
    //set up the element range structure for whole-element selection
    er.beg.childId = elemId;
    er.beg.parentId = er.end.parentId =  F_ApiGetId(docId, elemId, FP_ParentElement);
    er.end.childId = F_ApiGetId(docId, elemId,  FP_NextSiblingElement);
    er.beg.offset = er.end.offset =  0;
    //set the element selection in preparation for the cut
    F_ApiSetElementRange(FV_SessionId, docId,  FP_ElementSelection, &er);
    //... and cut
    F_ApiCut(docId, 0);
    I'm not sure what the sample you pasted is meant to accomplish. It is somewhere along the right track but it won't get you exactly what you want.
    Now, I should say that the process of retrieving the desired element ID is a whole different challenge. I'm not sure if you know how to do that or not so I'll defer any discussion on that until you ask.
    Russ

  • How to update the bucketset of business rules in MDS through Rules SDK

    How to update the bucketset of business rules in MDS through Rules SDK.
    Any sample code which will help me........ :)
    Is it possible to expose a Business Rule as webservice which was created with the help of Java fact?
    Edited by: 984804 on Jan 29, 2013 6:12 PM

    FYI, the output of this call returns something like:
    <?xml version="1.0" encoding="UTF-8"?> 
    <queryplan>
        <union>
            <fullOuterJoin>
                <statement index="1">SELECT 'FY' || to_char(SALES.invoice_date,'yy'), count( distinct SALES.inv_id) FROM SALES GROUP BY 'FY' || to_char(SALES.invoice_date,'yy')</statement>
                <statement index="2">SELECT 'FY' || to_char(SALES.invoice_date,'yy'), sum(INVOICE_LINE.nb_guests) FROM SALES, INVOICE_LINE, SERVICE_LINE, SERVICE WHERE ( SALES.INV_ID=INVOICE_LINE.INV_ID ) AND ( INVOICE_LINE.SERVICE_ID=SERVICE.SERVICE_ID ) AND ( SERVICE.SL_ID=SERVICE_LINE.SL_ID ) AND ( SERVICE_LINE.service_line = 'Accommodation' ) GROUP BY 'FY' || to_char(SALES.invoice_date,'yy')</statement>
            </fullOuterJoin>
            <fullOuterJoin>
                <statement index="3">SELECT 'FY' || to_char(SALES.invoice_date,'yy'), count( distinct SALES.inv_id) FROM SALES GROUP BY 'FY' || to_char(SALES.invoice_date,'yy')</statement>
                <statement index="4">SELECT 'FY' || to_char(SALES.invoice_date,'yy'), sum(INVOICE_LINE.days * INVOICE_LINE.nb_guests * SERVICE.price) FROM SALES, INVOICE_LINE, SERVICE WHERE ( SALES.INV_ID=INVOICE_LINE.INV_ID ) AND ( INVOICE_LINE.SERVICE_ID=SERVICE.SERVICE_ID ) GROUP BY 'FY' || to_char(SALES.invoice_date,'yy')</statement>
            </fullOuterJoin>
        </union>
    </queryplan>

  • Creating UDO through code  with 1 Docment table & 4 Document Line Tables

    Hi,
    I need to create one Document table and four Document Line tables(child tables) and make them UDO through code. This process is working When I am creating UDO with one Document table and one Document Line table but if I add more than one Child table it is taking only one child.... Can anyone give me some solution or code example related to this problem this problem?
    Regards,
    Sudeshna.

    Hi,
    Firstly Trinidad, unfortunately I could not open that link.
    And secondly, the following is my code... Through this code I am trying to create an UDO with one document table and two document line tables.... here the UDO is being created but it is not taking two line table, its taking only one Document line table.... how can I create udo with more than one Document line tables?
    Dim oUserObjectMD As SAPbobsCOM.UserObjectsMD
    oUserObjectMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
    oUserObjectMD.CanCancel = SAPbobsCOM.BoYesNoEnum.tYES
    oUserObjectMD.CanClose = SAPbobsCOM.BoYesNoEnum.tYES
    oUserObjectMD.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tYES
    oUserObjectMD.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES
    oUserObjectMD.CanFind = SAPbobsCOM.BoYesNoEnum.tYES
    oUserObjectMD.CanLog = SAPbobsCOM.BoYesNoEnum.tNO
    oUserObjectMD.CanYearTransfer = SAPbobsCOM.BoYesNoEnum.tYES
    oUserObjectMD.ManageSeries = SAPbobsCOM.BoYesNoEnum.tYES
    oUserObjectMD.ChildTables.TableName = "childSplitNew1"
    oUserObjectMD.ChildTables.TableName = "childSplitNew2"
    oUserObjectMD.Code = "udoSplitNew"
    oUserObjectMD.ManageSeries = SAPbobsCOM.BoYesNoEnum.tNO
    oUserObjectMD.Name = "udoSplitNew"
    oUserObjectMD.ObjectType = SAPbobsCOM.BoUDOObjType.boud_Document
    oUserObjectMD.TableName = "masterSplitNew"
    lRetCode = oUserObjectMD.Add()
    Regards,
    Sudeshna.

  • How to update Integrator's property that was created by api

    bne_integrator_utils.create_integrator(p_application_id => 20023, --CUX
    p_object_code => l_object_code,
    p_integrator_user_name => l_inte_user_name, --
    p_language => 'ZHS',
    p_source_language => 'US',
    p_user_id => -1,
    p_integrator_code => x_integrator_code --
    bne_integrator_utils.create_interface_for_api(p_application_id => 20023,
    p_object_code => l_object_code,
    p_integrator_code => x_integrator_code,
    p_api_package_name => l_package_name, --API
    p_api_procedure_name => l_procedure_name, --API
    p_interface_user_name => l_object_code || '_INTF', -
    p_param_list_name => l_object_code || '_INTF', --
    p_api_type => 'PROCEDURE', --API
    p_upload_type => 5,
    p_language => 'ZHS',
    p_source_lang => 'US',
    p_user_id => -1,
    p_param_list_code => x_param_list_code, -
    p_interface_code => x_interface_code --
    I use above code to create Integrator, it was going well,but after I finished the set ,I realized there was something wrong.
    So I want to use 'Manager Integrator' to update Integrator's property,but it was read only,
    so any one can tell me,how to update the Integrator's property just like coloum type and so on.
    ths for advice

    Hi,
    Use the below update statement.
    update bne_integrators_b
    set source='C'
    where integrator_code='Your Integrator code'
    then commit..
    Now u will be able to update the integrator from front end.
    Regards,
    Sreekanth.S

  • Updating a sales order through DI API

    Hi All,
         I have an issue regarding updating a sales order.
    The problem is:
      If there r 2 items(A00001&A00002) existed in the sales order and if I am adding two more items(A00003 & 4)the sales order is updated in a fashion that first item is replaced with third item and forth item is added as last record.The items to that particular sales order after updating will be like this(A00003,A00002,A00004).My doubt is why the 3rd item is replaced with first record.I am sending the code also i have written.
    objRecordSet = SBOCOMUtil.newRecordset(company);
                          IDocuments  oOrder =SBOCOMUtil.newDocuments(company,SBOCOMConstants.BoObjectTypes_Document_oOrders);
                                  objRecordSet.doQuery("select DocEntry from ORDR where DocNum=" + 1111);
                                  DocEntryL =objRecordSet.getFields().item(new String("DocEntry")).getValueInteger().intValue();
                          str += DocEntryL;
                          System.out.println(DocEntryL);
                          if (oOrder.getByKey(new Integer(DocEntryL))) {
                                  //objRecordSet2.doQuery("delete  from rdr1 where DocEntry="+DocEntryL);
                                  str += "2";
                                  System.out.println(str);
                                  //oOrder.remove();
                                  oOrder.setDiscountPercent(new Double(5));
                                  oOrder.setComments("success");
                                  System.out.println(str);
                                  IDocument_Lines oOrderLines = oOrder.getLines();
                                  str += "3";
                                  String[] item={"A00005","A00006"};
                                  for (int counter = 0; counter < item.length; counter++) {
                                       //  oOrderLines.setCurrentLine(new Integer(counter));
                                         if (counter > 0)
                                                 oOrder.getLines().add();
                                         str += "4";
                                  oOrderLines.setItemCode(item[counter]);
                                  System.out.println(item[counter]);
                                     //oOrderLines.setBaseType(new Integer(-1));
                                     //oOrderLines.setBaseEntry(new Integer(0));
                                   //oOrder.getLines().setCurrentLine(new Integer(counter));
                               //oOrderLines.setQuantity(new Double(1));
                                         //oOrderLines.setPrice(new Double(1500));
                                         //oOrderLines.setCurrency(strCurrency[counter]);
                                         //oOrderLines.setLineTotal(new Double(dblLineTotal[counter]));
                                  str += "5";
                                  //oOrder.getLines().getUserFields().getFields().item("Quantity").setValue(new Integer(2));
                                  System.out.println(str);
                                  int result = oOrder.update();
                                  str += "6" + result;
                                  if (result == 0) {
                                         System.out.println("successfully updated");
                                         company.disconnect();
                                  } else {
                                         company.getLastErrorDescription();
                                         System.out.println(
                                                 "Error :" + company.getLastErrorDescription());
                                         company.disconnect();

    If you are using SBP 2004 there are many threads on this forum talking about bugs when updating sales order lines through DI API. This issue was supposed to be fixed with patch level 45 for 2004 which was recently released.
    If u are using 2005 or SP1 I think you may have found a new bug.

  • How to Update Business Place & Sec.Code Field in Posted Document

    Dear All,
    Pls suggest how to update Business Place & Section Code field in documents which are posted without entering Business Place & Section Code. Pls tell me how to achieve this without using Validations & Substitutions. Any table entries can be maintained for this? Kindly guide.
    Regards
    Abhijeet

    Hi,
         Thanks for sending the replay,
         I had already update the Material document through the J1INPP T. code. but it not use for update FI
         Document and i want to update Business Place & Section Code in FI document.
         Please suggest,
    Regards
    Abhijeet

  • How to create UDO by code?

    Hi,
    the UDO is very useful,but how to create udo by code ?
    who has the samples ? can you send It to me by email or  can you paste it in here ? thanks .
    pls ,someone have said It can find in the path "C:\Program Files\SAP Manage\SAP Business One SDK\Samples  " ,but I can't find it . there are only 'COMUI' and 'Utility Projects' files .and I also have installed the DI API .
    so please email it to [email protected]
    Thanks again.

    Hi Adele,
    Thanks ,I have got the email.
    and my version is 'SAP Business One 2004.2 B (7.30.224)  SP: 00  PL: 30'
    this is my code that have writed before.
    Public Sub AddUDO()
        Dim oUserObjectMD As SAPbobsCOM.UserObjectsMD
        Set oUserObjectMD = SBO_Company_DI.GetBusinessObject(oUserObjectsMD)
        oUserObjectMD.CanCancel = SAPbobsCOM.BoYesNoEnum.tYES
        oUserObjectMD.CanClose = SAPbobsCOM.BoYesNoEnum.tYES
        oUserObjectMD.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tYES
        oUserObjectMD.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES
        oUserObjectMD.CanFind = SAPbobsCOM.BoYesNoEnum.tYES
        oUserObjectMD.CanLog = tNO
        oUserObjectMD.CanYearTransfer = tYES
        oUserObjectMD.ManageSeries = tYES
        oUserObjectMD.ChildTables.TableName = "APS1"
        oUserObjectMD.Code = "OAPS"
        oUserObjectMD.ManageSeries = tYES
        oUserObjectMD.Name = "OAPS"
        oUserObjectMD.ObjectType = SAPbobsCOM.BoUDOObjType.boud_Document
        oUserObjectMD.TableName = "OAPS"
        oUserObjectMD.FormColumns.FormColumnAlias = "Code"
        oUserObjectMD.FormColumns.FormColumnDescription = "Code"
        '&#23376;UDO
        lRetCode = oUserObjectMD.Add()
            '// check for errors in the process
        If lRetCode <> 0 Then
                SBO_Company_DI.GetLastError lRetCode, sErrMsg
                SBO_Application.StatusBar.SetText sErrMsg, bmt_Short, smt_Error
        Else
                SBO_Application.StatusBar.SetText "success", bmt_Short, smt_Success
        End If
        Set oUserObjectMD = Nothing
    End Sub
    and the error message is 'N' ,It's very stange.
    but why I can't find it in Tools -> User-defined-object -> default form ?
    anyway ,thanks a lot !
    Message was edited by: wei wang

  • Very Urgent.......How to update the database values through OAF pages ??

    Hi All,
    I am developeing some self service application thru Oracle Application Framework(OAF). There I am fetching 5 attributes from the database and displaying those attributes in my main page Table Region. Now my requirement is i want to edit that exising values & again i want to store it in the databse while clicking the update button. so first i have created one VO for fetching the values from the database & i make one Table Region in my main page along with 5 MessageTextInput field.. & i mapped that VO's attributes to my textbox.Now i can able to fetch & display the values inside the text box while rendering the page.
    But I dont know how to update the values in the database. Caz in my VO I have only select query. So anyone plz send me the code for update. And also plz let me know where to insert that code..whether (CO or AM or EO)..it is very urgent.
    Thanks
    srini

    David,
    Note that the default JavaBean datacontrol does not allow create/remove and transaction operations. These apis are not implemented for the JavaBean datacontrol.
    You may re-initialize the rowsetiterator, by calling ((oracle.adf.model.generic.DCRowSetIteratorImpl)iteratorBinding.getRowSetIterator()).clearCurrentData().
    This will force the RSI to refresh it's data via the named-accessor again.

Maybe you are looking for

  • Get all values from request.getParameter

    In ASP, I can do something like that... For each item in Request.Form Response.write "Name is:" & item & " value is:" & Request(item) Next How about in JSP? How do i get the names and values of the form using a loop?

  • Just a few quirks on Import from Elements and Keywords.

    The Import from Elements seems like a good idea but the implementation is a little 'hit and miss'. Tags in Elements (the Keywords) are not always picked up in LR. I can't work out what works and what doesn't but some Tags and the Tag Hierarchy come o

  • Snap-shot replication

    Hi Team, Last Thursday i have configured snapshot replication at that time it was showing successfully but today i have checked it was failing. below error: Replication-Replication Transaction-Log Reader Subsystem: agent trans-1 failed. The process c

  • Tryng to format Raid 1 (Mirror) array on Promise controller

    Ok, I installed the two brand-new, indentical hard drives, booted up the computer, the promise utility noticed that I had two drives plugged in with the promise controller set to RAID mode, so it ran the thing and I set the array to security (aka: Ra

  • TMS configration

    Hi expert I am sap BASIS admin last one year , I have no idead , how configre stms , we have Prodction server(prd-500) development server(dev-204) and Quality server(qty-300). How  will configre the TMS(Transport management system) , Please guide me