Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2794

HR_PAD_HIRE_EMPLOYEE Error

$
0
0

Hi I am using HR_PAD _HIRE_EMPLOYEE to create new employee and its giving following error:

 

1EHRASR00_INFTY031External number range; Enter a personnel number000000
2EPBAS_SERVICE030Personnel number 00000000 not permitted000000

 

I am attaching my code:

 

DATA:   lt_pa0001 TYPE STANDARD TABLE OF zhr_ocp_pa0001,

           ls_pa0001 TYPE zhr_ocp_pa0001,

           lt_pa0002 TYPE STANDARD TABLE OF zhr_ocp_pa0002,

           ls_pa0002 TYPE zhr_ocp_pa0002,

           lt_record1 TYPE STANDARD TABLE OF p0001,

           lt_record2 TYPE STANDARD TABLE OF p0002,

           ls_record1 TYPE p0001,

           ls_record2 TYPE p0002,

           ls_return TYPE hrpad_return_tab,

           ls_key TYPE hrpad_bapipakey_tab,

           lv_pernr TYPE pernr,

           lv_error TYPE flag.

 

   DATA ls_prelp TYPE prelp.

   DATA et_prelp TYPE prelp_tab.

 

   FIELD-SYMBOLS <pnnnn> TYPE any.

 

<selecting values into table lt_pa0001 and lt_pa0002>

 

   LOOP AT lt_pa0001 INTO ls_pa0001.

 

     LS_RECORD1-BEGDA = LS_PA0001-BEGDA.

     LS_RECORD1-ENDDA = LS_PA0001-ENDDA.

     LS_RECORD1-BTRTL = LS_PA0001-BTRTL.

     LS_RECORD1-ABKRS = LS_PA0001-ABKRS.

     LS_RECORD1-PLANS = LS_PA0001-PLANS.

     LS_RECORD1-BUKRS = LS_PA0001-BUKRS.

     LS_RECORD1-WERKS = LS_PA0001-WERKS.

     LS_RECORD1-PERSG = LS_PA0001-PERSG.

     LS_RECORD1-PERSK = LS_PA0001-PERSK.

     LS_RECORD1-GSBER = LS_PA0001-GSBER.

     LS_RECORD1-ORGEH = LS_PA0001-ORGEH.

     LS_RECORD1-OTYPE = LS_PA0001-OTYPE.

     LS_RECORD1-SBMOD = LS_PA0001-SBMOD.

     LS_RECORD1-KOKRS = LS_PA0001-KOKRS.

     LS_RECORD1-sname = LS_PA0001-SNAME.

     LS_RECORD1-ename = LS_PA0001-ENAME.

     LS_RECORD1-ZZHAPPTDTE = LS_PA0001-ZZHAPPTDTE.

      APPEND LS_RECORD1 TO lt_record1.

 

   ENDLOOP.

 

 

   LOOP AT lt_pa0002 INTO ls_pa0002.

 

     LS_RECORD2-BEGDA = LS_PA0002-BEGDA.

     LS_RECORD2-ENDDA = LS_PA0002-ENDDA.

     LS_RECORD2-INITS = LS_PA0002-INITS.

     LS_RECORD2-NACHN = LS_PA0002-NACHN.

     LS_RECORD2-VORNA = LS_PA0002-VORNA.

     LS_RECORD2-RUFNM = LS_PA0002-RUFNM.

     LS_RECORD2-ANRED = LS_PA0002-ANRED.

     LS_RECORD2-GESCH = LS_PA0002-GESCH.

     LS_RECORD2-GBDAT = LS_PA0002-GBDAT.

     LS_RECORD2-GBLND = LS_PA0002-GBLND.

     LS_RECORD2-GBORT = LS_PA0002-GBORT.

     LS_RECORD2-NATIO = LS_PA0002-NATIO.

     LS_RECORD2-SPRSL = LS_PA0002-SPRSL.

     LS_RECORD2-FAMST = LS_PA0002-FAMST.

     LS_RECORD2-ANZKD = LS_PA0002-ANZKD.

     APPEND lS_record2 TO lT_record2.

   ENDLOOP.

 

 

 

*Personnel data

   LOOP AT lt_record1 INTO ls_record1.

     ls_record1-infty = '0001'.

     ASSIGN ls_record1 TO <pnnnn>.

     CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp

       EXPORTING

         pnnnn = ls_record1

       IMPORTING

         prelp = ls_prelp.

     APPEND ls_prelp TO et_prelp.

     CLEAR ls_prelp.

   ENDLOOP.

 

   LOOP AT lt_record2 INTO ls_record2.

     ls_record2-infty = '0002'.

     ASSIGN ls_record2 TO <pnnnn>.

     CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp

       EXPORTING

         pnnnn = ls_record2

       IMPORTING

         prelp = ls_prelp.

     APPEND ls_prelp TO et_prelp.

     CLEAR ls_prelp.

   ENDLOOP.

 

*Create new employee for user

   CALL FUNCTION 'HR_PAD_HIRE_EMPLOYEE'

     EXPORTING

*     employeenumber  = ''

       hiringdate      = '20130501'

       actiontype      = 'Z3'

       reasonforaction = '01'

       pnnnn_tab       = et_prelp

       nocommit        = ''

     IMPORTING

       return_tab      = ls_return

       bapipakey_tab   = ls_key.

 

   IF ls_key IS NOT INITIAL.

*   READ TABLE GT_BAPIKEY INTO GS_BAPIKEY INDEX 1.

*   LV_PERNR = GS_BAPIKEY-EMPLOYEENO.

   ENDIF.

 

 

Please help as in why am I getting this error

 

Regards

Karishma Duggal


Viewing all articles
Browse latest Browse all 2794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>