|
Blogs
This gives you a good flexibility to meet individual business needs by creating specific Notes Forms for each Decision Workflow step. Depending on how generic the Notes Form is, you can also re-use it in different Workflow Applications. A good example for this is the default approval Form "(ERPApprovalWorkflow)" which shows some attributes of the Workflow Step as well as the Task description long-text.
An even more generic approach is shown in this blog (see picture above). The assumption is that you want to expose Decision Workflows to Lotus Notes that consist of Header attributes and optionally a grid with Line Items. An example for this could be the above mentioned Purchase Order, a Sales Order, an incoming Invoice, or any other business object that falls into this structure. The trick is that the Notes Form only has place holders for the mentioned attributes. Via an easy protocol we pack all attributes we want to send to the client with the help of an ABAP outbound handler into a generic Header and Item field. These attributes are unpacked during runtime by the Notes Form and displayed accordingly. There is no need to change the Notes Form if you want to add or remove fields from/to the header or item grid. The only development work you need to do is to create an outbound handler (function module) that reads the business object(s) from the workflow and packs it into the generic fields. The generic Notes Form remains the same and does not need to be changed.
Let's take the already mentioned Purchase Order example and show how this generic approach works. The current blog explains what you need to do on the SAP side. Please see Dirk Lehmann's blog for handling the Notes/Domino side. If you need general information on how to expose a Decision Workflow to Alloy, please read this blog first. Starting point is an existing workflow template with a decision step that gets triggered when a new Purchase Order is being created (or released). Via the regular "Workflow Pattern Customizing" in the "Information Worker Implementation Guide" you subscribe yourself to this decision step of your workflow template. In the "Workflow" node of the Workflow Pattern Customizing you also add a custom outbound handler (in this example Z_S_OSP_WF_PO1_CH_OB) that is being called prior to the default outbound handler S_OSP_WF_PAT_DEFAULT_CH_OB (the order is important!). The custom outbound handler has to have the same interface as the default outbound handler. A good suggestion is to copy the default handler and to remove the copied coding (instead of creating the interface from scratch).
The interesting part takes place inside the custom outbound handler. As mentioned above we pack the header and item information of the underlying business object(s) into 2 dedicated fields via an easy protocol. This easy protocol works as follows: Header attributes are inserted as concatenated Label-Value pairs. Separator between the Label and the Value is a semicolon. Separator between such Label-Value pairs is a colon. The name of the header attribute is WF_HEADER. The syntax looks as follows:
WF_HEADER = <Label1>;<Value1>:<Label2>;<Value2>:<Label3>;<Value3>:...: Example: WF_HEADER = "Purchasing Document;4500000396:Created by;DREES:Created on;14.09.2009:Vendor;HT_500-High Tech Supplier:Purchasing Doc. Type;NB:Purchasing Group;001:"
You can of course use different separator characters - in that case you just need to adjust the coding on the ABAP and on the Notes/Domino side accordingly. The item information works similar - with the difference that you only provide the column Labels once and not again for each line. Therefore the generic item field WF_ITEMS lists at first all column labels, and then the line items one by one:
WF_ITEMS = <Label1>;<Label2>;<Label3>;<Label4>;...: Example: WF_ITEMS = "Item;Material;Short Text;PO Quantity;Net price;Net order value:00010;HT_001-1;Office Calendar;4 EA;10,00 USD;40,00 USD:00020;HT_001-2;Note pad with hard cover;8 EA;12,00 USD;96,00 USD:00030;HT_001-3;Laser Printer Paper 1000 sheet;12 KG;16,00 USD;192,00 USD:"
As you can see in the example strings for header and item, all data (labels and values) are already prepared in a ready-to-display format. The advantage of this is that the client does not need to care about data type handling. Disadvantage might be that this is not a clear separation of business logic and visualization - but I guess it's a good compromise. For the language of the labels and the number/date/currency formatting, the backend language of the recipient is taken (read via module BAPI_USER_GET_DETAIL). Field labels are read in our sample coding from the ABAP Data Dictionary (via modules DDIF_NAMETAB_GET and DDIF_DTEL_GET). Before the header and item attributes can be packed into the 2 generic fields, the Workflow at first needs to be queried for the related Business Objects. This happens via the Workflow API SAP_WAPI_GET_OBJECTS. In the resulting list we filter on BUS2012 as this is the BOR Object type for Purchase Orders and this is what we expect here. Finally module BAPI_PO_GETDETAIL is used to retrieve all attributes from the Purchase Order. And here you can find the sample custom outbound handler that does all this: As mentioned above, please check Dirk Lehmann's blog for the necessary development on Notes/Domino side. Volker Drees is currently working as a Regional Group Expert for Alloy (formerly known as "Atlantic") and Duet in the Information Worker Division. He began his SAP career in 1998 in the consulting department. |