Scenario:
By using Transaction code MIRO & MIR7 user can change the document type and post the entry. In order to prevent the user from using different document types apart from “RE” and “AN” an enhancement need to be developed to hard stop the transaction.
By this, system should show an error message as below if the user uses other document types apart from RE and AN.
Error Message:
Document Type “Entered by User (E.g. SA, KZ, and etc)” is not allowed for this transaction.
Step by step Solution:
Step 1:
Find the enhancement point in the include ‘LFDCBFC0’.
a) To find the enhancement point, go to Program à Enhance (Or)
Click on the “Enhance”.
b) Go to Edità Enhancement Operations à Show Implicit Enhancement Options.
Step 2:
Now, we will observe commas like below.
Step 3:
Go to Implicit enhancement option at the beginning of the form ‘CHECK_DOCUMENT_TYPE’ andRight click à Enhancement Implementation à Create.
Step 4:
Now it will ask for Enhancement Type.
Step 5:
We have to implement the code and it will looks like this.
Here you can write the custom code for modifying the functionality.
DATA : lv_message TYPE string .
IF sy-tcode EQ 'MIRO' or
sy-tcode EQ 'MIR7'.
IF bkpf-blart NE 'RE' AND
bkpf-blart NE 'AN'.
CONCATENATE 'Document "' bkpf-blart '" is not allowed for this Transaction' INTO lv_message .
MESSAGE lv_message TYPE 'E' .
ENDIF.
ENDIF.
Activate the code and enhancement.
Step 7:
Check in MIRO and MIR7 by selecting the Document Types other than RE and AN, it will throw an error message.