PAN Validation

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

To Create User Exit for vendor master follow these steps:1. Go to transaction CMOD.

2. Put Project as ZPROJ. Click on Create.


3. Put Short Text Check PAN for Vendor and Customer.
4. Click on Enhancement Assignment.
5. Put Enhancement as SAPMF02K.
6. Press Enter. Click on Components.
7. Click on EXIT_SAPMF02K_001.
8. Click on Include ZXF05U01.
9. 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.
10. Activate the Include and Project.

To Create User Exit for customer master follow these steps:1. Go to transaction CMOD.
2. Put Project as ZPROJ. Click on Change.
3. Click on Enhancement Assignment.
4. Put Enhancement as SAPMF02D.
5. Press Enter. Click on Components.
6. Click on EXIT_SAPMF02D_001.
7. Click on Include ZXF04U01.
8. Copy the below written code to this include:
*&---------------------------------------------------------------------*
*& Include
ZXF04U01
*&---------------------------------------------------------------------*
DATA: it_kna1 TYPE TABLE OF kna1,
kunnr TYPE kna1-kunnr.
DATA: pan TYPE j_1imocust-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_KNBW.
DATA : END OF wt_lfbw.
FIELD-SYMBOLS :<fs_pgname1> TYPE j_1ipanno.
ASSIGN ('(SAPLJ1I_MASTER)J_1IMOCUST-J_1IPANNO') TO <fs_pgname1> .
if <fs_pgname1> IS not ASSIGNED.
MESSAGE w000(8i) WITH 'PAN Number is not available.Please update PAN '.
endif.
READ TABLE T_KNBW INDEX 1.
KUNNR = T_KNBW-KUNNR .
CALL FUNCTION 'J_1BSA_COMPONENT_ACTIVE'
EXPORTING
bukrs = T_KNBW-bukrs
component = 'IN'
EXCEPTIONS
component_not_active = 1
OTHERS = 2.
CHECK SY-SUBRC = 0.
pan = <fs_pgname1>.
l_ilen = strlen( pan ).
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.

9. Activate include, exit and project.

You might also like