PPF Implementation Guide
PPF Implementation Guide
Contact Persons:
PPF
Contents:
1 2 PPF Overview ............................................................................................................................... 4 Preparation ................................................................................................................................... 5
2.1 Necessary Classes .............................................................................................................................. 5
The implementation steps are explained using the example of a demo application. The demo application and all mentioned classes are available in all systems (transaction SPPFDEMO, development class SPPF_DEMO). ......... 5 2.1.1 Application Class ........................................................................................................................................ 5 2.1.2 Application-Specific Processing ................................................................................................................. 9
2.2
Customizing ..................................................................................................................................... 15
Define New Application ........................................................................................................................... 15 Defining the Action Profile ....................................................................................................................... 16 Define Action Definitions for the Action Profile ...................................................................................... 17 Details for the Action Definition .............................................................................................................. 18 Assignment of Processing Types for an Action Definition ....................................................................... 20 Determination (Condition Configuration) ................................................................................................. 23 Action Merging ......................................................................................................................................... 28
2.3
2.3.1 2.3.2
3.3
3.3.1 3.3.2
3.4
3.4.1 3.4.2
4 5
The BADI has the application names as the filter value. The action is also transferred and can deliver its processing status (successful, with error) or other information........................................... 39
5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.10 5.1.11 5.1.12 Exit for Context Extension (CONTEXT_EXTEND_PPF) ....................................................................... 39 Exit for Completion of Processing Options (COMPLETE_PROC_PPF) ................................................. 40 Extend Container for Condition Evaluation (CONTAINER_PPF)........................................................... 40 Exit for Execution of Actions (EXEC_METHODCALL_PPF) ............................................................... 40 Exit for Getting Possible Partner Functions of an Application (GET_PARTN_ROLES_PPF )............... 41 Exit for Double Clicking on Values in the Display (GRID_CLICK_PPF) ............................................... 41 Exit for Checking if Deletion of Action Profile is allowed (CONTEXT_DELETE_PPF) ....................... 41 Exit for evaluation of schedule conditions (EVAL_SCHEDCOND_PPF) ............................................... 41 Exit for evaluation of start conditions (EVAL_STARTCOND_PPF) ...................................................... 41 Exit for Adding further data to workflow container (WF_CONT_MODIFY_PPF) ................................. 41 Connection of Your Own Processing Options .......................................................................................... 42 Connection of a Logic for the Determination ........................................................................................... 42
5.2
5.2.1 5.2.2
Page
PPF
5.2.3
Appendix ..................................................................................................................................... 44
6.1 6.2 Description of Interfaces ................................................................................................................ 44
CL_MANAGER_PPF............................................................................................................................... 44 Customizing Classes ................................................................................................................................. 47 Runtime Classes ........................................................................................................................................ 48 Service Classes ......................................................................................................................................... 49 Calling the PPF ......................................................................................................................................... 50 Method DETERMINE Part 1 .................................................................................................................... 51 Method DETERMINE Part 2 .................................................................................................................... 52 6.1.1 6.2.1 6.2.2 6.2.3
6.3
Page
PPF
1 PPF Overview
The Post Processing Framework (PPF) is a tool for the generic execution of functions and processes. It provides the applications with a uniform interface to any actions. Actions can be outputs in the traditional sense such as print, fax, mail, or XML but functions such as the triggering of workflows or any method call can also be triggered. Which actions this eventually are, is determined by an individually configurable or a self-programmable determination technology, depending on the application document data. Execution of the action can also take place depending on the data of the application document. Therefore, the PPF automatically generates actions from document data (for example, delivery notes or order confirmations, generation of an item in the document, creation of a subsequent document). PPF additionally provides uniform action administration. There is status management and a processing log for every action. The PPF itself was programmed with ABAP objects. In addition, various object services were used. However, you do not have to program your PPF application in an object-oriented manner to use the PPF. Overview graphic:
Application Object
Framework
Processing Logic
Page
PPF
2 Preparation
2.1 Necessary Classes
Create the following classes in the Class Builder: A persistent class (in the sense of Object Services) that represents the application object (for example: CL_BOOK_PPF) A partner class that represents a partner of an application object (for example: CL_BOOK_PARTNER_PPF) A context class that encapsulates all information for the PPF (Example: CL_DEMO_CONTEXT_PPF) A processing class provided Smart Forms are used (Example: CL_PROCESSING_DEMOBOOK_PPF) A BADI implementation provided the processing method call is used Workflow template provided a workflow is to be triggered
The implementation steps are explained using the example of a demo application. The demo application and all mentioned classes are available in all systems (transaction SPPFDEMO, development class SPPF_DEMO).
The classes to be implemented by the application are shaded in gray in the following graphics. All other classes are provided by the PPF.
Page
PPF
IF_LOCK_PPF
IF_TIME_CONTEXT_PPF
IF_BOR_OBJECT_PPF
+ENQUEUE() +DEQUEUE()
+GET_TIME_CONTEXT()
+GET_BOR_OBJECT()
implements
application class CL_BOOK_PPF -ID : CHAR10 +IF_LOCK_PPF~ENQUEUE() +IF_LOCK_PPF~DEQUEUE() +IF_TIME_CONTEXT_PPF~GET_TIME_CONTEXT() +IF_BOR_OBJECT_PPF~GET_BOR_OBJECT()
* create a persistent application object via the class agent of its co-class * object services create 2 service classes for any persistent class ca class contains all persistency services, e.g. creation of persistent object create application object, key (book_id) must be set before appl_object ?=
Partner class Create a partner class for the document partner that implements the interface IF_PARTNER_PPF. The document partners are collected in a collection and transferred to the PPF. The class of the partner collection already exists. A partner consists of a partner function, partner number, and the data assigned from the central address management (CAM: ZAV Zentrale Adressverwaltung in German): Person number, address number, and address type. This data must be made available for every document partner by the application. The PPF determines the relevant communication data for fax processing or mail processing using the address numbers transferred.
Page
PPF
CL_PARTNER_COLL_PPF
Belegpartner
IF_PARTNER_PPF
+ADD_ELEMENT()
+GET_ZAV_ADDRESS() +GET_PARTNER()
implements
partner class
CL_BOOK_PARTNER_PPF -PARTNER_NO : PPFDPARTNO -PARTNER_ROLE : PPFDPARTRL -ZAV_ADDRESSNO : AD_ADDRNUM -ZAV_PERSNO : AD_ADDRNUM -ZAV_ADDR_TYPE : PPFDADRTYP -PARTNER_TEXT : TEXT60 +IF_PARTNER_PPF~GET_ZAV_ADDRESS() +IF_PARTNER_PPF~GET_PARTNER()
* create first partner object CREATE OBJECT partner EXPORTING ip_partner_role ip_partner_no ip_partner_text = 'LF' = '1234567890' = 'Vendor Meyer'
ip_zav_addr_type = '3'.
Context class The context class encapsulates all the application data necessary for the PPF: Application name Reference to the application object (instance of the application class or proxy object)
Page
PPF
Reference to a partner collection Further application attributes (fields that can be included as sort fields in the management table of actions)
Note when creating the context class that this is not marked as final. The customer should potentially have the possibility to extend this using further attributes. This is only possible provided the class has not been marked as final. The context class redefines the method GET_VALUE_OF_ATTRIBUTE of class CL_CONTEXT_PPF. This serves dynamic attribute accesses that are not yet supported in the ABAP standard. For the redefinition, simply copy the coding from the template and set it again in the method. This step is necessary so that the method is executed for your action profile class itself and can access its attributes.
CL_CONTEXT_PPF NAME APPL APPLCTN PARTNER PPFDCNTXT REF TO OBJECT PPFDAPPL REF TO CL_PARTNER_COLL_PPF
CL_PARTNER_COLL_PPF
+ADD_ELEMENT()
GET_VALUE_OF_ATTRIBUTE
inherits from CL_DEMO_CONTEXT_PPF -NAME : PPFDCNTXT -APPL : REF TO OBJECT -APPLCTN : APPLDAPPL -PARTNER : REF CL_PARTNER_COLL_PPF -ID : CHAR14 -PAGECOUNT : NUM4 -STATUS : PPFDDSTAT -CREATOR : SYUNAME +GET_VALUE_OF_ATTRIBUTE() : REF TO
context class
* set context attribute context->applctn = 'BOOK'. context->name context->appl = 'BOOK'. = appl_object. Declared in Customizing (see chapter 2.2) Declared in Customizing (see chapter 2.2)
context->partner = partner_coll.
Page
PPF
* additional context fields *.these fields can be used as sort fields for a later processing of the actions * the fields can be overtaken into the database table for actions (PPFTTRIGG) context->ID = 1234. context->creator = sy-uname. ....
CL_SF_PROCESSING_PPF
+EXEC_SMART_FORM()
inherits from
+EXEC_SMART_FORM() +PROCESS_SMART_FORM()
Page
PPF
dummy(254)
TYPE c.
* get the function name for this smart form CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING formname * * VARIANT DIRECT_CALL IMPORTING fm_name EXCEPTIONS no_form = 1 = function_name = ip_smart_form = ' ' = ' '
no_function_module = 2 OTHERS . IF sy-subrc <> 0. * add an error message to processing protocol MESSAGE i015(sppf_media) WITH ip_smart_form. CALL METHOD cl_log_ppf=>add_message EXPORTING ip_problemclass = '1' ip_handle EXIT. ENDIF. = cp_application_log. = 3
*------------------- get application specific data---------------------DATA: lo_book TYPE REF TO cl_book_ppf, ls_book TYPE ppftbook. ... * cast imported object so that we can refer to its attributes lo_book ?= io_appl_object.
* get key fields of application object ls_book-id = lo_book->get_id( ). ls_book-author = lo_book->get_author( ). ls_book-title = lo_book->get_title( ). ls_book-pagecount = lo_book->get_pagecount( ). ls_book-creator = lo_book->get_creator( ). ls_book-datecreate = lo_book->get_datecreate( ). ls_book-datechange = lo_book->get_datechange( ). ls_book-status = lo_book->get_status( ). ls_book-isbn = lo_book->get_isbn( ). *-----------------------------------------------------------------------
Page
10
PPF
* fill this parameter if your application object is a BOR object * the output (smart form) will be linked with the BOR object * is_mail_appl_obj-LOGSYS * is_mail_appl_obj-OBJTYPE * is_mail_appl_obj-OBJKEY * is_mail_appl_obj-DESCRIBE = = = =
*-----------------------------------------------------------------------
*-----------fill archive parameters for archive link ------------------IF is_output_options-tdarmod = '2' OR is_output_options-tdarmod = '3'. * archive_index_tab READ TABLE ct_archive_index_tab INTO ls_archive_index INDEX 1. * * * * just fill the id of your actual BOR object ------> ls_archive_index-object_id ------> IF ls_archive_index-object_id IS INITIAL. DELETE ct_archive_index_tab INDEX 1. ELSE. MODIFY ct_archive_index_tab FROM ls_archive_index INDEX 1. ENDIF. ENDIF. *----------------------------------------------------------------------= 'ID_OF_YOUR_BOR_OBJECT'.
*-----------language of smart form-------------------------------------* determine here the language of the smart form and set it * default language is the system language * is_control_parameters-langu = language_of_my_smart_form. *-----------------------------------------------------------------------
* call function to process smart form CALL FUNCTION function_name EXPORTING archive_index archive_parameters control_parameters mail_appl_obj mail_recipient mail_sender output_options user_settings = is_archive_index = is_archive_parameters = is_control_parameters = is_mail_appl_obj = is_mail_recipient = is_mail_sender = is_output_options = ip_user_settings
*-----------------------------------------------------------------------
Page
11
PPF
IMPORTING document_output_info = es_document_output_info job_output_info job_output_options EXCEPTIONS output_canceled parameter_error OTHERS . = 1 = 2 = 3 = es_job_output_info = es_job_output_options
IF sy-subrc <> 0. * add an error message to processing protocol CASE sy-subrc. WHEN 1. MESSAGE e016(sppf_media). ... ENDCASE. CALL METHOD cl_log_ppf=>add_message EXPORTING ip_problemclass = '1' ip_handle ENDIF. = cp_application_log.
ENDMETHOD.
The return parameter is evaluated centrally using the PPF. You can add your own entries to the processing log and should also do this so that the application specific processing routines are also logged. A handle on the application log is transferred for this as the parameter: ip_application_log. Entries can simply be made using the interface of the service class CL_LOG_PPF: Example:
MESSAGE i015(sppf_media) WITH ip_smart_form. CALL METHOD cl_log_ppf=>add_message EXPORTING ip_problemclass = '1' ip_handle = ip_application_log.
Page
12
PPF
2.1.2.2 Usage of Processing Method Call The method calls are created using BADI implementations. The relevant BADI definition (transaction SE18) is called EXEC_METHODCALL_PPF. You can create an implementation for this definition (transaction SE19). The interface looks as follows:
FLT_VAL IO_APPL_OBJECT IO_PARTNER Importing Importing Importing Type Type Ref To Type Ref To Type Type Type Ref To Type Type PPFDFLTVAL OBJECT CL_PARTNER_PPF BALLOGHNDL CHAR1 IF_SWJ_PPF_CONTAINER PPFDTT PPFDTSTAT Parameter FLT_VAL of method EXECUTE Reference to application object Message partner Handle on application log Preview flag Container with parameter values Name of action definition PPF: Output status
IP_APPLICATION_LOG Importing IP_PREVIEW II_CONTAINER IP_ACTION RP_STATUS Importing Importing Importing Returning
The filter value is created when the BADI implementation is created and is therefore freely definable. A description for the filter value should also be entered. For processing, you receive a reference to its application object and hence have access to the document data. In addition, the document partner, a reference to an application log (processing log), and a container with parameters are transferred. The parameter values can be determined in Customizing. After processing, the processing status must be set correspondingly (processed successfully = 1, processed with errors = 2). If the status is not explicitly set, the PPF sets the status to processed with errors = 2. In the BADI-Builder (transaction SE19), this can appear as follows:
Page
13
PPF
2.1.2.3 Use of the Processing Workflow No application specific coding is needed here. 2.1.2.4 Use of the Processing of External Sending The processing of external sending, like Smart Forms, also needs an application-specific logic for data retrieval and for calling the Smart Form. Creation no longer takes place using a method implementation, but rather using a BADI implementation. The BADI is called DOC_PERSONALIZE_BCS. The interface is very similar to the method for Smart Forms processing:
FLT_VAL IS_ARCHIVE_PARAMETERS IS_CONTROL_PARAMETERS IS_OUTPUT_OPTIONS IO_APPL_OBJECT IP_SMART_FORM IS_MAIL_APPL_OBJ IS_MAIL_RECIPIENT IS_MAIL_SENDER IP_USER_SETTINGS IP_APPLICATION_LOG IO_PERSONALIZE_DATA Importing Importing Importing Importing Importing Importing Importing Importing Importing Importing Importing Importing Type Type Type Type Type Ref To Type Type Type Type Type Type Type Ref To Type Type Type Type Type Type BCSDFLTVAL ARC_PARAMS SSFCTRLOP SSFCOMPOP OBJECT TDSFNAME SWOTOBJID SWOTOBJID SWOTOBJID TDBOOL BALLOGHNDL BCS: Filter value for BADI DOC_PERSONALIZE_BCS ImageLink structure Smart Forms: Control structure SAP Smart Forms: Options smart composer (transfer) Application object Smart Forms: Form name Structure for object ID Structure for object ID Structure for object ID Selection field (yes or no) Application log: Log handle
CL_PERSONALIZE_DATA_BCS Service class for the personalization of a mail SSFCRESPD SSFCRESCL SSFCRESOP TSFERROR TSFDARA TDTITLE Smart Forms: Return of document information Smart Forms: Return when form printing is completed Smart Forms: Return when starting form printing SAP Smart Forms: Runtime error SAP Smart Forms: Table with archive indices Document title
ES_DOCUMENT_OUTPUT_INFO Exporting ES_JOB_OUTPUT_INFO ES_JOB_OUTPUT_OPTIONS ET_ERROR_TAB CT_ARCHIVE_INDEX_TAB C_DOCUMENT_TITLE Exporting Exporting Exporting Changing Changing
The logic for calling the Smart Forms is the same as the processing above, for an example, see the implementation BCS_PROC (transaction SE19).
Page
14
PPF
2.2 Customizing
In Customizing (transaction SPPFC) you make your classes known to the PPF and define the determination of the outputs: You assign the possible action definitions (for example, delivery note, order acknowledgment, and so on) to your application. You must define a determination technology for each output type (see section Determination and Merging of Actions). The definition in Customizing only determines the framework, that is, all potential actions and their possible processing options are declared. This definition can be used in an additional Customizing step to define conditions (see 2.3 onwards). The actions only appear when the conditions have been maintained. Definition in Customizing alone does not lead to the generation of actions. Transaction SPPFC should never be added to the IMG directly. It can be called in a separate application specific transaction when the parameter is set for the application.
Application name
Description
Page
15
PPF
Description
Name of the context class Actions from this composite profile are also available
Page
16
PPF
Description
Deactivate action
Page
17
PPF
Page
18
PPF
Settings in detail
The search help for the partner function field can only deliver values if the application creates and delivers a BAdI implementation for GET_PARTN_ROLES_PPF. Here you can use the example implementation for the demo application (GET_ROLES_BOOK_PPF) to get more information.
Page
19
PPF
Page
20
PPF
2.2.5.2 Method Call Processing This processing enables the execution of any action. A BAdI implementation is called. This enables the creation of a subsequent document or the creation of an item in the document, for example. The method can be entered using the F4 help. All active BAdI implementations for BAdI definition EXEC_METHODCALL_PPF are displayed there. The processing parameters are freely definable and can be provided with values. Static values are used here. The values can be changed again in the configuration of conditions. Example: Create method subsequent offer, processing parameter: Type of subsequent offer
Make sure that the implementation was activated, otherwise it is not displayed in the F4 Help.
2.2.5.3 Workflow Processing Workflow templates can also be started using actions. The workflow template is added to it. The business object must be defined as an input parameter in the container definition of the workflow template. The name of the parameter must be BUSINESSOBJECT. Using Display/Change, the assigned workflow template can be edited and a new workflow template can be created using the Create button. The F4 help for the assignment only displays the workflow templates that support the assigned business object in the action profile.
2.2.5.4 External Sending Processing The processing of external sending can take the place of the existing Smart Forms processing. It completely covers its functions and additionally makes it possible to send an attachment, send the outputs to copy recipients and in further releases it is also possible to send SMSs. The Customizing settings are similar to the Smart Forms processing options. The name of a Smart Form is added, a format logic (as implementation of BAdI DOC_PERSONALIZE_BCS) and as the optimization parameter the type of document personalization can be specified. In recipient-dependent personalization, the formatting of the document takes place for every recipient, since recipient-dependent data is to be replaced. When personalization is not recipient dependent (an identical text or mail to all recipients), document formatting only takes place once for all recipients.
Page
21
PPF
When sending a fax, you have the option of sending a fax cover page. The name of the cover page (Smart Form) is entered here. The format is fixed. FAX_COVER_PAGE_BCS must always be entered.
Optical archiving is possible. The object type and the document type must be added in the same way as with Smart Forms.
Page
22
PPF
CL_CONDITION
0..1
CL_TRIGGER_TEMPLATE
As standard, a general tool for condition evaluation is used. In Message Control condition technology was used for this purpose. Currently, the PPF offers the workflow condition editor and a self-developed determination technology with generated coding conditions as tools. The determination technology with generated coding conditions should no longer be used. It will not be developed any further. Instead, the workflow conditions should be used. The workflow conditions can also be transported, but the coding conditions cannot. In release 6.30 there is a new condition logic available. These conditions are similar to the generated coding conditions, however they are realized by BAdI implementations and thus they are also transportable.
Page
23
PPF
2.3.1.1
For Basis Release 6.10, the workflow condition editor replaces the old PPF determination technology. The condition editor provides a graphical user interface and a transport connection. Thus, the applications can preconfigure conditions (for example, document complete, example configurations) and deliver them to the customers. To ensure good performance, there should be generated workflow conditions. The user interface is similar to PPF condition evaluation. The condition tool is simply a different one.
The conditions and settings can be transported and can thus be delivered.
Page
24
PPF
The parameter BOOK_DAMAGED is checked. If the book is damaged, the condition is fulfilled and the relevant action is scheduled. The user interface for merging the conditions is the workflow condition editor. Here the conditions are simply brought together using the mouse. All attributes of the business object (here PPF demo object) and further parameters (here: BOOK_DAMAGED) are available.
Page
25
PPF
2.3.1.2 PPF Determination Technology (Determination Using Conditions) This condition logic should not be used any more. Use either the workflow conditions or for special scenarios the BadI conditions.
Conditions for the action definition Action profile and action definitions
The action profile of the application and the relevant action definitions are displayed in the top left-hand screen area above. The conditions that were assigned to the action definitions appear right of this in the list. The overview displays a number, the description of the condition, the assigned action (here: 2 expressions), the stop flag, and a check symbol that displays whether the condition definition is consistent. The stop flag means that once the condition has been met, further conditions are ignored. There are 2 types of conditions: Conditions with an action and process conditions. Conditions with an action are always assigned one action as a result. The process conditions do not have action templates. They have a controlling character. The other conditions are only evaluated if the process condition returns FALSE as the return value. An action template (bottom right) can be assigned multiple processing options. If an invoice is to be sent by post, for example and also printed out, simply assign the mail and fax as the processing here and perform
Page
26
PPF
the corresponding settings. If the condition is fulfilled, an action template with 2 processing options is returned. The runtime system creates 2 separate actions from this. The current conditions are created by an administrator in the production system since they are generally based on application data that is only known in the productive system. A transport of conditions and thus a preconfiguration provided by SAP is not possible with this tool.
Page
27
PPF
Page
28
PPF
Get an instance of class CL_MANAGER_PPF. This class displays the interface for PPF. All service methods are called by it.
* get an instance of PPF manager manager = cl_manager_ppf=>get_instance( ).
Generate the application object and set the key fields so that the application object can be found or generated again. If the application object is a BOR object then its ID is set here. In our case, we set the key fields of table PPFTBOOK so as to be able to access the entry later.
* create application object CLASS ca_book_ppf DEFINITION LOAD.
appl_object ?=
Page
29
PPF
Generate a partner collection that can include several partner objects. The partner collection represents the document partner
* create partner collection CREATE OBJECT partner_coll.
Generate a partner object and append it to the collection. You perform this step for every document partner.
* create first partner object CREATE OBJECT partner EXPORTING ip_partner_role ip_partner_no ip_partner_text = 'LF' = '1234567890' = 'Lieferant Meier'
ip_zav_addr_type = '3'.
* create another partner object CREATE OBJECT partner EXPORTING ip_partner_role ip_partner_no ip_partner_text = 'WE' = '0987654321' = 'Ship-to party Smith'
ip_zav_addr_type = '3'.
The action profile object that encapsulates all information for the PPF. The name of the application and the action profile that were defined in Customizing are transferred. The reference to the application is transferred and also the partner collection. In addition, the application-specific fields are set for the action profile that are relevant for determination. Conditions for an action are defined in these fields.
* set context attribute context->applctn = 'BOOK'. context->name context->appl = 'BOOK'. = appl_object.
context->partner = partner_coll.
Page
30
PPF
Determination is started. As a return value, the application receives a determination log that displays how many actions were found and why some actions were found. The determination log is not persistently stored by the PPF itself. It is always created dynamically at runtime.
* start PPF CALL METHOD manager->determine EXPORTING io_context = context
COMMIT WORK The PPF uses the persistence services of Object Services. These services run after a COMMIT WORK, that is, a COMMIT WORK must take place at the end so that the generated actions can be written to the database.
Page
31
PPF
This processing time is defined in action type Customizing and can be overridden in the configuration of conditions.
Page
32
PPF
The user interface displays the existing actions and their status for a document. Newly found actions are also displayed. A determination log documents in detail which actions have been found this time.
Page
33
PPF
Additional functions: Actions can be added manually There is a processing log for every processed action The processing can be repeated (if allowed)
Page
34
PPF
Unprocessed actions can be deleted (if allowed) Unprocessed actions can be processed (if allowed) Settings can be overridden (printer, e-mail address, fax number, processing time, action processing, and so on) A describing text of the action can be displayed Scheduling of actions from a generated worklist
Action service A BOR object is needed to connect the GOS toolbar with the action service. The BOR object must implement the BOR Interface IFGOSPPF (see TA SWO1). The interface defines 2 methods that are needed: GET_MODE read mode (change or display mode) GET_CONTEXTS read action profile The service is contacted in Generic Object Services using the name PPFACTION. This name must be transferred for the toolbar constructor. For more information on the Generic Object Services, read the corresponding online documentation.
Page
35
PPF
Page
36
PPF
time
create
determine CL_MANAGER_PPF
create
determine CL_MANAGER_PPF
Page
37
PPF
All applications are displayed and there are links to the action definition, the condition configuration, and the Wizard. You can also correct possible inconsistencies.
Page
38
PPF
5 Extendibility
5.1 Business Application Add Ins (BAdIs)
The PPF provides various BADIs that permit manipulation at defined times. There are currently 12 BADIs:
The printer is generally returned by the determination with the template for the action. The determination returns an action template with action processing. A printer can be entered in action processing. It is often the case that a specific printer is to be used due to the application data. In this way, for example, the printer can be determined depending on the sales organization. At definition time of the action template, the sales organization is naturally unknown. For this reason, the following BADI is called provided the template or the determination does not return a printer. The BADI has the name of the action type as a filter value. As a further import parameter the implementing class has a reference to the actions profile object and thus access to all document data. A printer can now be found and returned using the document data. Example implementation: PRINTER_DET_SUSR_PPF (transaction SE19) The example implementation reads the master data of the current user and returns the printer maintained there.
This BADI is called after the action is completed, that is, after the action is processed. As a result, the action can perform subsequent actions. If processing is incorrect (that is, there were errors with the processing of the action) a routine or transaction can be executed for error handling, for example.
The BADI has the application names as the filter value. The action is also transferred and can deliver its processing status (successful, with error) or other information.
Take care of the performance. An implementation of this BadI will be called after the execution of any action within the application, as the application serves as filter value here. A better option might be to listen to the executed event of CL_TRIGGER_PPF.
The BADI is used for potential extensions of the action profile class by the customers. If the attributes defined in the action profile of the application are not sufficient for the customers determination, then he or she can extend the application using action profile class using inheritance. The additional attributes must be
Page
39
PPF
provided with values. This BADI is used for this. The implementations are created for each trigger type. The application should deliver example implementations.
The BAdI is called after the action determination has taken place and before the created action is checked. Here additional data might be set for the processing of the action. The following methods are available depending on the type of processing:
COMPLETE_MAIL COMPLETE_FAX COMPLETE_PRINT COMPLETE_METHOD COMPLETE_WORKFLOW COMPLETE_SEND COMPLETE_ALERT Completes Mail Processing Completes Fax Processing Completes Print Processing Completes BADI Processing Completes Workflow Processing Completes Transmission Processing Completes Alert Processing
The BAdI is called whenever a condition for the given BOR object type has to be evaluated. The CI_CONTAINER contains the BOR object and the CI_PARAMETER the uses parameters. Additional objects or parameters might be added to the container for condition evaluation. An implementation will only work for buiness object repository (BOR) objects and not for class objects. As the filter is only the business object type, the BAdI will be called whenever this object type is used in a workflow condition. This BAdI should be only used after consulting PPF development.
Returning Type
Page
40
PPF
The BAdI is a standard exit for enhancing business logic with dynamic processing. Via the implementation PPF can trigger arbitrary business logic. After implementing the BAdI can be assigned in PPF customizing as methodcall processing. Internal development is encouraged to use this processing type for generic processing. Customers may also use this feature for customer specific processing.
5.1.7 Exit for Getting Possible Partner Functions of an Application (GET_PARTN_ROLES_PPF ) 5.1.8 Exit for Double Clicking on Values in the Display (GRID_CLICK_PPF) 5.1.9 Exit for Checking if Deletion of Action Profile is allowed (CONTEXT_DELETE_PPF) 5.1.10 Exit for evaluation of schedule conditions (EVAL_SCHEDCOND_PPF) 5.1.11 Exit for evaluation of start conditions (EVAL_STARTCOND_PPF) 5.1.12 Exit for Adding further data to workflow container (WF_CONT_MODIFY_PPF)
Page
41
PPF
The actual determination method receives a reference to an actions profile object as the import parameter, the action type, and a handle to a determination log that the condition is to fill. Using this information, the determination returns one or multiple action templates.
Interface methods: GET_PERSISTENCY_TABLE Delivers a table in which the persistent data is stored for the determination object. The information is necessary for the merging of the transport request in Customizing. MERGE
Page
42
PPF
The merge method is called after determination to merge newly found actions with possible existing actions using determination.
IO_NEW_TRIGGER_COLL IO_OLD_TRIGGER_COLL IP_DETLOG RO_TRIGGER_COLL Importing Importing Importing Returning Type Ref To Type Ref To Type Type Ref To CL_TRIGGER_COLL_PPF CL_TRIGGER_COLL_PPF BALLOGHNDL CL_TRIGGER_COLL_PPF Newly found actions Existing actions Log handle Merged actions
MERGE_SINGLE The method MERGE_SINGLE is called after the manual generation of an action (see User Interface section) to merge this with possible existing actions.
IO_NEW_TRIGGER IO_OLD_TRIGGER_COLL RO_TRIGGER_COLL Importing Importing Returning Type Ref To Type Ref To Type Ref To CL_TRIGGER_PPF CL_TRIGGER_COLL_PPF CL_TRIGGER_COLL_PPF New action Existing actions Mixed proposals
Page
43
PPF
6 Appendix
6.1 Description of Interfaces
6.1.1 CL_MANAGER_PPF
The class CL_MANAGER_PPF serves as a central interface (API) for PPF. The following methods (services) are offered: GET_INSTANCE (Static Method) Parameter: None Effect: Delivers an instance of the class (singleton) ADD_TRIGGER (Instance Method) Parameter: IO_CONTEXT CO_TRIGGER Effect: Adds a new action for the action profile supplied REPEAT_TRIGGER (Instance Method) Parameter: IO_CONTEXT IO_TRIGGER RO_TRIGGER Effect: Repeats processing of the action transferred DELETE_TRIGGER (Instance Method) Parameter: IO_CONTEXT Importing IO_TRIGGER Importing Effect: Deletes the unprocessed action transferred DELETE_ALL_TRIGGERS (Instance Method) Parameter: IO_CONTEXT Importing IO_FORCE Effect: Deletes the actions of the transferred action profile. The method should be called when the document is called. GET_TTYPES (Instance Method) Parameter: IO_CONTEXT Importing RO_TTYPES Returning Type Ref To Type Ref To CL_CONTEXT_PPF CL_TTYPE_COLL_PPF Action profile Action types of the action profile Importing Type Ref To Type CL_CONTEXT_PPF BOOLE_D Action profile Without checks Type Ref To Type Ref To CL_CONTEXT_PPF CL_TRIGGER_PPF Action profile Action Importing Type Ref To Importing Type Ref To Returning Type Ref To CL_CONTEXT_PPF CL_TRIGGER_PPF CL_TRIGGER_PPF Action profile Action to be repeated Repeated action Importing Changing Type Ref To Type Ref To CL_CONTEXT_PPF CL_TRIGGER_PPF Action profile Action
Page
44
PPF
Effect: Delivers the action types for the action profile transferred GET_TRIGGERS (Instance Method) Parameter: IO_CONTEXT Effect: Delivers all possible actions for the action profile CREATE_TRIGGER (Instance Method) Parameter: IP_TTYPE_NAME Importing IO_CONTEXT RO_TRIGGER Effect: Generates an action of the transferred type for this action profile DETERMINE (Instance Method) Parameter: IO_CONTEXT EP_PROTOCOL Effect: Starts the determination for the action profile transferred and returns the determination log SET_APPLKEY (Instance Method) Parameter: IP_APPLKEY IO_CONTEXT Effect: Sets the field APPLKEY in all actions of the action profile with which the system can later search and sort by REFRESH (Instance Method) Parameter: None Effect: All data of the PPF manager is lost Resets the PPF manager, allocated memory is released LOCK_TRIGGERS (Instance Method) Parameter: IO_CONTEXT Effect: Locks the triggers of this action profile for processing, recommended for incomplete documents UNLOCK_TRIGGERS (Instance Method) Parameter: IO_CONTEXT Importing Type Ref To CL_CONTEXT_PPF Action profile Importing Type Ref To CL_CONTEXT_PPF Action profile Importing Importing Type Type Ref To PPFDAPPKEY CL_CONTEXT_PPF Application key Action profile Importing Exporting Type Ref To Type CL_CONTEXT_PPF BALLOGHNDL Action profile Determination log Importing Returning Type Type Ref To Type Ref To PPFDTT CL_CONTEXT_PPF CL_TRIGGER_PPF Action definition Action profile Action Importing Type Ref To Type Ref To CL_CONTEXT_PPF CL_TRIGGER_COLL_PPF Action profile Actions for action profile RO_TRIGGERS Returning
Page
45
PPF
Effect: Unlocks triggers of this action profile for processing Events: DETERMINATION_DONE CHANGED REFRESHED GRID_CHANGED Attribute: LOCALE_UPDATE Boolean variable default = 'X' The effect of the attribute is that actions that are to be processed when the document is saved are processed synchronously. If the flag is set to SPACE, processing takes place asynchronously using RFC. Determination was performed Changes were performed Manager was reset Changes in the interface were made
Page
46
PPF
Logische Ansicht
CL_TTYPE_CUST_PPF IF_DETERMINATION_PPF -NAME : PPFDTT -DESCRIPTION : PPFDTTT -CHANGEABLE : PPFDCHNG -MULTIPLE_ISSUING : PPFDMULTP -PARTNER_INDEP : PPFDNOPART -PARTNER_ROLE : PPFDPARTRL -DISPATCH_TIME : PPFDDSPTCH -DEACTIVATED : PPFDTTIACT -MEDIUM_COLL : CL_MEDIUM_CUST_COLL_PPF -DETERMINATION : IF_DETERMINATION_PPF -MERGE : IF_MERGE_PPF +GET_PARTNER_INDEP() +CONSTRUCTOR() +SET_DATA_FROM_DB() +GET_ALL_DATA() +SET_MEDIUM_COLL() +GET_MEDIUM_COLL() +GET_DISPATCH_TIME() +GET_DEFAULT_MEDIUM() CL_CONTEXT_DEF_PPF -NAME : PPFDCNTXT -DESCRIPTION : PPFDCNTXTT -CLASS : PPFDCLASS
+GET_PERSISTENCY_TABLE() +DETERMINE()
triggerTypeList
IF_MERGE_PPF
contextList
CL_MEDIUM_GENERIC_CUST_PPF -CONFIG1 : PPFDGENFLD -CONFIG2 : PPFDGENFLD -CONFIG3 : PPFDGENFLD -PROCCLS : SEOCLSNAME -PROCMETH : SEOCMPNAME IF_MEDIUM_CUST_PPF applicationList +GET_PERSISTENCY_TABLE() +GET_MEDIUM() +GET_MEDIUM_TEMPLATE()
CL_CUST_MANAGER_PPF CL_SF_PRINT_CUST_PPF -ARCHVMODE : SYARMOD -PRINTPARAM : PPFDPRTPRM -PROCCLS : SEOCLSNAME -PROCMETH : SEOCMPNAME -SMARTFORM : TDSFNAME CL_SF_FAX_CUST_PPF -ARCHVMODE : SYARMOD -PROCCLS : SEOCLSNAME -PROCMETH : SEOCMPNAME -SMARTFORM : TDSFNAME CL_SF_MAIL_CUST_PPF -PROCCLS : SEOCLSNAME -PROCMETH : SEOCMPNAME -SMARTFORM : TDSFNAME -UNIQUE_INSTANCE : ref to cl_ppf_customizing_manag +GET_INSTANCE() : +GET_MEDIUM() : +GET_TTYPE_CUST() +GET_TTYPE_COLL() +GET_MEDIUM_COLL()
Page
47
PPF
manager CL_MANAGER_PPF - singleton -CONTEXT_MANAGERS : CL_CONTEXT_MANAGER_COL +REPEAT_TRIGGER() +DELETE_TRIGGER() +CONSTRUCTOR() +GET_TTYPES() +GET_TRIGGERS() +CREATE_TRIGGER() +DETERMINE() +ADD_TRIGGER() +GET_INSTANCE() IF_MEDIUM_PPF
contextList
CL_APPLICATION
processing protocol
CL_TTYPE_PPF
newTrigger List
CL_PARTNER_PPF -PARTNNO : PPFDPARTNO -PARTNROLE : PPFDPARTRL -PARTNTEXT : PPFDPARTTX -PARTNTY : PPFDPARTTY -ZAVADDR : AD_ADDRNUM -ZAVPERS : AD_ADDRNUM -ZAVTYPE : PPFDADRTYP -ZAVCOMMNO : AD_CONSNUM
-NAME : PPFDTT -DETERMINATION : IF_DETERMINATION_PPF -MERGE : IF_MERGE_PPF -NEW_TRIGGER_LIST : CL_TRIGGER_COLL_PPF -CURRENT_TRIGGER_LIST : CL_TRIGGER_COLL_PPF -MEDIUM_LIST : CL_MEDIUM_CUST_COLL_PPF -CONTEXT : IF_CONTEXT_PPF -TTYPE_CUSTOMIZING : CL_TTYPE_CUST_PPF +GET_TRIGGERS() +GET_TTYPE_CUSTOMIZING() +CHECK_TRIGGER() +CREATE_TRIGGER() +CONSTRUCTOR() +ADD_TRIGGER() +DETERMINE() +DELETE_TRIGGER() +REPEAT_TRIGGER() determination protocol
CL_TRIGGER_PPF
CL_PROTOCOL_FIND_PPF
-APPL : Object -APPLCTN : PPFDAPPL -APPLKEY : SYSUUID_C -CONTEXT : PPFDCNTXT -DISPATCH : PPFDDSPTCH -IS_CHANGED : PPFDTTCHNG -IS_INACTIV : PPFDIACT -IS_LOCKED : PPFDTLOCK -IS_REPEAT : PPFDTRPT CL_SF_PRINT_PPF CL_SF_FAX_PPF CL_SF_MAIL_PPF CL_MEDIUM_GENERIC_PPF -MEDIUM : IF_MEDIUM_PPF -STATUS : PPFDTSTAT -TIMECHANGE : PPFDTCHNGD -TIMECREATE : PPFDTCREAT -TTYPE : PPFDTT -USERCHANGE : PPFDUCHNGD calls processing -USERCREATE : PPFDUCREAT method of this class calls processing +CREATE_TRIGGER_FROM_CUST() calls processing method of this +CREATE_TRIGGER_FROM_TEMPLATE() method of this class +CREATE_TRIGGER() class +DELETE_TRIGGER() +COPY() +EXECUTE() +REPEAT() +PREVIEW() inherits CL_PROCESSING_DEMOBOOK_PPF CL_SF_PROCESSING_PPF from
+CHECK() +MEDIUM_CHANGED() +COPY() +EXECUTE() +PREVIEW() +IS_EQUAL() +LANGUAGE_IS_EQUAL() +COMPLETE() +PARTNER_IS_EQUAL() +GET_PARTNER() +GET_PROCESSING_LOG() +SET_PARTNER() +GET_TYPE()
CL_PROTOCOL_PROC_PPF
IF_MEDIUM_CUST_PPF
Page
48
PPF
The super class CL_CONTEXT_PPF encapsulates all necessary data for the action determination. Any application using PPF has to define a class which inherits from CL_CONTEXT_PPF and extends it with further attributes which can be used as sort fields for later processing of the action. A reference to this class will be transmitted to the PPF framework in order to determine the appreciate actions.
CL_CONTEXT_PPF +NAME : PPFDCNTXT +APPL : REF TO OBJECT +APPLCTN : PPFDAPPL +PARTNER : REF TO CL_PARTNER_COLL_PPF GET_VALUE_OF_ATTRIBUTE
+GET_ZAV_ADDRESS() +GET_PARTNER()
implements CL_BOOK_PARTNER_PPF -PARTNER_NO : PPFDPARTNO -PARTNER_ROLE : PPFDPARTRL -PARTNER_TYPE : PPFDPARTTY -ZAV_ADDRESSNO : AD_ADDRNUM -ZAV_PERSNO : AD_ADDRNUM -ZAV_ADDR_TYPE : PPFDADRTYP -PARTNER_TEXT : TEXT60 +IF_PARTNER_PPF~GET_ZAV_ADDRESS() +IF_PARTNER_PPF~GET_PARTNER()
CL_DEMO_CONTEXT_PPF -NAME : PPFDCNTXT -APPL : REF TO OBJECT -APPLCTN : PPFDAPPL -PARTNER : REF CL_PARTNER_COLL_PPF -ID : CHAR10 -PAGECOUNT : NUM4 -STATUS : PPFDDSTAT -CREATOR : SYUNAME +GET_VALUE_OF_ATTRIBUTE() :
REF TO
the PPF demo application for example defines the following context class
REF TO
CL_BOOK_PPF -ID : CHAR10 +TITLE : TEXT60 +AUTHOR : TEXT60 -... : +IF_LOCK_PPF~ENQUEUE() +IF_LOCK_PPF~DEQUEUE()
implements
IF_LOCK_PPF
+ENQUEUE() +DEQUEUE()
Page
49
PPF
This sequence diagram describes the call of methods and objects a user-defined program has to provide to use and start PPF.
user-defined program
/ IF_OS_TRANS ACTION
:CL_MANAGE R_PPF
get_instance() :CL_MANAGER_PPF get reference to persistent application object, eg via get_persistent_*, create_persistent_*, etc. (name of he application class is needed probably) create Implementing class has to be userdefined Why is this object created by the user? Could be provided as Singleton (or static class) and managed by IF_CONTEXT_PPF
'application object'
/ IF_PARTNER_ PPF
determine( :CL_MANAGER_PPF ) determination see further sequence diagram end() end of transaction
COMMIT WORK
Page
50
PPF
main program
:CL_MANAGE R_PPF
determine (:IF_CONTEXT_PPF)
:CL_CUST_MA NAGER_PPF
:CL_TTYPE_C UST_COLL_PP F
:CL_TTYPE_C OLL_PPF
:CL_TTYPE_C UST_PPF
get_context_manager (:IF_CONTEXT_PPF)
:CL_CONTEXT _MANAGER_P PF get_ttype_coll(application_name, context_name) :CL_TTYPE_CUST_COLL_PPF [all elements] get_next_element() :CL_TTYPE_CUST_PPF [all elements] create(:CL_TTYPE_CUST_PPF, :IF_CONTEXT_PPF) CL_TTYPE_PP F get_all_data() PPFSTTCUAT get_instance() :CL_TRIGGER_SELECTOR_PPF select_by_context_appl_type(:OBJECT, context?, ttype?, status) current_trigger_list:CL_TRIGGER_COLL_P PF [current_trigger_list is initial] create current_trigger_ list:CL_TRIGG ER_COLL_PPF new_trigger_list :CL_TRIGGER _COLL_PPF
create
:CL_CONTEXT_MANAGER_PPF
The second part of the DETERMINE scenario just shows the handling after or without explicit trigger creation
Page
51
PPF
main program
:CL_CONTEXT _MANAGER_P PF
class CL_OS_SYST EM
/ IF_OS_TRANS ACTION
:CL_TTYPE_C OLL_PPF
:CL_TTYPE_P PF
/ IF_DETERMIN ATION_PPF
/ IF_MERGE_PP F
get_transaction_manager() :CL_OS_TRANSACTION_MAN AGER register on event 'FINISHED' which is raised by IF_OS_TRANSACTI ON (needed to start activities after 'COMMIT WORK') get_current_transaction() /IF_OS_TRANSACTION set handler 'on_finished'
[all elements] get_next_element() :CL_TTYPE_PPF [all elements and :CL_TTYPE_PPF active] determine() determine(:IF_CONTEXT_PPF, ttype) :CL_TRIGGER_TEMPL_COLL_PPF clear()
get_all_data() PPFSTTCUAT [all elements] get_next_element() :CL_TRIGGER_TEMPL_PPF Probably this part has to be described in more detail, eg how to build up the new_trigger_list merge( new_trigger_list:CL_TRIGGER_COLL_PPF, current_trigger_list:CL_TRIGGER_COLL_PPF) current_trigger_list:CL_TRIGGER_COLL_PPF
Page
52