In the standard SAP PR approval process, when an employee creates a Purchase Requisition, the approver gets the PR as a work item in his SAP Inbox. When the approver opens the PR approval workitem, he’s directed to the PR release window for that particular PR (transaction ME54n). Now, he n either releases or rejects the PR. This requieres the Approver to have access to a desktop or laptop where he can access the SAP system.
The Blackberry Application for PR approval is aimed at mobilising the PR approval process where the approver can release or reject a PR on the move using his Blackberry device.
Setting up Release Strategy
The Purchase Requisition Release strategy with the necessary release groups, release codes, agents and the release conditions and the workflow settings for PR approval have to be maintained in the backend system.
BAPIs Used for PR approval process on Blackberry:
To get the worklist for a particular user.
This is used to get all the work items for the particular user which needs the user’s response.
To get the objects related to any workitem. Used to filter the workitems obtained for a user based on the Business Object.
To get the details of the PR item/s.
To release the overall PR.
The PR number and the Release code are passed to the BAPI to release the overall PR.
To release a particular item of the PR.
The PR Number, Item number and the Release code are passed to the BAPI to release a particular Item of the PR.
To mark the workitem as “Complete”.
Apart from the Standard BAPIs mentioned, few custom BAPIs have to be created as the Standard BAPIs are not available for these functions.
To get the release code for a particular user and a particular release group.
The release group for the particular PR is obtained by using the BAPI_Requisition_Getdetail and the above BAPI is called with the userid and the release group to get the corresponding Release Code.
To Reject a particular item of a PR.
To Reject the overall PR.
i. Creating a project in Webdynpro, importing models, Model Binding and Context mapping.
Create a webdynpro project in NWDS and switch to Webdynpro perspective and create an application for the project with the authentication property “true” and choose to create a new component. Create a model choosing “Import Adaptive RFC Model” and select all the BAPIs mentioned above.
For any help on WebDynpro Java and for steps to create a webdynpro Java Adaptive RFC application, please refer the following document from SAP Library.
Once you have completed the above step and created an application and the model, follow the following steps to develop the Blackberry PR release application.
1. Open the data modeler, choose “Add Existing Model to the component” and select the model created in the previous step.
2. Do a model binding between the component controller and the model. Select all the input model elements into the component controller.
3. Create Views in the component for
a) Worklist Display Screen
b) PR Detail screen
4. Create Value nodes in Component controller.
Value node – “UserDetails” with UserID, Password, UserName as attributes.
Value node -“PRs” with PR number, Item, Requisitioner, Release Group as attributes. (Cardinality – 0…n).
Value node – PRItemDetails with relevant PR item details as attributes.
5. Map the relevant nodes from the context of the component controller with the context of the view controllers.
WorklistDisplay Screen – Map the node – PRs
PRDetail View – Map the nodes – BAPI_Requisition_Getdetail_Input, BAPI_Requisition_Release_Gen_Input, BAPI_Requisition_Release_Input, ZBAPI_Requisition_Reject, ZBAPI_Requisition_Rej_overall, PRItemDetails.
ii. UI designing – applying UI element templates to the Views and binding the UI elements to the context.
1. Worklist View
- Insert caption UI elements to the root UI element container for the welcome message to the user who logs in.
- Call the “getworklist” method in the component controller to get the worklist related to PR for the particular user and to update the “PRs” node in the context.
- Insert a “Table” child UI element to the root UI element container (Do not apply table template).
In the context menu of the table UI element, choose “Insert Column” (Do not choose “Insert Grouped Column”) – insert columns for PR number, Requisitioner and Item.
In the context menu of each column, choose “Insert TableCell Editor”.
Bind the “text” attribute of the tablecell editor of each column to “PRNumber”, “Requisitioner” and “Item” attributes respectively of the PRs node in the context.
In the table properties, create a method for “OnSelect” and call the getPRdetails method in the component controller to get the details of the PR and bind it to the “PRItemDetails” node, also fire the outbound plug to PRdetail View.
- Apply Action templates for “Signout” and “Refresh” buttons.
For “SignOut”, create an “on action” method and in this method, call the method to forcelogoff client user.
For “Refresh”, create an “On Action” method and in this method, call the getworklist method of the component controller.
2. PR Detail View.
- Insert Transparent Container UI element and apply form template to the transparent container.
Bind the node “PRItemDetails” to the form UI element.
Add a value attribute to the view context set the type to “Visibility” and bind the visibility of the above transparent container to this attribute.
- Apply Action templates to the transparent container UI element for release item, release overall, reject item and reject overall actions.
Call the corresponding methods in component controller for each of the actions.
For each action – Release Item, Release Overall PR, Reject Item and Reject overall PR, call the corresponding BAPIs by passing the release code for the user, the PR number and the item number
- Insert Transparent Container UI elements for messages to be shown to the user when the transaction is successful and add caption/text-view child UI elements to the transparent container to show the message.
For each message transparent container, assign different visibility context attribute so that the appropriate attribute is enabled as the release/reject is effected.
- Apply Action template to the root UI element container for “Back” action to go back to the worklist view.
Call the getworklist() method before firing the outbound plug to the worklist view.
Deploy and Run:
- Specify the J2EE server name and port in the preferences option in NWDS.
- Deploy the application on to the J2EE server by choosing “Deploy New Archive and Run” in the context menu of the Application and run the Application URL in Blackberry simulator.
Use the standard MDS and Blackberry simulator provided by Blackberry.
They can be downloaded from the official Blackberry website.
PR Approval through Blackberry Demo.
1. Start the Blackberry MDS simulator
2. Start the Blackberry simulator
3. Run the application URL in the web browser of the Blackberry.
4. Enter the UserID and Password for the user.
5. The List of PRs awaiting the user’s approval, the requisitioner and the Item are shown on the screen.
6. On selection of a PR, the details of the PR are shown on the next view along with option to Approve/Reject the PR
7. When a decision is made, i.e., if the PR is either approved/rejected, the user gets a confirmation message that the PR has been approved/rejected.
8. Now, when the user goes back to the worklist page, the workitem for which the decision has been made, will be removed from his/her worklist.