Object Title: Error IDOC Notification

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 36

Object Title: Error IDOC Notification

Object Description : Mail Will be sent for groups when Outbound IDOC Fails .

Whenever an IDoc gets into error or a negative acknowledgement is received, a notification can
be configured to be sent to a responsible user via workflow task

Standard Task is available which will be triggered on Outbound IDOC error. Since we need
it as a mail notification, created custom task and used Business object IDOCAPPL. For Mail
notification I have delegated the Standard BUS object by adding custom method which will send
Nofication. Automatically notification will reach the responsible user if any error arises or negative
acknowledgement is received in outbound IDOC so that immediate action can be taken.

Event linkage Configuration: T-code SWE2.


Standard Business Object : T-code : SWO1

Delegate the standard BO IDOCAPPL to custom BO ZBUSIDOCAP


***** Implementation of object type ZBUSIDOCAP ****
*
INCLUDE <object>.
begin_data object. " Do not change.. DATA is generated
* only private members may be inserted into structure private
DATA:
" begin of private,
" to declare private attributes remove comments and
" insert private attributes here ...
" end of private,
BEGIN OF key,
idocnumber LIKE edidc-docnum,
END OF key.
end_data object. " Do not change.. DATA is generated

begin_method zscidocerrworkflow changing container.

DATA lv_key TYPE edidc-docnum.

lv_key = object-key.

CALL FUNCTION 'Z_SC_IDOC_ERR_WORKFLOW'


EXPORTING
iv_docno = lv_key
EXCEPTIONS
OTHERS = 01.

CASE sy-subrc.
WHEN 0. " OK
WHEN OTHERS. " to be implemented
ENDCASE.
end_method.
FUNCTION z_sc_idoc_err_workflow.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IV_DOCNO) TYPE EDIDC-DOCNUM OPTIONAL
*"----------------------------------------------------------------------

DATA : lref_utility TYPE REF TO zcl_utility.

CONSTANTS : lc_dist_prof TYPE so_obj_nam VALUE 'SDC'.

DATA : lv_subject TYPE string,


lv_result TYPE boolean.

DATA : lt_body TYPE soli_tab,


ls_body TYPE soli.

CHECK NOT iv_docno IS INITIAL.

CONCATENATE text-001 iv_docno INTO lv_subject SEPARATED BY space.


ls_body-line = lv_subject.
APPEND ls_body TO lt_body.

CREATE OBJECT lref_utility.

* Send Mail
IF lref_utility IS BOUND.

lref_utility->send_mail(
EXPORTING
iv_subject_255 = lv_subject
it_message = lt_body
iv_dist_group = lc_dist_prof
IMPORTING
ev_return = lv_result ).

ENDIF.

ENDFUNCTION.
Configurations are done in WE46 and WE47 Transactions.

Custom Task that is assigned to the BO :


T-code: PFTC
Task : TS90200090

Business Object : IDOCAPPL

Method : ZSCIDOCERRWORKFLOW.
Object Title: Travel Expense Approval Workflow
Object Description: This workflow automates travel expenses settlement process. There will be
two levels of approval with approval and rejection notifications sent to employees.

1. BUSINESS PROCESS STEPS


1. Employee will raise travel expense settlement in SAP T-code PR05.
2. Decision making process workflow is triggered on expense submission.
3. Once the settlement is submitted, the workflow will send a notification to first level
approver’s (Project Manager PRPS-VERNR or Line Manager PA9000-LIMGR) MS Outlook.

a. Notification text: Please review the trip number XXXXXXXXX for employee name
“ABC’ (employee number XXXXXXXX) in SAP Business Workplace (Transaction
Code: SBWP). Please approve or reject this expense report. Please provide a note
if you reject.
4. The approver will login to SAP and perform the following actions:
a. Approve
b. Send back for corrections
c. Reject
5. Send correct notification to employee’s MS Outlook based on approver’s decision, is task
approved/ sent back for correction/ rejected by the approver.
a. This notification content/ text for decisions, sent back for correction/ rejected
should be taken from the approver on the run time during the decision-making.
b. If the trip is approved, two notifications will be triggered as follows:
I. Notification to Internal Auditor MS Outlook for further review and
approval.
i. Notifications text: The employee name “approver name /
employee number” approves Trip number XXXXXXXXXX. Please
review further to complete the task in SAP Business Workplace
(Transaction Code: SBWP).
I. Notification to employee MS Outlook as follows:
ii. Notifications text: Your trip number XXXXXXXXX has been
approved and moved to internal auditor review and approval.
6. If the trip has been sent back for correction or rejection, employee have to update the
correction, send it back for approval. Again, the task starts from step 6.
7. Once the trip is approved, the internal auditor will review the trip for further approval.
8. Auditor can perform the following actions:
a. Approve
b. Send back for corrections
c. Reject
9. If the trip has been sent back for correction or rejection, employee have to update the
correction, send it back for approvals. Again, the task starts from step 6.
a. This notification content/ text for sent back for correction/ rejected decision
should be taken from the internal auditor’s notes during the decision-making
process.
b. If the task is approved, then send notification to employee’s MS Outlook as
follows:
i. Notifications text: Your trip number XXXXXXXXX has been approved &
moved for payment process.

ii. The following table and point number 3 must be included in the
notification only when there is a correction in the travel expense
receipt amount by the Internal Auditor.
Original New Credit
Receipt Amount Adjustment Amount Card
Date Expense Type (INR) (INR) (INR) Expense Justification Reason Note

Your expense
does not comply
with company
policy. Please
Hotel- provide a
24-Apr- Accommodation- justification for
2015 Domestic New 3,358.00 101.94 3,256.06 No hotel stay this expense.

Total 3,358.00 101.94 3,256.06

Event Linkage: T-code :SWE2

Business Object : BUS2089


Event : CREATED

Travel WF.pdf

Logic to settle the Trip from the Workflow

METHOD settle_trip.

DATA: lv_period TYPE pnppabrp, "payroll period


lv_year TYPE pnppabrj, "payroll year
lv_timra TYPE timra,
lv_check TYPE rp_xfeld,
lv_abrec TYPE abrec.

CONSTANTS: lc_set TYPE boolean VALUE 'X',


lc_settled TYPE abrec VALUE '2'.

lv_timra = lc_set.
lv_check = lc_set.
lv_period = sy-datum+4(2).
lv_year = sy-datum+0(4).

****----Submit the report to update the status of the trip.


SUBMIT rprtec00 WITH pnpxabkr = iv_abkrs
WITH pnptimra = lv_timra
WITH pnppabrp = lv_period
WITH pnppabrj = lv_year
WITH pnppernr = iv_pernr
WITH s_reisen = iv_trip
WITH trip = lv_check EXPORTING LIST TO MEMORY AND RETUR
N.
CLEAR lv_abrec.
SELECT SINGLE abrec FROM ptrv_perio
INTO lv_abrec
WHERE pernr = iv_pernr
AND reinr = iv_trip.

IF sy-subrc = 0 AND lv_abrec = lc_settled.


ev_return = text-015.
ELSE.
ev_return = text-016.
ENDIF.

ENDMETHOD.

 After both the two level approval(first level -Line Manager,


Second level- Auditor) change the trip status as ‘Trip Approved’
and ‘ Settled’.

Enhancement of the Standard T-code PR05


Module Pool name: SAPMP56T

*---------------------------------------------------------------------*
* FORM EXCLFUNC_REFRESH *
*---------------------------------------------------------------------*
FORM exclfunc_refresh.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""$"$\SE:(1) Form EXCLFUNC_REFRESH, Start

A
*$*$-Start: (1)--------------------------------------------------------------
-------------------$*$*
ENHANCEMENT 1 ZEIMP_HR_EXPENSE_NOTIFY. "active version

DATA: ls_tab LIKE LINE OF zcl_hr_utility=>gt_tab.


DATA: lv_key TYPE indx-srtfd.
DATA: lref TYPE REF TO cl_abap_expimp_db.

IF beleg[] is NOT INITIAL AND zcl_hr_utility=>gt_tab IS INITIAL.


zcl_hr_utility=>gt_tab = BELEG[].
CLEAR lv_key.
CONCATENATE wa_head-pernr wa_head-reinr INTO lv_key.
CREATE OBJECT lref.
TRY.
CALL METHOD lref->delete
EXPORTING
tabname = 'INDX'
client = sy-mandt
area = 'ST'
id = lv_key
client_specified = abap_true.
CATCH cx_sy_client .
CATCH cx_sy_generic_key .
CATCH cx_sy_incorrect_key .
ENDTRY.
IF lv_key is NOT INITIAL.
EXPORT GT_TAB FROM zcl_hr_utility=>gt_tab TO DATABASE INDX(ST) ID lv_ke
y.
ENDIF.
ENDIF.

ENDENHANCEMENT.
*$*$-End: (1)--------------------------------------------------------------
-------------------$*$*
Implementation of User exit
Object Title: Perform mass upload of service entry against the Bulk PO.
Object Description: Perform mass upload of service entry against the Bulk PO along with
workflow emails.

Bulk PO.pdf

BUSINESS PROCESS STEPS


When a service entry sheet is created in the transaction code ZML81N, and standard business
event BUS2091 ‘CREATED’ triggers the custom workflow.
When a Service Entry is created in transaction code ZML81N a standard business event BUS2091
‘CREATED’ is triggered.

Workflow that is triggered is based on the Service Entry Release strategy.

Workflow notifications will be emailed through for approval to the Service Entry Level-1 Approver.

If the workflow is rejected then a workflow notification will be sent to the creator of the Service Entry.

If the workflow is approved then a workflow notification will be sent to the Service Entry Creator
and the AP team.

The Notification must contain the Bulk PO Number and Item Number, Service Entry Sheet Number and
Vendor Invoice Number.

Delegating of the standard BO to create a new event ‘APPROVED’.


Used the standard Business object BUS2091 and Event ‘CREATED’.
Create a Subtype ZBUS2091 and delegate the standard BUS2091 to this subtype.
Create a Custom event ‘APPROVED’ in the Business object ZBUS2091. This event is triggered
when the field Release indicator (‘FRGKL’) in the table ESSR is changed from ‘A’ (Not
Accepted) to ‘B’ (Accepted).

A entry is made in the change document view ‘SWEVCDOBJ1’ or through the Transaction code
‘SWEC’.

Logic to pick the approver for the SES workflow.

ZMMM_WF_AGENT
Description: Procurement Workflow Release Maintenance
Field Name Data Element Data Type Length Decimal Place Description
MANDT MANDT CLNT 3 0 Client
OBJECT SWO_OBJTYP CHAR 10 0 Object Type
FRGGR FRGGR CHAR 2 0 Release Group
FRGCO FRGCO CHAR 2 0 Release Code
BUKRS BUKRS CHAR 4 0 Company Code
OBJID ACTORID CHAR 12 0 Agent ID in
Organization
Management
Wait on the Release Indicator Status Change
This step will wait on the event BUS2091 ‘APPROVED’. The Event is raised by system whenever
the approver releases the Service Entry Sheet and there is a change in the status in the ‘Release
indicator’ field from ‘A’(Not Accepted) to ‘B’(Accepted) in the T-code ZML81N.
Configuration in T-code swec
Object Title: Purchase Order Approval
Object Description: The Purchase Order document is an external document issued to Vendor
for them to provide Materials and Services. This document needs to be approved by COLT as
per the COLT Authority Matrix (CAM) before it is issued to Vendor.

SAP Process Steps

Step 1:

Option 1: Create PO

Should call ME21N transaction where in buyer enter PO with details and save. Without
saving PO then the work item should not be in approver inbox.

IF PO Creator Authorized:

A background step should be calling a method PurchaseOrder.Release from the business


object BUS2012 and if the PO Originator (Shop on Behalf) field has been populated and the email
notification flag has been, upon release of the PO.
The subject of the email will need to format as outlined below as this will allow the focal
points to have a process for following up the originator.The email body text be standard.

IF PO Creator NOT Authorized:

 First validation should be done whether he is a valid sap user or not. And the
second validation is whether approver does have authority to release PO.

IF PO Approver NOT Authorized:

 Give an error message saying to choose another approver

IF PO Approver Authorized:

 A work item should go to Approver inbox with 2 options i.e., Approve, Reject

PO_WF.pdf

Triggering Event logic

Event Linkages
Maintain Event linkages using transaction code ‘SWETYPV’ for object BUS2012 and event
RELEASESTEPCREATED

Agent Determination:

ZMMM_WF_AGENT
Description: Procurement Workflow Release Maintenance
Field Name Data Element Data Type Length Decimal Place Description
MANDT MANDT CLNT 3 0 Client
OBJECT SWO_OBJTYP CHAR 10 0 Object Type
FRGGR FRGGR CHAR 2 0 Release Group
FRGCO FRGCO CHAR 2 0 Release Code
BUKRS BUKRS CHAR 4 0 Company Code
OBJID ACTORID CHAR 12 0 Agent ID in
Organization
Management

 Created a class (ZCL_MM_PO_RELEASE) in that method: GET_APPROVER is fetch


the agents for release PO.

Approver gets a work item in his inbox with 2 options

Option 1: Approve

A background step should be calling a method PurchaseOrder. Release from the


business object BUS2012 and end Workflow.
For PO that have been released, if the PO Originator field has been populated and the
email notification flag has been set in the corresponding purchase order then email the Focal Point,
upon release of the PO.

Option 2: Reject

A notification should to go to initiator with following 2 options:

Option 1: Amend PO (Should able to change the PO, ME22N) and again’ IF PO
Creator NOT Authorized’ step will be repeated

Option 2: Cancel and Keep work item (Standard SAP Workflow functionality)
Agent Determination Logic:

Mail notification for Approver:


Mail notification to PO creator for PO rejection

Mail notification to PO creator for PO approval.

Object Title: Non-PO Invoice Approval Process


Object Description: The incoming vendor invoice is booked in SAP. When the invoice is not
based on PO, then it needs an approval in SAP.

SAP Standard Solution: As part of SAP Standard World Template One, two or three level approval is
available for a non-PO AP invoice.

COLT requirement is to have dynamic multi level approvals as per the CAM (Colt Authority Matrix).

Business Process Steps


 A Vendor Invoice is booked directly into Accounts payable (T-code FB60 or F-43) when there
was no PO raised to the Vendor.

 The non-PO vendor invoice requires approval as per the COLT Authority Matrix (CAM) and
certain exceptions.

 The CAM prescribes a dynamic approval matrix based on who the workflow is initiated to and the
nature of the expense.

 The non-PO vendor invoice cannot be posted unless it is approved.

NON_PO_WF.pdf

1) G/L Account Category Table


G/L Account G/L Account Category
(KEY)
<RACCT> <2 Char>

GL Account Categories:
01 – SWIN
02 - Operating Costs
03 – Rent and Property
04 – External Consultants
05 – Charitable Donations
06 – Capex Cost
2) CAM Table
G/L Account Category CAM Band / Level Approval Amount
(KEY) (KEY)
<2 Char> <1 Number> <ACDOCA-HSL>

3) Alternate Agent Table


Function Code Job Level Start Date User
(4th and 5th place of (KEY) (KEY)
Cost Center)
(KEY)
<2 Character> <1 Number> <DATUM> <UNAME>
A custom event needs to be triggered as and when a new entry is created here with the Function
Code and job Level

4) Mandatory level (Currently to be maintained with 3 and 4 )


Job Level
<1 Number>

Event Linkage:

Business Object: FIPP.

Event: CREATED.

Delegate the standard BO FIPP to ZFIPP and add a new event ‘WAIT’.
Object Title: ERO Budget Workflow
Object Description: Equipment Request Order (ERO) Approval Workflow process is required for
all the ERO for Internal projects

Budget_ERO_WF.p
df

SAP Standard Solution: The standard solution in SAP is creating a free of charge delivery (FOC)

 There is no workflow process for Free of charge delivery process

Business Process:

The Equipment request ordering (ERO) process for internal projects would require a workflow
process. The process flow for the same is provided below in detail:

1) The requester will create an ERO with transaction code ZVA01. The workflow process is valid
only if the selected WBS starts with IP*** (Internal Project). The workflow process is not
required for external projects.
2) The requester will save the ERO after entering the item along with the quantity required. The
order custom status would remain as ZENT (Order entry)
3) On saving the sales order for the first time, the ERO approval workflow will be triggered. An
outlook email and SAP mail would be sent to the project owner (approver). Further an email
will be sent to the requester as well.
4) The approver would access the SAP inbox for approving or rejecting the workflow.
5) The project owner can approve the ERO by clicking on the approve button in the SAP email.
On clicking “approve button” the status of the ERO would be changed from ZENT to ZBKD
(Order booked)
6) Once the order is moved to ZBKD status, no changes in ERO for increase in quantity or addition
of line item will be allowed.
7) As soon as the status is changed to ZBKD, the ERO would be available for picking and
shipping.
8) However if an authorized user wants to reduce quantity from a line item or delete the line item
itself, it will be allowed even after the ERO status is moved to ZBKD status.
9) The authorization of changing status from ZENT to ZBKD would be limited only to the project
owners (approvers)
10) The project owner would also have the choice of rejecting the workflow. The reason of rejecting
the workflow can be for example choosing the wrong equipment, order quantity beyond the
budget etc.
11) If the project owner decides to reject the workflow, he will put the rejection comment in the
email and click on reject button to reject the workflow.
12) This will trigger workflow back to the ERO creator who will either modify the ERO order and re
trigger the workflow for approval or cancel the ERO (put the status to ZCLD).
13) The ERO can be rejected multiple times by approver. There will be a button provided in ERO
for re triggering the workflow item for re approval once it is back to the requester. The requester
will click on the re-trigger button once he has made the changes and when the ERO is ready
for re approval.
14) The rejection comments would be stored in sales order (VA02/VA03) as header text. The
history of rejection comments would be provided to be stored in sales order.
15) Substitution process: In case the approver (Project owner) is on leave or not available the
project owner would assign the substitute in the SAP mail (SAP business workplace). In case
for some reason the project owner is not able to assign the substitute before leaving for vacation
(or any other reason, business can raise an ITSR to the authorization team (workflow
administrator) to create substitute for a limited time period. Further substitution functionality will
be based on user-ID. Hence the workflow email would be triggered to the same substitute for
all purposes (ERO workflow/PO approval/HR workflow).
16) Further in case if for some reason workflow is not triggered due to some technical reason
(authorization/Personnel ID not maintained), an email notification will be sent to the
requester/email group to take follow up action.

Dependency Formatted

The following are dependencies related to the functionality.

 Sale order line must have document type YBFD.


 Sale order must be Intercompany PO
 Project Manager / Budget Owner is captured in field - PRPS – VERNR field.
 Email ID of the Workflow initiator and the project manager (approver of
workitem) should be valid and maintained in SU01.

Assumption Formatted: Font: (Default) +Body (Calibri), 11 pt, Not


Bold, Font color: Auto

 All SAP User IDs must have e-mail IDs specified using the transaction
‘SU01’.
 Basis team must configure the System in such a way that e-mails can be
sent to Microsoft Outlook.
Triggering Event logic
Delegate the standard Business object BUS2032 to ZBUS2032 to add the additional event
‘RETRIGGER’ that is used to retrigger the workflow

Business Object

BUS2032- CREATE
BUS2032- RETRIGGER
Object Title: Approval before posting inventory differences
Object Description: Physical inventory is the process of carrying out the physical stock verification of
company’s stock.
The differences between the Physical stock and the system stock are posted.

PI_WF.pdf

Procedure
Physical Inventory:

 is carried out for balance sheet purposes


 ensures availability of correct stocks for Material Requirement Planning
 is carried out on the basis of stock management unit
 Each stock management unit is counted separately, and inventory differences are posted
per stock management unit

SAP Process Steps

Steps to create
physical Inventory document.docx

Step 1:
Option 1: Create Physical Inventory in MI07
Physical inventory process in SAP comprises of three phases:

 Creation of Physical Inventory document.


 Entry count.
 Posting of inventory differences.

IF Physical Inventory document Creator NOT Authorized:

 First validation should be done whether he is a valid sap user or not. And the
second validation is whether approver does have authority to post Physical
Inventory Document.

IF PI Approver NOT Authorized:

 Give an error message saying to choose another approver


IF PI Approver Authorized:

 A work item should go to Approver inbox with 2 options i.e., Approve, Reject

Enhancement Details for Physical Inventory document.


This Implicit Enhancement is called within the standard report in the T-code MI07
Enhancement spot name: ZSC_IMPL_PHYS_INV_APPR_CHECK.
Include name: MM07IFK0.
Form name: KONTIERUNG_MERKEN.
From within this enhancement spot workflow will be triggered.
Logic to determine the approver of the PI workflow.

t Title
Object Title: Sales Order Modification Workflow
Object Description: This workflow covers sending Email Notification to Planner whenever sales
order items will be cancelled or modified
Change quantity of SO line items OR Cancel a line item OR add new line item to the SO WF is triggered to send notification mail to the SO creator.

You might also like