Christopher
Stoll

SAP Exit for PA30

I recently had to write a small exit for HR that would set certain default values, and then make sure that each group could only be selected from once. Below is the ABAP code that I used to accomplish this small task (inside tcode CMODE, by drilling down).

EXIT_SAPFP50M_001 > ZXPADU01
data: 
 i0025 like p0025

* stollcri -- 2009-10-05 -- SR1182496 
if innnn-infty = '0025'. 
 CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn 
  EXPORTING 
   prelp = innnn 
  IMPORTING 
   pnnnn = i0025. 

 i0025-pkt01 = '1'. 
 i0025-pkt02 = '1'. 
 i0025-pkt03 = '1'. 
 i0025-pkt04 = '1'. 
 i0025-pkt05 = '1'. 
 i0025-pkt06 = '1'. 

 CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp 
  EXPORTING 
   pnnnn = i0025 
  IMPORTING 
   prelp = innnn. 
endif.

(more after the jump)


EXIT_SAPFP50M_002 > ZXPADU02 
data: 
 i0025 like p0025 

* stollcri -- 2009-10-05 -- SR1182496 
when '0025'. 
 IF sy-tcode(2) EQ 'PA'. 
  DATA: ikrt type BUKRT, 
   iecount type i, 
   iocount type i. 

 CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn 
  EXPORTING 
   prelp = innnn 
  IMPORTING 
   pnnnn = i0025. 

 * this should only be for the US, check the number !!! 
 IF i001p-molga = '10'. 
  clear iecount. 
  clear iocount. 
  DO 6 TIMES VARYING ikrt FROM i0025-KRT01 NEXT i0025-KRT02. 
   case ikrt(1). 
    when 'E'. 
     iecount = iecount + 1. 
    when 'O'. 
     iocount = iocount + 1. 
   endcase. 
  ENDDO. 
 endif.

 i0025-pkt01 = '1'. 
 i0025-pkt02 = '1'. 
 i0025-pkt03 = '1'. 
 i0025-pkt04 = '1'. 
 i0025-pkt05 = '1'. 
 i0025-pkt06 = '1'. 

 CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp 
  EXPORTING 
   pnnnn = i0025 
  IMPORTING 
   prelp = innnn. 

 IF iecount > 1 or iocount > 1. 
  MESSAGE e016(rp) WITH 'Multiple Unique Appraisal Criteria Selection not possible'. 
 endif. 
ENDIF.
Published: 2009-10-19
BloggerSAPCodeABAP