What’s this blog about…of course its a client requirement…
Add an outlook calendar as an attachment to LSO correspondence requests. This applies to all correspondence requests in LSO (Book a Course, Cancel Participation, Frimly Book a Course etc)
Some general stuff before we get to the solution…
This applies to request based correspondence in LSO. T77S0 switch HRLSO/CRPSP should be switched on. Request based correspondence in LSO allows us to set up notifications to participants based on different activities that occur during booking of a course (E.g. confirm participation , firmly booking a course etc).
LSO uses SAP’s print workbench to generate correspondence requests (transaction – PWB) which are based on application forms. Here is some print workbench jargon.
Application Form: Contains the flow logic for a print program, in hierarchy form. From the application form, a print program is generated in the form of a function module. The print program contains the data procurement and the call of the relevant layout tool for the form type (SAPscript, Smart Form, or PDF-based form).
Form Class: Every application form is based on a form class that contains the data hierarchy used to create forms dynamically in application forms and is comparable to a logical database.
Collection: is a type of application form with collection of several application forms.
Composite/Composition: Use compositions if you want to structure the related COLLECTION, that is, subdivide it into logical or technical units or if the underlying application forms are always to be linked technically. You use a composition, for example, to create an e-mail with a letter and attachment.
If you care for more please refer to SAP Help
Take a note of this important configuration step. We will modify this entry at the end of this blog. This is just one of the configuration steps required to set up a custom correspondence type. There are other configuration activities that are required but they are not discussed in this blog.
As shown in the above screen shot correspondence type YUS1 (Firmly Booked) is set to use the application form YUS_LSO_FRM_PWB_TRAINING_INFOZ based on PDF form and form class LSO_PWB_TRAINING_INFO. When a training admin firmly books a course system will generate an email notification for the participants with a PDF attachment containing course details.
Lets start the actual dirty work…
Our requirement really is to spruce up this correspondence to the pariticipant to include collection of the 3 components below.
- Application form to generate PDF attachment with course details (we already have this)
- User exit to generate outlook calendar request as an attachment (requires ABAP component)
- Application form to generate the body of the email (smart form based)
…and all these components should be composed together. Below are the details on how to create this collection, composition and add these components to the composition.
1. Go to transaction code EFRM to create an application form of type “collection”. See below screen shot. Our collection name is YUS_LSO_CALENDAR_COLLECTION
2. Go to “collection” element details and specify a name for the user exit include. Double click on the include program name – this will take the navigation to the ABAP editor. Activate the include program and navigate back. Use of this include will be discussed later in this blog.
3. Our collection is ready now. Lets add a composition node to this so that we can add the required components of the correspondence. Right click on the collection node and create “composite” node YUS_LSO_COMPOSITION. See below screen shot(s).
4. Lets add the first component of the correspondence to this composition . This is an application form based on PDF form and we already have this. Select and right-click on the composition node and create application form. Add this as a child node of the composition. Specify the name of the application form and a description. See below screen shot.
5. Lets add the second component. Right click on the composition node and create a user exit. Add this as a child node to the composition. Specify a user exit form name YUS_LSO_ICAL_FORM. System will use this name to generate a SAP subroutine form.
6. Select the user exit node and click on the edit button. System will take you to the include program (specified in step 1). You will notice that system has generated an empty subroutine for you using the form name specified in step 5.
7. The required logic to generate the calendar attachment or any other additional attachments can be added in this form. Click here to find out more about how to build this form routine. The following code has been adapted from SAP help and modified as required.
8. Finally lets add the 3rd component – body of the email. Before we can add this component we need to create a new application form which is based on smart form. This application form will also use the standard form class LSO_PWB_TRAINING_INFO. Note: add the parameter PWB_DATA of type LSO_CRP_PWB_TRAINING_INFO to the smart form interface. This will provide all the training information that you need to add to the body of the email (course description, participant details etc).
9. Save and activate all the components. Go back to the configuration step “register application form for correspondence type” and update the correspondence type YUS1 to point to the newly created application form collection.
10. After completing the above steps the new correspondence for “Firmly Book a Course” should look like below. This enhancement can be extended to other training activities as well.