Skip to Content
avatar image
Former Member

Mass data run on Opportunity

Hi Experts,

My requirement is to update IdleDays Days every day Opportunity and Lead IdleDays days is KUT field.

I have followed and c4c pdf and this blog https://blogs.sap.com/2016/05/12/how-to-mass-data-run-for-update-standard-business-object/

I have created custom BO and created script file.

1)

import AP.Common.GDT as apCommonGDT;

businessobject CustomOppLead {

[AlternativeKey]element Id:ID;

element ZOppID:BusinessTransactionDocumentID;

element IdleDays1 :LANGUAGEINDEPENDENT_EXTENDED_Text;

action UpdateIdleDays;

}

2)

mport ABSL;

import AP.CRM.Global;

var indicator = true;

var isTrue = false;

var OpptQry = Opportunity.QueryByElements;

if(indicator)

isTrue = true;

//var OpptSel = OpptQry.CreateSelectionParams();

//OpptSel.Add(OpptQry.,"I","EQ",this.SubmittedBy.content);

//OpptSel.Add(OpptQry.Status.LifeCycleStatusCode,"I","EQ","4");

var OpptRes = OpptQry.Execute();

var OpprtCount = OpptRes.Count();

if (OpprtCount >= 1){

var OpenOppt_sorted = OpptRes.OrderByDescending(n=>n.ID.content);

foreach( var oppt_tab in OpenOppt_sorted){

var CurrentDateTime = Context.GetCurrentGlobalDateTime();

var changedOnDateTime = oppt_tab.SystemAdministrativeData.LastChangeDateTime;

var CurrentDate = CurrentDateTime.ConvertToDate();

var changedOnDate = changedOnDateTime.ConvertToDate();

var DateDifference = changedOnDate.Delta(CurrentDate).ConvertToDays();

this.IdleDays1 = DateDifference.ToString();

//oppt_tab.ZIdleDays.content = DateDifferenc;

//oppt_tab.ZIdleDays.unitCode = "DAY";

}

}

3) created Query.

4) created mass data run object .

5) generate screens for CustomOppLead.xbo and massdatarun.run screens enable work center and able to see view in html5

But when I have scheduling UpdateIdleDays script is calling but not executing lines of code.

1)My query is how to update opportunity kut field “ZIdleDays”

oppt_tab.ZIdleDays.content = DateDifferenc;

oppt_tab.ZIdleDays.unitCode = "DAY";

but it is not allowing because it allows only reading not write to object.

Thanks & Regards,

SRINIVAS BORRA

untitled.png (15.6 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Aug 24, 2017 at 10:19 AM

    Hello Srinivas,

    The reason, you are not able not able to update could be because you might have developed you solution in Foundation Deployment Unit while Opportunity is under CRM deployment Unit, Try to have an integration scenario defined in your current solution, so the BO's of different deployment unit can talk each other or otherwise create your solution in the same deployment unit of Opportunity. So you can edit it.

    Hope this helps.

    Thanks

    Gayathri

    Add comment
    10|10000 characters needed characters exceeded