ABAP Classes in Workflow
- Sap Abap For
- How To Call Workflow From Abap Program Sap Modules
- Abap Call Https
- Abap Submit And Return
- Sap Abap Program Examples
Q35) List the various advantages of SAP Business Workflow. Workflow provides numerous advantages to SAP users and consultants: 2. It allows consultants to create new business processes without modifying the standard SAP code. Workflow ensures that the tasks are executed in the correct sequential order, involving the relevant personnel. To use ABAP classes on Workflows, it is necessary to implement Interface IFWORKFLOW in ABAP class. This interface includes method that creates specific prerequisites such that the object can be used within the SAP WebFlow Engine. Interface IFWORKFLOW contains the following methods − BIPERSISTENTFINDBYLPOR; BIPERSISTENTREFRESH. Nov 20, 2007 Although it's possible to call a task directly, e.g. Using standard workflow API functions such as SAPWAPISTARTWORKFLOW, that's not usually the best way to tackle this very common scenario. In general, we call a task by raising an event which then use to trigger the task. So the next blog will be on using ABAP OO events as workflow events. Above ABAP program will list all element-value pairs stored in the workflow container content. ABAP codes to list Workflow container data as key-value pairs If you work on a specific workflow task, it is possible that you already know the element names of the ABAP workflow container data. How to Trigger Workflow from Web Dynpro ABAP. How to Trigger Workflow from Web Dynpro ABAP – Part 1 SAP. Place the cursor on method and click on Program.
15.Why IF_WORKFLOW Interface?
The IF_WORKFLOW interface is necessary when using an ABAP class within the SAP WebFlow Engine. The interface contains methods that allow the object to be used within the SAP WebFlow Engine.
The SAP WebFlow Engine handles all objects generically. Objects have to be saved in the event of a context change. Therefore, it is necessary to convert object references in such a way that they can be saved persistently. Conversely, we have to be able to generate the corresponding instance of an ABAP class from the persistently saved key.
There are also a number of SAP WebFlow Engine components, for example, the Workflow Log that can display objects. In this case the object has to provide corresponding functions.
The IF_WORKFLOW interface puts a logical parenthesis round the BI_PERSISTENT(instance management) and BI_OBJECT (object behavior) interfaces. The IF_WORKFLOWinterface contains the following methods:
ØBI_PERSISTENT~FIND_BY_LPOR
ØBI_PERSISTENT~LPOR
ØBI_PERSISTENT~REFRESH
ØBI_OBJECT~DEFAULT_ATTRIBUTE_VALUE
ØBI_OBJECT~EXECUTE_DEFAULT_METHOD
ØBI_OBJECT~RELEASE
A class that implements the IF_WORKFLOW interface can be used in any workflow. The class is automatically released for use in workflows when the interface is implemented. Therefore, we can only make compatible changes to a class after implementation (we cannot delete attributes, change types or delete methods). There is no where-used list to show which workflows the class is used in.
Internal classes of an application should not implement the IF_WORKFLOW interface, since this could mean that each method of the class is used in the workflow. Therefore, we should encapsulate the workflow functions in another class that calls the selected methods of the internal class.
Each method of the IF_WORKFLOW Interface as mentioned earlier has its distinct functionality, which is discussed below.
Sap Abap For
16.BI_PERSISTENT~FIND_BY_LPOR Method:
If we want to convert a persistent saved display of an object into an instance of the corresponding ABAP class, SAP Webflow Engine calls the BI_PERSISTENT~FIND_BY_LPOR method.
Features:
The method parameter LPOR is the persistent object reference and is of SIBFLPOR structure type. A reference of BI_PERSISTENT type is returned.
The following table shows the components of the SIBFLPOR structure:
Field | Description |
CATID | Describes the object type ( CL for ABAP classes) |
TYPEID | ABAP class name |
INSTID | Object key. The key is limited to 32 characters. |
We can implement this method in several ways. In the case of persistent classes we can create the ABAP object instance using the generated classes. In the case of individual persistence management we have to implement the individual actions (such as creating an instance, performing an existence check, entering public attributes, and so on) manually within the class.
Instance management takes place automatically in the case of persistent classes. In the case of individual persistence management we also have to carry out instance management by class. The SAP WebFlow Engine does not provide any instance management. We must therefore implement our own instance management in the case of individual persistence management.
The FIND_BY_LPOR method should always return the same instance if the following problems are to be avoided:
- Inconsistency in the data display
- Instance data being overwritten by another instance
- Locking conflicts
There is an implementation example in the CL_SWF_FORMABSENC demo class.
17.BI_PERSISTENT~LPOR Method:
The BI_PERSISTENT~LPOR method is the counterpart to the BI_PERSISTENT~FIND_BY_LPOR method. It provides the persistent display for an existing instance of an ABAP object.
Features:
The method returns the persistent display of an object reference as a SIBFLPOR type structure as described earlier.
There is a close relationship between the BI_PERSISTENT~FIND_BY_LPOR method and the BI_PERSISTENT~LPOR method. If we call the BI_PERSISTENT~FIND_BY_LPOR method first and then the BI_PERSISTENT~LPOR method, the BI_PERSISTENT~LPOR method must return the same value as was previously used to call the BI_PERSISTENT~FIND_BY_LPOR method.
There are also several ways of implementing this method in this case. There is an implementation example in the CL_SWF_FORMABSENC demo class.
18.BI_PERSISTENT~REFRESH Method:
How To Call Workflow From Abap Program Sap Modules
SAP WebFlow Engine calls the BI_PERSISTENT~REFRESH method when the system has to ensure that all values of an object are valid or that they agree exactly with the persistent display of the object.
Features:
The method implementation depends on the internal organization of the class. We can check the object instance data in the database, if necessary.
Abap Call Https
If we do not need the method in our class, then we need only to carry out a “dummy” implementation (without further coding) to avoid program errors when the system calls the method.
There is an implementation example in the CL_SWF_FORMABSENC demo class.
Here is an SAP Smartforms step by step example to open and call Smartform within ABAP code.
Within ABAP programs an SAP Smartform can be called and opened by calling the ABAP function SSF_FUNCTION_MODULE_NAME, we will see in the example ABAP code which is included with this Smartforms tutorial.
Within ABAP programs an SAP Smartform can be called and opened by calling the ABAP function SSF_FUNCTION_MODULE_NAME, we will see in the example ABAP code which is included with this Smartforms tutorial.
First, create a SAP Smartform report using ABAP transaction code 'smartforms' within ABAP Editor.
Or you can use an existing simple SAP Smartforms report to call from the example ABAP program.
Or you can use an existing simple SAP Smartforms report to call from the example ABAP program.
In this SAP SmartForms tutorial, the example uses a SmartForm named 'ZSMARTFORMS_SALES_DOCUMENTS'.
The SmartForm application 'ZSMARTFORMS_SALES_DOCUMENTS' takes a table valued parameter to use as an internal table within SmartForms ABAP codes.
This SmartForms parameter table is 'it_vbak' which is declared in type table of VBAK SAP Sales and Distribution table.
SAP VBAK table is contains Sales Document header data.
As you will see in the below ABAP codes, the program select a range of VBAK Sales Document records into an internal table variable it_vbak.
Later the variable table is passed to the SAP SmartForm as a TABLE argument.
The SmartForm application 'ZSMARTFORMS_SALES_DOCUMENTS' takes a table valued parameter to use as an internal table within SmartForms ABAP codes.
This SmartForms parameter table is 'it_vbak' which is declared in type table of VBAK SAP Sales and Distribution table.
SAP VBAK table is contains Sales Document header data.
As you will see in the below ABAP codes, the program select a range of VBAK Sales Document records into an internal table variable it_vbak.
Later the variable table is passed to the SAP SmartForm as a TABLE argument.
It is important that the table variable is correctly declared within the Smartform 's 'Global Settings > Form Interface > Tables' section.
As you will see in the below screenshot, it_vbak is declared as :
IT_VBAK TYPE VBAK
As you will see in the below screenshot, it_vbak is declared as :
IT_VBAK TYPE VBAK
Abap Submit And Return
Example ABAP Program to Call Smartform
Here is the example ABAP code to call SAP SmarForms from a program or an ABAP report.
Please note that we have ABAP codes which call ABAP function SSF_FUNCTION_MODULE_NAME with formname parameter is set to the target SAP Smartforms document.
The SSF_FUNCTION_MODULE_NAME ABAP call returns the FM_NAME which is the compiled ABAP program identifier and is in type rs38l_fnam.
The returned fm_name variable is then called using an ABAP Call Function method to open Smartform.
While calling Smartform, the Table parameter is passed as an input argument.
Please note that we have ABAP codes which call ABAP function SSF_FUNCTION_MODULE_NAME with formname parameter is set to the target SAP Smartforms document.
The SSF_FUNCTION_MODULE_NAME ABAP call returns the FM_NAME which is the compiled ABAP program identifier and is in type rs38l_fnam.
The returned fm_name variable is then called using an ABAP Call Function method to open Smartform.
While calling Smartform, the Table parameter is passed as an input argument.
I hope, SAP Smartforms developers will find this sample ABAP code useful as beginning to SAP Smartforms.