on 10-14-2014 6:50 AM
Hi
I am new to SAP, trying to learn SAP without much help.
I got a task to generate alpha numeric code for employee personnel number.
Ex: When a employee join in October 2014, number should be 1410001, 1410002, 1410003 etc...
I added number range in PA04 and created function to generate the number.
Please tell me step by step how to assign the customer code to personnel number when creating new employee.
- function created to generate number.
FUNCTION ZUHR_GENEMPCODE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IM_EMPGROUP) TYPE C
*" EXPORTING
*" REFERENCE(EX_EMPNO) TYPE PERNR
*"----------------------------------------------------------------------
Data: lv_nextno type i,
lv_empgroup type INRI-NRRANGENR,
lv_no(3) type c,
lv_fillvalue(2) type c,
lv_empno type PERNR.
Data: lv_year(2) type c,
lv_month(2) type c.
lv_year = sy-datum+2(2).
lv_month = sy-datum+4(2).
If IM_EMPGROUP <> 'M'.
lv_empgroup = 'A'.
Else.
lv_empgroup = 'M'.
EndIf.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
NR_RANGE_NR = lv_empgroup
OBJECT = 'RP_PREL'
IMPORTING
NUMBER = lv_nextno.
lv_fillvalue = ''.
If lv_nextno < 10.
lv_fillvalue = '00'.
ElseIf lv_nextno < 100.
lv_fillvalue = '0'.
EndIf.
lv_no = lv_nextno.
CONDENSE lv_no NO-GAPS.
If lv_empgroup = 'A'.
CONCATENATE lv_year lv_month lv_fillvalue lv_no INTO lv_empno.
Else.
CONCATENATE lv_year lv_month lv_no INTO lv_empno.
EndIF.
EX_EMPNO = lv_empno.
ENDFUNCTION.
Hi ,
You can create custom feature from custom table and will add to PA0001 module pool program.
Check with your Technical Consultant.
Regards,
Sankarsan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
104 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.