$(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: true, vro: true, 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

SAP C4C copy TextCollection from CustomBO

Hi everyone,

I have read a archive "https://archive.sap.com/discussions/thread/3624213"

And use its codes to copy TextCollection,I get no error but no TextCollection copy succeeded

Can anyone see my codes and give me some advises?

Look forward to your reply

Thanks in advance

	Add your SAP Business ByDesign scripting language implementation for:
		Business Object: BO_Agreement
		Node: Root
		Action: Copy 
	  - To access the elements of the business object node, 
	    use path expressions, for example, this.<element name>. 
	  - To use code completion, press CTRL+J. 

import ABSL;
import A1S.Global;
import AP.CRM.Global;
import AP.Common.GDT;
import DocumentServices.Global;
//var iteminfo: elementsof BO_Agreement.ItemInfo;
    //Search copy data
	var query = BO_Agreement.QueryByElements;
	var selparameter = query.CreateSelectionParams();
	var copyagreement = query.Execute(selparameter);
	foreach(var oldagreement in copyagreement)
       //Copy basic info
	   this.AgreementType = oldagreement.AgreementType;
	   this.CloseDate = oldagreement.CloseDate;
	   this.StartDate = oldagreement.StartDate;
	   this.DistributorID = oldagreement.DistributorID;
	   this.DistributorType = oldagreement.DistributorType;
	   this.TartgetAmount = oldagreement.TartgetAmount;
	   this.MinimumCommitment = oldagreement.MinimumCommitment;
	   this.Q1 = oldagreement.Q1;
	   this.Q2 = oldagreement.Q2;
	   this.Q3 = oldagreement.Q3;
	   this.Q4 = oldagreement.Q4;
	   //Copy ItemInfo
	   foreach (var ItemInfo in oldagreement.ItemInfo)
	    var ItemInfoCreate = this.ItemInfo.Create();
		ItemInfoCreate.ProductLine = ItemInfo.ProductLine;
		ItemInfoCreate.ProductGroup = ItemInfo.ProductGroup;
		ItemInfoCreate.ProductSeries = ItemInfo.ProductSeries;
		ItemInfoCreate.TargetYear =  ItemInfo.TargetYear;
		ItemInfoCreate.Region = ItemInfo.Region;
		ItemInfoCreate.Regiontext = ItemInfo.Regiontext;
		ItemInfoCreate.TotalAmount = ItemInfo.TotalAmount;
		ItemInfoCreate.TotalQuantity = ItemInfo.TotalQuantity;
		ItemInfoCreate.JanQuantity = ItemInfo.JanQuantity;
		ItemInfoCreate.FebQuantity = ItemInfo.FebQuantity;
		ItemInfoCreate.MarQuantity = ItemInfo.MarQuantity;
		ItemInfoCreate.AprQuantity = ItemInfo.AprQuantity;
		ItemInfoCreate.MayQuantity = ItemInfo.MayQuantity;
		ItemInfoCreate.JunQuantity = ItemInfo.JunQuantity;
		ItemInfoCreate.JulQuantity = ItemInfo.JulQuantity;
		ItemInfoCreate.AugQuantity = ItemInfo.AugQuantity;
		ItemInfoCreate.SepQuantity = ItemInfo.SepQuantity;
		ItemInfoCreate.OctQuantity = ItemInfo.OctQuantity;
		ItemInfoCreate.NovQuantity = ItemInfo.NovQuantity;
		ItemInfoCreate.DecQuantity = ItemInfo.DecQuantity;
	   //Copy TextCollection
	   var newtextcollection = this.TextCollection.Create();
	   foreach (var oldtext in oldagreement.TextCollection.Text)
	      var newtext = newtextcollection.Text.Create();
          var txtcontent = newtext.TextContent.Create();
          txtcontent.Text = oldtext.TextContent.Text; 
	      //this.TextCollection.Text.Create().TextContent.Create().Text = oldtext.TextContent.Text;
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jun 28, 2017 at 01:42 PM

    Hello Benny,

    Did you ensure that the query found some hits?

    Did you debugged the code?

    . Horst

    Add comment
    10|10000 characters needed characters exceeded