In audit management module of SAP the naming of an audit object (audit plan, audit, question list, question)
is given by the user. This has its disadvantages such as
- No convention in the naming of the object.
- If a naming convention is followed by the organization, users who are not aware of the naming convention
will give their own naming which may not follow the naming convention.
Hence we go for the numbering routine which generates the naming of the Audit objects automatically while
creating them which follows the naming convention.
The BADI used for implementing the numbering routine is PLM_AUDIT_IDENTIFIER.
Method used for implementing numbering routine: GET_EXTERNAL_ID
2. Business description
Don’t have to do manual numbering, and therefore more effective – will also remove the risk of someone trying
to introduce a system in the numbering, which then could raise demands on reporting etc.
3. Steps to create Audit
Go to transaction PLMD_AUDIT.
Select the audit object which needs to be created from the options displayed after pressing the create icon.
The audit objects can be created by two ways.
- Directly by selecting the object in top three options
- By using a template which references(copies) the already created audit objects by selecting from below
Provide the name of the object (before numbering routine is implemented).
Provide the necessary values for the audit and save.
4. Implementation of numbering routine
Go to the BADI: PLM_AUDIT_IDENTIFIER and create an implementation (Ex: znumbering).
Go to the method GET_EXTERNAL_ID and implement the numbering routine.
There are different audit object for which the naming convention has to be unique.
The different audit objects and their object type are listed below.
Audit question list
Part, Element, Question
Audit Part, Element, Question
Corrective and preventive action
Parameters of the Method GET_EXTERNAL_ID
IV_OBJECT_TYPE: will contain the object type of the audit object.
IV_EXTERNAL_ID: contains the name of the Audit object if the name was given.
IR_PARENT_OBJECT: Contains the parent object of the audit object
EV_EXTERNAL_ID: will be used to set the numbering for the audit object.
4.1 Creation of number range object
In my scenario I have generated the numbering for each of the audit object using the
number range objects.The function module NUMBER_GET_NEXT will be used to retrieve
the numbering from the number range object.
Creation of number range object:
Go to transaction SNRO.
Provide the name of the number range object and press create.
Provide the necessary details.
Create the intervals and save. In my case I have created four intervals each for the object type’s AUP, AUO, AQN, COR.
Here I have created interval AP for object type AUP, AU for object type AUO, CA for object type COR and QL for object type AQN.
4.2 Creating the numbering for the audit objects
Retrieve the numbering from the number range object by passing the interval in parameter
NR_RANGE_NR and the number range object name in the parameter OBJECT. Retrieve
the number from the parameter NUMBER.Concatenate the interval name and the number
into the export parameter W_EXTERNAL_ID of the method.
Check for the input object type.
IF iv_object_type = ‘AUP’
OR iv_object_type = ‘AUO’
OR iv_object_type = ‘COR’
OR iv_object_type = ‘AQN’.
Based on the input object type call the number range object
CALL FUNCTION ‘NUMBER_GET_NEXT’
nr_range_nr = ( ‘AP’ or ‘AU’ or ‘CA’ or ‘QL’) based on the input object type
object = ‘ZNUM’
number = lv_number
Based on the number range object’s numbering and name build the numbering for the
ev_external_id+2 = lv_number.
ev_external_id(2) = ‘AP’ or ‘Au’ or ‘CA’ or ‘QL’ (based on input object type)
Audit created after numbering routine is implemented.
Instead of using number range object to generate the numbering we can also use our
own logic to generate the internal numbering.
5. Disable the input field
Once numbering is generated we can disable the input for the naming field so that the
user can’t able to overwrite the generated naming.We need to use the method
IS_EXTERNAL_ID_CHANGEABLE of the BADI to disable the input of the naming field
using the below logic.
To disable the input for the naming field make the export parameter
rv_is_changeable = ‘0’.
6. Difficulties faced
- When creating audit using template the BADI will be executed twice hence the
numbering will be incremented by 2 from the previous number. Hence a check
must be performed so that the Number range object was called only once.
- When creating audit Question list using template the incoming object type will
be AUO instead of AQN. This should be taken care by checking the parent object
type with the import parameter object type. If object type is AUO and parent object
type is AUP the object is Audit. If both the object type and parent object type are AUO
then the object is Question list.