Program to create URL in Attachment Block of Opportunity in CRM WEB UI
In this document, I’ll explain the way to create a URL directly in the Attachment Block of any Opportunity using a Custom Program, without going to the Web UI.
This can be really helpful in case there is a requirement to automatically attach a unique URL for each opportunity after Create/Change operation.
For illustration, here I have created a Program to create the URL, but you can also put the code in a FM & call the same during/after the save or as per the business requirement.
Below is the small piece of code which will solve our purpose.
PARAMETERS : p_opp_id TYPE crmt_object_id, ” Opportunity ID
DATA : lv_opp_guid TYPE crmt_object_guid,
CHECK p_url IS NOT INITIAL AND p_opp_id IS NOT INITIAL.
wa_prop-name = ‘CONTENT_URL’.
wa_prop-name = ‘LANGUAGE’.
wa_prop-name = ‘DESCRIPTION’.
The above program calls the Static Method CREATE_URL of Global Class CL_CRM_DOCUMENTS and the logic is pretty straight forward & simple.
If I execute the above program with below inputs :
The URL will be directly added in the Attachment block of opportunity like below:
You can use the same program for Activities/ Business Partners or any other CRM object, you just need to pass the corresponding Business Object (BO) Type & the respective GUID in the method parameter “BUSINESS_OBJECT”. (for Eg. BUS1006 for Business Partner / BUS2000126 for Activity)
I hope this will be helpful for you. Please add comments if you need any further help or inputs.
Really helpful post Bharat...