How to Get SAP VIM Default Approval

SAP VIM Default Approval can be set in SAP VIM ( Vendor Invoice Management) to allow SAP VIM to retrieve the an?pprover by default in the workflow of DP validation.

This Article will explain ?How to retrieve SAP VIM Default Approval will explain from a Cost Center and a Document Type.

First, I am explaining technically the complexity of how Approval Data is stored in different SAP Table.
Second, I am giving away the full ABAP program ( actually it is a function module I developed) to retrieve the list of Default Approval.

Technical Overview of SAP VIM Default Approval

The Default Approval in SAP VIM can be maintained by Cost Center.

DP Document Type DOCTYPE

DP Document Type defines the type of Document Processing.
The information is set on Document Header in the SAP field /OPT/VIM_1HEAD-DOCTYPE.

Cost Center KOSTL

The cost Center is defined on Document Line level.
The Value can be retrieve from SAP Table /OPT/VIM_1ITEM-KOSTL.

Customizing for Document Type and Cost Center

The Second step is to Read the customizing of Cost Center by the Document Type.
In Order to get all the Data, we need a join between

  • Key Determination Range Configuration /PTGWFI/Z_KEYRNG
  • Webflow Key Determination Configuration /PTGWFI/Z_KEYDET

All we need is to retrieve the right key?/ptgwfi/z_keydet-OKEY

Key Determination Range Configuration : /PTGWFI/Z_KEYRNG

This table sets the Rules to link?with Selection-Option Kind Rules between

  • Document Type and a RangeId
  • Cost Center and a Range ID
Field Description
MANDT Client
RANGEID Range ID for Key Determination
SEQUENCE Four-digit number
SIGN I/E (include/exclude values)
ZOPTION Selection option (EQ/BT/CP/…)
LOW ABAP/4: Selection value
HIGH ABAP/4: Selection value

Webflow Key Determination Configuration /PTGWFI/Z_KEYDET

This table sets the links between

  • The RangeId and the Attribut Value (OBJATTRIB)
Field Description
MANDT Client
ZPDCD Client
OKDEF Product Code
OKEY Output Key Definition
FIELDID Output Key Value
RANGEID Character Field Length = 10
OBJTYP Range ID for Key Determination
OBJATTRIB Object Type
SUBOFFSET Object key
SUBLENGTH Natural Number
ZORGL Natural Number
ZDUP Natural Number

Retrieve list of SAP VIM Default Approver User form Hierarchy

With the OKEY retrieve previously and filtered by the input COST Center and DocType, we retrieve the users list from the /PTGWFI/W_ORG with these parameters:

  • ZRSP =?’XXXX_DFLT_APPR’ ?” XXXX must be remplaced with your customizing schema.
  • OBJTY =?’US’ ? ” Person

Check this link for More information on SAP VIM Tables

How to retrieve SAP VIM Default Approval from Cost Center

Function Retrieve Default Approval from Cost Center

Defintion of Macro to populate Range

The first need is to create a range for DP DocType (DOCTYPE)

The Second macro will populate a range for Cost Center ( KOSTL )