$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: false, vro: false, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content
avatar image
Former Member

Update/Delete UDO line

Hello everybody,

I would like to know how to update or delete a specific line on a user defined object through DI API

So far I have managed to

//get the UDO
oGeneralService = oCompanyService.GetGeneralService("someUserObject");
//select a specific line from header
oGeneralParams = (SAPbobsCOM.GeneralDataParams)oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams);
oGeneralParams.SetProperty("DocEntry", 1);
oGeneralData = oGeneralService.GetByParams(oGeneralParams);
//select the lines table
oChildren = oGeneralData.Child("LinesTable");
//but when I try to get the specific line from line id I get an invalid row error
oChildren.Item(LineId).SetProperty(U_Field, "test");

//finally update our UDO,
oGeneralService.Update(oGeneralData);

If anyone could provide a correct way to go to a specific line of UDO's lines and edit/remove it I would be grateful.

Kind regards,

Dimitris Theotokatos

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jun 30, 2017 at 10:34 AM

    Hi,

    Have you been able to check this?

    UDO Update Data

    Kind regards,

    ANKIT CHAUHAN

    SAP SME Support

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Solved my issue by using record number instead of line id in

      oChildren.Item(LineId).SetProperty(U_Field, "test");

      so the correct code looks like

      oChildren.Item(line_count).SetProperty(U_Field, "test");

      Thanks a lot for your help!

  • Jun 30, 2017 at 01:03 PM

    Hi,

    See the code below, got from SDK help

    Dim oGeneralService As SAPbobsCOM.GeneralService
    Dim oGeneralParams As 
    SAPbobsCOM.GeneralDataParams
    
    Dim sCmp As SAPbobsCOM.CompanyService
    sCmp = 
    oCompany.GetCompanyService
    
    'Get a handle to the 
    SM_MOR UDO
    oGeneralService = sCmp.GetGeneralService("SM_MOR")
    
    'Delete UDO 
    record
    oGeneralParams = 
    oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams)
    oGeneralParams.SetProperty("DocEntry", "2")
    oGeneralService.Delete(oGeneralParams)
    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      In your Subject, you have asked for Update/Delete both. Therefore, the Update script was provided.

      Anyways, great to know that the issue has been solved for you!

      Kind regards,

      ANKIT CHAUHAN

      SAP SME Support