Displaying table in Work Flow decision step
Using HTML Codes
Author – Srivijay K Dinnimath
Date – 5th Feb 2015
Overview:
This documentation to know how to use HTML Codes to display table in Workflow decision step.
User decision step in SAP-Workflow supports HTML tags, but we can't display the whole table with multiple entries while creating text for user decision step. As a solution for this, we can include HTML tags along with the DB entries fetched in the BOR Object's method itself and pass/bind it to work flow's user decision step.
Pre – requisites:
Before we start to create a table with HTML tags, we must have an idea of Business object repository (BOR) and SAP Business Workflows.
Business Object Repository (BOR):
The Business Object Repository (BOR) is the object-oriented repository in the R/3 System. It contains the SAP business object types and SAP interface types as well as their components, such as methods, attributes and events.
BAPIs are defined as methods of SAP business object types (or SAP interface types) in the BOR. Thus defined, the BAPIs become standard with full stability guarantees as regards their content and interface.
SAP Business Workflow:
SAP Business Workflow can be used to define business processes that are not yet mapped in the R/3 System. These may be simple release or approval procedures, or more complex business processes such as creating a material master and the associated coordination of the departments involved. SAP Business Workflow is particularly suitable for situations in which work processes have to be run through repeatedly, or situations in which the business process requires the involvement of a large number of agents in a specific sequence.
Process Logic:
2. Defining Method parameters:
3. Method code:
BEGIN_METHOD ZTEST_HTML CHANGING CONTAINER.
DATA: PURCHASEREQUISITION TYPE EBAN-BANFN,
OUTPUT_TBLE LIKE W3HTML OCCURS 0,
WA_OUTPUT TYPE W3HTML.
TYPES: BEGIN OF TY_EBAN,
BANFN TYPE BANFN,
BNFPO TYPE BNFPO,
BSART TYPE BBSRT,
END OF TY_EBAN.
DATA: LT_EBAN TYPE TABLE OF TY_EBAN,
WA_EBAN TYPE TY_EBAN.
CLEAR: LT_EBAN[].
SWC_GET_ELEMENT CONTAINER 'PurchaseRequisition' PURCHASEREQUISITION.
* SWC_GET_TABLE CONTAINER 'output_tble' OUTPUT_TBLE.
SELECT BANFN BNFPO BSART FROM EBAN
INTO TABLE LT_EBAN
WHERE BANFN = PURCHASEREQUISITION.
IF SY-SUBRC = 0.
WA_OUTPUT-LINE = '<HTML><BODY><TABLE BORDER="2" ><TR><TH>PR Number</TH><TH>Item Number</TH>'.
APPEND WA_OUTPUT TO OUTPUT_TBLE.
CLEAR: WA_OUTPUT.
wa_output-line = '<TH>Document Type</TH></TR>'.
APPEND WA_OUTPUT TO OUTPUT_TBLE.
CLEAR: WA_OUTPUT.
IF LT_EBAN[] IS NOT INITIAL.
LOOP AT LT_EBAN INTO WA_EBAN.
CONCATENATE '<TR><TD>' WA_EBAN-BANFN '</TD><TD>' WA_EBAN-BNFPO '</TD><TD>' WA_EBAN-BSART '</TD></TR>' INTO WA_OUTPUT-LINE.
APPEND WA_OUTPUT TO OUTPUT_TBLE.
CLEAR: WA_OUTPUT, WA_EBAN.
ENDLOOP.
ENDIF.
wa_output-line = '</TABLE></BODY></HTML>'.
APPEND WA_OUTPUT TO OUTPUT_TBLE.
CLEAR: WA_OUTPUT.
ENDIF.
SWC_SET_ELEMENT CONTAINER 'PurchaseRequisition' PURCHASEREQUISITION.
SWC_SET_TABLE CONTAINER 'output_tble' OUTPUT_TBLE.
END_METHOD.
4. Generating the Method and BOR Object:
5. After generating the BOR Object we need to create a Work flow.
Create a work flow with Activity, User decision, Send mail and process control steps.
6. Create an activity step,
7. Double click on newly created task (TS99100445 in above case) and call the method ZTEST_HTML of ZBUS007 created,
8. Bind the variables of method to Work flow,
9. Create a user decision step with decision texts Approve/Reject and define the user,
10. Define the Agent assignment,
11. Bind the variables of Decision step with Work flow variables,
12. Double click on task TS99100446 to maintain description for the decision task,
13. Click on the Change text to maintain your custom text,
Note: Text with HTML tags should be maintained as Comment line (i.e. with /*).
14. Create a send mail step to send a mail on approval,
15. Create a process control step to stop the Work flow on reject,
16. Execute the work flow by passing the input parameter i.e. PR number,
17. Go to transaction code SBWP - business workplace you will find a work item in your inbox with table of HTML tags,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |