What are the steps to Create a User Exit for Vendor Master?
To Create User Exit for vendor master follow these steps:-
Step1. Go to transaction CMOD.
Step2. Put Project as ZPROJ. Click on Create.
Step3. Put Short Text “Check PAN for Vendor and Customer”.
Step4. Click the Save button to save the project.
Step5. Click on Enhancement Assignment.
Step6. Put Enhancement as SAPMF02K and press Enter
Step7. Save the Enhancement
Step8. Next click on Components.
Step9. Click on EXIT_SAPMF02K_001.
Step10. Click on Include ZXF05U01.
Step11. Copy the below-written code to this include:
*&---------------------------------------------------------------------*
*& Include ZXF05U01
*&---------------------------------------------------------------------*
FIELD-SYMBOLS :<fs_pgname1> TYPE j_1ipanno.
ASSIGN ('(SAPLJ1I_MASTER)J_1IMOVEND-J_1IPANNO') TO <fs_pgname1> .
if <fs_pgname1> IS not ASSIGNED.
MESSAGE w000(8i) WITH 'PAN Number is not available.Please update PAN '.
endif.
DATA: it_lfai TYPE TABLE OF lfa1,
lifnr TYPE lfa1-lifnr.
DATA: pan TYPE j_1imovend-j_1ipanno,
l_ilen TYPE i.
DATA: wt_t059z TYPE t059z OCCURS 1 WITH HEADER LINE.
DATA : BEGIN OF wt_lfbw OCCURS 0.
INCLUDE STRUCTURE t_lfbw.
DATA : END OF wt_lfbw.
READ TABLE t_lfbw INDEX 1.
lifnr = t_lfbw-lifnr .
CALL FUNCTION 'J_1BSA_COMPONENT_ACTIVE'
EXPORTING
bukrs = t_lfbw-bukrs
component = 'IN'
EXCEPTIONS
component_not_active = 1
OTHERS = 2.
CHECK sy-subrc = 0.
pan = <fs_pgname1>.
l_ilen = strlen( pan ).
*if pan is initial.
*SELECT SINGLE j_1ipanno FROM j_1imovend INTO pan WHERE lifnr = lifnr.
* endif.
IF pan = ' '.
MESSAGE w000(8i) WITH 'PAN Number is not available.Please update PAN '.
ELSEIF l_ilen NE 10 .
MESSAGE 'Please enter 10 DIGIT PANCARD NO.' TYPE 'E'.
ELSEIF pan+0(5) CA '0123456789'
OR "q
pan+5(4) CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
OR
pan+9(1) CA '0123456789'.
MESSAGE 'PANCARD no should be in the format 1-5 char 6-9 numeric last char' TYPE 'E'.
ENDIF.
Step12. Activate the Include and Project.