on 05-06-2016 12:13 PM
Hi Experts,
I am trying to make a custom field in customer's screen and field will be updated daily automatically with current date of the system. But I am not aware of the process how can I do this and process of mass data run so that field can be updated automatically on daily basis? .
Best Regards,
Pragati
Hi Pragati Verma and Saurabh Sharm,
I have created a document similar to your requirement explaining how to: Update standard BO with MDR.
Follow the steps mentioned in it.
Regards
Sunil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sunil,
Can you plz. help me here one more time? Actually the purpose of this type of approach regarding MDR was to send birthday notification to customers, individual customers. When I tried to make a work flow rule for e.g. when current date of system= DOB of customer send a email notification to customer. But unfortunately I can't find customer as recipient in workflow. Plz. help show should I do this? Is there any customization that can be done with workflow?
Regards,
Pragati
Hi Pragti,
I have just typed code as an example, so you can understand how to query. You should write your own logic for filtering query result. I would suggest you to read ABSL script.
Now let me explain how to this filter works, If you are aware about the filter, this below code is here in ABSL works as filter. You first define variable for selection parameter then you add all the condition(filter condition)
selParams = query.CreateSelectionParams(); // define selection parameter
selParams.Add(query.InternalID, "I", "EQ", "11012345") // here 11012345 is a customer internal ID if you execute this query with selection parameter then it will return only one customer BO instance.
So the point is to use of selection parameter to fetched required customer instance which you want to update, for example if you want to update customer who has role as Prospect then use code like below
selParams.Add(query.Role,"I","EQ", “Prospect") // please syntax after query ctrl+space
if you execute query with this parameter then it will return only customer who has role as prospect.
You can use multiple condition to get more precise result, the way I have used above.
Note: above code is just for example.
Regards
Sunil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sunil,
Like you mentioned that here 11012345 is a customer internal ID,
1) it means that our mass data run will work for only this ID? What if we want to run mass data for all of the customers existing in the system then how should I do?
2) You also mentioned here that I have to create a record in our custom BO as well. It means I have to create a custom field in that BO and then generate screens(might be QC), Right?
Plz. help!
Regards,
Pragti
Hi
Answers
1. Yes, if query with unique ID it will return only instance mean one record, that is why I mentioned you can use your own selection parameter, you can also avoid selection parameter.
Selection parameter is just like a filtering condition
for example SQL statement
Select * From table into It_table where var1 eq "some value", here you get records which match this condition.
Similarly statement selParams.Add(condition) used for filtering the BO records in ABSL.
You do one thing do not use conditon just execute it, you just write below line
query = Customer.QueryByIdentification.Execute(), it will return all customer instances.
2. Yes you have to crete an instance of custom bo to run MDR, I would suggest first complete the SDK documentation and complete the example
In document search below topic and follow the step by step document
Example: Changing the Status of a Price Request (Mass Data Run)
help.sap.com/sdk
Regards
Sunil
Hi Sunil,
Thanks a ton for all these nice explanations. I'm getting the things cleared now. Actually I'm working on functional part and very much new to trchnical part but as this requirement is very urgent and had to take the initiative so I could not read the documentation properly earlier but will surely do ASAP.
I have read the MDR creation process. Two things I am not getting:-
1) Why do we need an instance in our custom BO as we are not supposed to work on Custom BO we are doing this process for our customer BO.?
2) Now to create an instance I have created an element like this:-
import AP.Common.GDT as apCommonGDT;
businessobject BusinessObject1 {
[Label("Testing")]element Test :Date; // (if this is correct? if not then what type and how should I create a record?)
action Refresh;
}
Can you plz. help if I am doing with this code correctly or not ?
Many Thanks!
Pragati
Hi
1. You can not create MDR object for XBO, You can only create MDR on custom BO. So how will update standard BO with JOB run yes here is the workarround you can read/edit stadnard BO in custom Action so they way we are updating every standard bo instance in a loop.
Execution of MDR->find custom bo instance->execute custom action for all custom bo instance
That is why here you should have one dummy custom BO instance and action will execute for one dummy custom bo instance but in that action you will edit all stadard bo instnace.
2. Yes this is correct, you can create your custom BO as you want, create a UI, (activate BO -> right click -> create screens ->select screen scenario either OBN or Thing type, you can alos create induvidual screen)
Point to be noted : MDR should read only one instance of custom BO
Hi Sunil,
Thanks a lot. I have created screen scenario but unfortunately new button to create a new entry is not working. Can you plz. help here and correct what wrong am I doing here?
1) custom Business object
2) OWL and new button
3) New button created but not working on clicking shows nothing.
Plz. help!!
Regards,
Pragti
Hi Sunil,
Still it is not working. I am logged in wit sdk user using preview in sdk. Clicking new button doesn't work. Can you plz, check in the above screenshots I have uploaded in previous comments whether I am doing screens configuration properly? and also the screenshots below:-
OWL screen
Data model
Regards,
Saurabh
Hi Sunil and Pradeep,
Yes this is still not working.
Pradeep Kumar N Can you also plz. help here.
Regards,
Pragati
Hi
I can you have created both type of UI thing based and OBN based. I would suggest create one type UI at a time.
If you only want to create a record you can enter data from preview
In UI designer(QC or QAF)-> click on Preview Tab.
For bettre understaning to create UI on BO, please follow this video link
SAP Cloud Dev: 04 - Creating a Basic Cloud Application - YouTube
SAP Cloud Dev: 05- Creating Business Logic - YouTube
SAP Cloud Dev: 06 - Enhancing the User Interface - YouTube
Regards
Sunil
Hi Pragati,
search for "Mass Data Run" at http://help.sap.com/saphelpiis_studio_1508/studio_od_1508.pdf
Thanks, Pradeep.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Creating a MDR is one option which will definitely work for extension field, But this update will run for all customer or customer which you select in your query.
Another option you can use embedded component. create a BO with one field of type date and then create embedded component and an action
in action write logic
this.today = Context.GetCurrentSystemDate();
use this event handler of action in on fire in-port of embedded component, whenever you open Customer screen embedded component will be loaded with current date.
Regards
Sunil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sunil,
Thank you for your reply. Actually I want that date should be updated automatically daily without opening customer screenfor all customers. So MDR is the good choice for this.
But unfortunately I don't know how to do the MDR process/development. Can you please help me with the entire process? Is it possible for you to upload screenshots?
Best regards,
Pragati
Hi Pragti,
As per your requirement you want to create MDR for standard BO, which is not possible. You can only create MDR for custom BO but there is workaround to update standard BO.
First you should read the details of MDR , as pradeep suggested go through this link.
then for standard BO you should first create custom BO with query and action.
then in action you should write a logic to update customer BO. This below link has used similar use case. How to create an hourly mass data run in C4C | SCN
Let us know if you face any difficulty.
Regards
Sunil
Hi Sunil,
Thanks for replying. I have read the process of mass data run creation.
And this is what I did.
1. Created a BO with a field CurDate and action refresh
2. Created a query Overview01.qry
As mentioned by you that I should create an action (that I have already created) on that custom BO with a logic. Can you plz. help and tell me how to code this action for logic so that it can update the standard BO.
Regards,
Pragati
Hi Pragti,
1. First query you customer BO and returns required instance which you want to update, then inside the loop update the fields.
for example if you want to update customer on basis of role or status or both then write a query like below logic
import import ABSL;
import AP.FO.BusinessPartner.Global;
// Define variables
var query;
var selParams;
var queryResult;
// define query and selection parameter
query = Customer.QueryByIdentification;
selParams = query.CreateSelectionParams();
// Retrieve customer by query identification
selParams.Add(query.Role,"I","EQ", “Prospect");// Check relevant parameter for selection parameter
selParams.Add(query.Status,"I","EQ", “Active"); // there may be some other status, I given just an example
queryResult = query.Execute(selParams);
// Inside the loop you should update the field which you want to update by MDR
foreach (CustIns in queryResult) {
CustIns.Common.Person.Name.FamilyName = this.PersonFamilyName ;
CustIns.Common.ContactAllowedCode = "XYZ";}
When MDR will trigger it will trigger this logic which update the customer BO.
Regards
Sunil
Hi Sunil,
Still there is some confusion with me. Ok So what I can understand is:-
1) Create an XBO for customer BO and action this.MyCustomField=Context.GetCurrentSystemDate();
2) Now create a custom BO with some custom action like this
15. CustIns.Common.ContactAllowedCode = "XYZ";}
Here MyCustomField is an element declared in XBO and is a custom field defined in standard action beforesave that will be filled with current system date.
3) Now create an MDR that will trigger this custom action and it will update that custom field in standard BO.
Can you plz. correct this code and rectify me where am I doing wrong? which steps am I missing?
Regards,
Pragti
Hi Pragti,
This is correct, what is your dobut in below line.
custIns.CommonMyCustomField = context.GetCurentSystemDate();.
you have to create an instance of Custom BO which needs to be schedule (this instance always be picked up by query used in MDR)
MDR fetched one instance of Custom BO and execute it's action, this action query required Customer BO instance and will update as per the logic.
If you are facing any issue let us know.
Regards
Sunil
Hi Sunil,
Thanks for replying. We have now queried the customer BO. Now is there anything that we need to do before we create MDR? If yes then how can I do that with coding? Because I have confusion with the term "instance". Like how can I create the instance of Custom BO now? What is the use of creating the instance?
Plz. help!
many Regards,
Pragti
Hi Pragti,
Instance means record in Custom BO, so you have to create a record for your custom BO.
You can create it by UI, Click on OWL new button either on Quick Create or Quick Activity floorplan enter the data and save it will save one record, which you need to schedule.
Concept is : you will setup a MDR for custom BO just like changing the status price request example in document. In your case in ABSL logic you are changing Customer BO records instead of custom BO.
When MDR execute it execute for custom BO first it will search for relevant record need to change then it run the absl logic to change, in your case there will be only one record of custom bo for one record absl script will run and it will query all relevant instance of customer.
Regards
Sunil
Hi Sunil,
This is what I am trying.
1) created XBO for customer BO
2) Created an event for XBO, beforesave with a field in it
3)Then created a custom BO
4) Defined that custom action refresh as you suggested
import ABSL;
import AP.FO.BusinessPartner.Global;
import AP.FO.BusinessPartnerRelationship.Global;
import AP.CRM.Global;
import AP.Common.GDT;
import AP.Common.Global;
var queryResult;
var CustIns;
// define query and selection parameter
query = Customer.QueryByIdentification;
selParams = query.CreateSelectionParams();
// Retrieve customer by query identification
selParams.Add(query.InternalID, "I", "EQ",""); //It is not showing error here but what should I insert the value?
selParams.Add(query.Status,"I","EQ", "Active);// It is not identifying status saying identifier status doesn't exist
queryResult = query.Execute(selParams);
foreach (CustIns in queryResult) {
CustIns.Common.GetFirst().CurrDate=Context.GetCurrentSystemDate();
CustIns.Common.GetFirst().ContactAllowedCode="XYZ";
}
Now in ,
selParams.Add(query.InternalID, "I", "EQ", "") What should I mention in quotes?
selParams.Add(query.Status,"I","EQ", "Active); Shows error that identifier status doesn't exist.
I don't know why status identifier is not getting recognized. Plz. help
Regards,
Pragati
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.