User exit for Vendor Name Validation in XK01 Transaction.
By Sagar dev
PURPOSE:
In case we vendor creation enter the vendor name in the same vendor name all ready exits should get error/warning message. In XK01 (vendor name already exist with another vendor code).
Step by step Solution:
Go to transaction “CMOD”.
Click On Create Button.
Define Short Text and Package.
Enter Name of an SAP enhancement – SAPMF02K.
Click on Components -
Double Click On - EXIT_SAPMF02K_001
Double Click On include zxf05u01.
We have to implement the code and it will looks like this.
*&---------------------------------------------------------------------*
*& Include ZXF05U01
*&---------------------------------------------------------------------*
***************************************Data Declaration
data : v_name1 type lfa1-name1.
tables : lfa1, lfb1.
types : begin of ty_lfa1,
name1 type lfa1-name1,
end of ty_lfa1,
begin of ty_lfb1,
lifnr type lfb1-lifnr,
end of ty_lfb1.
data : it_lfa1 type standard table of ty_lfa1,
wa_lfa1 type ty_lfa1.
data : it_lfb1 type standard table of ty_lfb1,
wa_lfb1 type ty_lfb1.
**********************************************************
if sy-tcode = 'XK01'. “ tcode
if i_lfb1-bukrs = ''.” company code
select lifnr
into table it_lfb1
from lfb1
where bukrs = ''. ” company code
if it_lfb1[] is not initial.
select name1
into table it_lfa1
from lfa1
for all entries in it_lfb1
where lifnr = it_lfb1-lifnr.
endif.
sort it_lfa1[].
if i_lfa1-name1 is not initial.
loop at it_lfa1 into wa_lfa1.
if wa_lfa1-name1 = i_lfa1-name1.
message e899(f2) with wa_lfa1-name1 'Vendor Name Already Exist With Another Vendor Code'.
endif.
clear wa_lfa1.
endloop.
endif.
endif.
endif.
Activate the code and exit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 |