How to call standard webservice in ABSL script
Example scenario:
Creating Target Group and adding members to it via calling webservice “Manage Target Groups” via WSID in ABSL script.
- Download the .WSDL file of the service “Manage Target Groups”
a. Log in to the Application UI, and navigate to the Administrator WoC
b. Select “Communication Arrangements“, and create/select the Communication arrangement on the communication scenario “Manage Target Groups”
c. Select “Technical Data” tab:
d. Select “Edit Advanced Settings” button to download the WSDL file into the local system
- Login to SAP Cloud Applications Studio(SDK)
- Create/Open a solution
- Create an External Webservice Integration(WSID) selecting Communication Scenario and upload the downloaded WSDL file
- In the Communication Scenario (CSD), select the outbound service:
- Create Communication Arrangement on the above Communication Scenario:
Note: Make sure the Path is filled
- Create a custom BO:Ex:
import AP.Common.GDT as apCommonGDT;businessobject TestTG1 {[Label(“Target Group Desc”)] element TGDesc: MEDIUM_Description;
node members [0,n]
{
[Label(“Customer”)] element CustID: ID;
[Label(“Contact”)] element ContactID: ID;
[Label(“Employee”)] element EmpID : ID;
}
}
- Create an ABSL script to call the Manage Target Groups webservice via WSID:Ex: BeforeSave on Root
import ABSL;import AP.FO.BusinessPartner.Global;import AP.CRM.Global;
import AP.Common.GDT;
var tgSrvReq : TargetGroup1.MaintainBundle.Request;
var tgSrvReqItem : TargetGroup1.MaintainBundle.Request.TargetGroupBundleMaintainRequest_sync.TargetGroup;
var tgSrvReqMember: TargetGroup1.MaintainBundle.Request.TargetGroupBundleMaintainRequest_sync.TargetGroup.Member;
tgSrvReqItem.Description = this.TGDesc.content;
//This is for Target Group Create
tgSrvReqItem.actionCode = “01”;
//…Handle Update case also
foreach ( var itm in this.members)
{
var Cust = Customer.Retrieve(itm.CustID);
tgSrvReqMember.CustomerUUID = Cust.UUID;
tgSrvReqItem.Member.Add(tgSrvReqMember);
//…
//Handle Contact ID to UUID conversion also
//Handle Employee ID to UUID conversion also
}
tgSrvReq.TargetGroupBundleMaintainRequest_sync.TargetGroup.Add(tgSrvReqItem);
var response = Library::TargetGroup1.MaintainBundle(tgSrvReq,“”,“TargetGroup1”);
- Create UI on the Custom BO to input valuesThanks, Pradeep.
Hi Pradeep,
Thanks for sharing this. We have a similar requirement to create invoice schedule on creation of outbound delivery. I tried using the 'Managesalesorder' webservice for this in the 'Release' event of Outbound delivery. But that doesn't seem to allow creation of invoice schedule for the Sales Order.
Can you help me with it?
Thanks,
Neenu
Hi Pradeep,
At 6, I can't "Check Connection", it raise as below:
The "Service URL", it has some character which I feel unnecessary.
Could you help me with it? Thanks a lot.
Best Regards,
Benny Huang
Hi Pradeep,
I got the reason, it need to create a communication system in the system, now it is ok.
Thanks.
Benny
Hi Pradeep,
Because the URL is fixed, now I need to trans the program to production, how to change the URL to production URL?
Or which step I need to when trans?
thanks a lot.
Benny Huang