Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Don't use GET PERNR error

$
0
0

Hello Experts,

 

I'm trying to write a code using GET PERNR statement for every first time but keeps getting the error when try to execute my code. Here is the error (Do not use the GET PERNR event).

 

 

Can somebody please help me rectify this error. For reference here is my code.

 

report  zad_hr_test line-size 200.

****************************
*Database Table
****************************
tables: pernr,           " Pernr structure for Logical database
        pa0001,           " Actions
        pa0002.           " Personnel Info

****************************
*Infotypes
****************************
infotypes: 0001,         " Actions
            0002.         " personnel info

****************************
*Variable Declaration
****************************
data: form_nam like p0001-ename,
       v_age(5) type c,       "variable for calculating age in days
       v_ctr1 type i value 0, "counter
       v_ctr2 type i value 0, "counter
       var(5) type c ,        " variable to store btrtl
       var1(5) type .      " variable to store werks

*****************************
*Internal Table Decalartion
*****************************
data: begin of i_tab1 occurs 0,
        werks like pa0001-werks"personnel area
        btrtl like pa0001-btrtl"personnel sub area
        pernr like pa0001-pernr"employee number
        ename like pa0001-ename"employee name
        begda like pa0002-begda"employee join date
        persg like pa0001-persg"employee group
        persk like pa0001-persk"employee sub-group
        plans like pa0001-plans"position
        gbdat like p0002-gbdat,   "date of birth
      end of i_tab1.


******************************
*START-OF-SELECTION
******************************
start-of-selection .

get pernr .

i_tab1-pernr = pernr-pernr.

   rp_provide_from_last p0001 space pn-begda pn-endda .   " Macro for IFT-0001
   rp_provide_from_last p0002 space pn-begda pn-endda .   " Macro for IFT-0002
**--> Populate internal table
   move p0001-werks to i_tab1-werks .
   move p0001-btrtl to i_tab1-btrtl .
   move p0001-pernr to i_tab1-pernr .
   move p0001-ename to i_tab1-ename .
   move p0002-begda to i_tab1-begda .
   move p0001-persg to i_tab1-persg .
   move p0001-persk to i_tab1-persk .
   move p0001-plans to i_tab1-plans .
   move p0002-gbdat to i_tab1-gbdat .
**--> Append data to internal table
   append i_tab1 .
   clear i_tab1 .

   loop at i_tab1.
     write:/ i_tab1-werks,
             i_tab1-btrtl,
             i_tab1-pernr,
             i_tab1-ename,
             i_tab1-begda,
             i_tab1-persg,
             i_tab1-persk,
             i_tab1-plans,
             i_tab1-gbdat.
   endloop.

 

Many thanks in advance.


Viewing all articles
Browse latest Browse all 8332

Trending Articles