Get PERNR using SY-UNAME
Hi All,
How to find personnel number (PERNR )using SAP logon username(SY-UNAME)?
Please let me know your thoughts....
Thanks & Regards
Santhosh
Hi
You can use RP_GET_PERNR_FROM_USERID function module to get the pernr.
Give USRTY parameter = '0001' (SY-UNAME).
CALL FUNCTION 'RP_GET_PERNR_FROM_USERID'
EXPORTING
BEGDA = sy-datum
ENDDA = sy-datum
USRID = G_SYUNAME
USRTY = '0001'
IMPORTING
USR_PERNR = G_PERNR
EXCEPTIONS
RETCD = 1
OTHERS = 2
With Regards
Nikunj Shah
Similar Messages
-
Get pernr based on company code in logical databse
Hi,
When using the get pernr event, all the pernrs that I get are in the ascending order I want them first grouped based on the company code and then on pernr.
Any suggestions would be appreciated abd suitably rewarded.
for ex: get pernr.
write:/ pernr, bukrs.
end-of-selection.
result: 00000099 1001
00000002 1003
Regards
Vick
Message was edited by:
vick vennavfor ex: get pernr.
write:/ pernr, bukrs.
end-of-selection.
result: 00000099 1001
00000002 1003
We are sending the payroll information to the 3rd party for pay check purposes, at my client side they have inserted a custom include in the standard program and populating the information in a flat file which needs to be sorted first based on company code and then on pernr. If I try to do it later,the code is becoming a mess, so I want to know is there a way to get pernr using logical database whose order is based on company code.
Regards -
Hi,
I am a very much a beginner to ABAP.
Can anyone explain me the logic with which pernr statement works?
This is my understanding so far.
i think it is working as a loop.
At first loop it gets the record of first pernr number into an internal table. If muliple records exists they are added into the internal table.
This goes on for all pernrs.
Is this correct?
Also i think there is a table where pernr number is stored globally. This is because i get a pernr number while using get pernr but that number is nowhere in any table.
Can any1 tell me that table name.
Thanks in advance,
BalaHi,
Check
http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/content.htm
GET PERNR:used in logical database PNP
If you are using LDB PNP, try the below code
tables : pernr.
infotypes : 0001.
start-of-selection.
get PERNR.
end-of-selection
Edited by: Neenu Jose on Oct 24, 2008 8:38 AM
Edited by: Neenu Jose on Oct 24, 2008 8:39 AM
Edited by: Neenu Jose on Oct 24, 2008 8:42 AM -
Is there a way to use 'GET PERNR' without the selection screens?
I would like to use the GET PERNR event in a batch program without using the default selection screens. I would like to be able to use my own selection screen and parameters, but only get them along with the default selection options for payroll period. I've tried removing the screen number from the attributes screen, but still get these options. Is this possible?
hi Kiran,
report Category is a Pushbutton on the Attributes popup, it only appears if you use PNP logical DB.
this is from SAPHelp: "Report Category
Category used for HR reports that use the PNP logical database. It controls the type and number of fields that appear on the selection screen of an evaluation report."
hope this helps
ec -
How to use the class CL_PT_EMPLOYEE with GET PERNR?
Hi,
I saw this sample code on the forum.
Is it more performant than using the "RP-PROVIDE-..." macros?
Does the employee instance needs to be killed after each pass? How does it affects memory?
start-of-selection.
GET pernr.
<b>* Create employee instance</b>
gif_employee = cl_pt_employee=>get_employee( pernr ).
go_employee ?= gif_employee.
<b>* Append all other required infotypes to itab</b>
APPEND '0003' TO gt_infotypes.
CALL METHOD go_employee->get_infotypes
EXPORTING
i_itlist = gt_infotypes
i_fromdate = id_fromdate " start date
i_todate = id_todate " end date
* I_FILTER =
i_noauthcheck = 'X'
IMPORTING
e_result = gt_infty_request
e_retcd = gd_retcd.I think it that way. You are trying to compare and analyse old (don't say bad) programming school with a new (OO one) approach. Although, I am OO enthusiast and in any case I will try to convice you that OO aproach is better than classical one, you should know what SE30 was designed for. If you want to stress on OO design, use the one you mentioned, otherwise stick what SAP recommmends (please note, that I am "middle" school pupil, so I tried to learn all courses with my own experience and feelings from OO).
IMHO, OO aproach is a way of thinking, not something we can messure in sec. and compare to old school teaching. Some of your report should be desinged in classical way, some should be pure OO. Which one you choose, is up to you, your conclusions, your percives of ABAP language. For me OO was not injected in ABAP enough, to affect developers or to convince them using it in any case w/o doubts you have.
Regards
Marcin -
Error return immediately using GET pernr (PNP logical db)
I have a requirement to use HR PNP logical database for a report. The report should display the values from employee's infotypes. Should the user does not have authorisation on one or more infotype, the column field for that infotype should be left blank.
I tried using 'Get Pernr' but system will return error immediately that user does not have authorisation on any of the infotypes. Please advice how should I code my report in order to fit into my requirement.There is afunction module to disable the infotype authorization check ( do a wildcard search in se37 for 'HRINFAUTH* ).. call that before the Get Pernr event & implement explicit authzn checks in your program..
~Suresh -
How to read personal no's on selection in LDB without using GET PERNR
Hi to all
I am using Logical data base PNP and selection screen 900.
Now my requirement is to retrieve personal no's which are entered at selection seperately without using GET PERNR.
Ineed all the pernrwhich are entered in selection.
How to do that.
Please guide.
Regards
AnubhavHi,
You can do as SUJIT said or use GET PERNR and assign PERN-PERNR to Workarea and then append that to internal table.
DATA:
ITAB_PERNR like standard table of PA0000-pernr,
wa_pernr like line of ITAB_PERNR.
GET PERNR.
wa_pernr-pernr = pernr-pernr.
append wa_pernr to ITAB_PERNR
Hope this would help you.
Regards
Narin Nandivada. -
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 c . " 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.Hi,
You're asking a different question now, so you should start a new thread...
Anyway, in the 'Attributes' screen of your program you can specify which selection screens you want to display for a logical database.
Alternatively you can hide all (or part) of a selection screen at the 'selection-screen output' event.
For example:
at selection-screen output.
loop at screen.
check screen-name = 'PNPABKRS-HIGH'
or screen-name = 'PNPABKRS-LOW'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '1'.
screen-active = '0'.
modify screen.
endloop.
cheers
Paul -
Use GET PERNR without any screen default from Logical DB.
Could anyone help me how to avoid using screen default from logical DB if using GET PERNR?
Are u saying using this logic below , im can avoid using GET PERNR?
TABLES: RP50G,PERNR,PYORGSCREEN,PYTIMESCREEN.
DATA: IN_RGDIR LIKE PC261 OCCURS 0 WITH HEADER LINE,
WA_RT LIKE PC207 OCCURS 0 WITH HEADER LINE,
SEQNR LIKE PC261-SEQNR,
RESULT TYPE PAY99_RESULT.
DATA: M_START LIKE SY-DATUM,
M_END LIKE SY-DATUM.
FORM GET_PAYROLL USING P_PERNR M_START M_END.
*This FM help us to get the Sequence number used for the
*employee on the payroll.
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
PERSNR = P_PERNR
TABLES
IN_RGDIR = IN_RGDIR
EXCEPTIONS
NO_RECORD_FOUND = 1
OTHERS = 2.
*We read it using two dates, which corresponds to the month *we need
READ TABLE IN_RGDIR WITH KEY FPBEG = M_START
FPEND = M_END.
SEQNR = IN_RGDIR-SEQNR.
*This FM actually reads the payroll and get the information
*we need.
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
EXPORTING
CLUSTERID = 'XX'
*In CLUSTERID use the country of your choice
EMPLOYEENUMBER = P_PERNR
SEQUENCENUMBER = SEQNR
READ_ONLY_INTERNATIONAL = 'X'
CHANGING
PAYROLL_RESULT = RESULT
EXCEPTIONS
ILLEGAL_ISOCODE_OR_CLUSTERID = 1
ERROR_GENERATING_IMPORT = 2
IMPORT_MISMATCH_ERROR = 3
SUBPOOL_DIR_FULL = 4
NO_READ_AUTHORITY = 5
NO_RECORD_FOUND = 6
VERSIONS_DO_NOT_MATCH = 7
OTHERS = 8.
*We just need to read the result table.
LOOP AT RESULT-INTER-RT INTO WA_RT.
CASE WA_RT-LGART.
WHEN '9010'.
MOVE WA_RT-BETRG TO T_ANYTABLE-SOMEPAY.
ENDCASE.
ENDLOOP.
ENDFORM. -
Hello Experts,
I am currently writing a program to list all users of a role and their current position. I need to find a way to get PERNR given a username to eventually obtain the position number. Any help would be appreciated.
Thanks,
NicoleHi Nicole,
This depends on the how user ID are maintained in your system.
You may get the perner using Infotype 0105. There you have field USRID which is the user ID. Using this you can get the PERNR and once you got the PERNR you can get all the details Using different Infotypes.
Regards,
Atish -
How to extract current record using get pernr (logical database)
Hi all,
I am using logical database in the program and using <b>get pernr</b> method. But there are multiple entries in the infotype for a perticular employee. i want to extract employees current record whose end date is greater than sy-datum.
how to do this using <b>get pernr</b>?
Thanks in advance.Hi Priti,
Get Pernr statement will get all the records for each employee spcicified for the Begin and End dates on the selection screen and store in an internal table for the infotypes declared in the infotypes statement.
You need to read this table and copy only the records that meet the date criteria in an internal table for further use.
For Ex:
infotypes : 0001.
tables : pernr.
TYPES : BEGIN OF ty_kostl,
pernr TYPE pernr-pernr,
kostl TYPE p0001-kostl,
ename TYPE p0001-ename,
END OF ty_kostl.
Work Areas
DATA : g_kostl_wa TYPE ty_kostl.
Internal Tables
DATA : i_kostl TYPE TABLE OF ty_kostl.
start-of-selection.
get pernr.
PROVIDE * FROM p0001 BETWEEN pn-begda AND pn-endda.
if p0001-endda GT sy-datum.
g_kostl_wa-pernr = p0001-pernr.
g_kostl_wa-kostl = p0001-kostl.
g_kostl_wa-ename = p0001-ename.
APPEND g_kostl_wa TO i_kostl.
CLEAR g_kostl_wa.
endif.
ENDPROVIDE. -
Without using GET PERNR, how to retierve data in HR ABAP Reports
Hi Experts,
How to retrieve the data without using GET PERNR, by using function modules in HR ABAP Reports.
Thanks.
Naveen.Hi,
U can use HR_READ_INFOTYPE Function Module in Place of GET PERNR.
Go through the following link it will give the example of that FM.
http://www.experts-exchange.com/Database/Software/ERP/SAP/Q_20781600.html
<REMOVED BY MODERATOR>
Edited by: subas Bose on Feb 15, 2008 2:46 PM
Edited by: Alvaro Tejada Galindo on Feb 15, 2008 3:06 PM -
Hi,
I`am developing a custom service for ESS on ABAP Dynpro.
How can I get current employee PERNR inside of my ABAP implementation?
The only way I know getting PERNR from 0105 i.t. using current sy-uname, but I dont like this solution.
Is where any other way of getting current employee PERNR?
thanks to all,
EvgenyHi Evgeny,
It's probably best to post these types of questions in the HR/ABAP forums in the future. In any case, the only link between the employee record and the user record is IT 0105 so I'm afraid you don't have much choice there. If you don't want to access the employee record using SQL, I believe there is a function module called something like BAPI_EMPLOYEE_GET_DETAILS (check in SE37).
Cheers,
Dion -
How to Generate a new PERNR using HR_MAINTAIN_MASTERDATA in WD?
Hi Experts;
Can I get some sample code for creating a new PERNR using HR_MAINTAIN_MASTERDATA FM. ???!!!
I've created a some input fields in webdynpro using infotype PA0002 and depending upon those fields I want to generate a PERNR number .
Plz help me with some sample code ..
Thanks in Adv.
Buntywhat am I missing in the below code ??? is the code correct ??? Using the below code how will I get the new PERNR value ??
method ONACTIONSAVE .
DATA lo_nd_final_node TYPE REF TO if_wd_context_node.
DATA lo_el_final_node TYPE REF TO if_wd_context_element.
DATA ls_final_node TYPE wd_this->element_final_node.
DATA lv_inits LIKE ls_final_node-inits.
DATA lv_nachn LIKE ls_final_node-nachn.
DATA lv_vorna LIKE ls_final_node-vorna.
DATA lv_titel LIKE ls_final_node-titel.
DATA lv_gesch LIKE ls_final_node-gesch.
DATA lv_natio LIKE ls_final_node-natio.
DATA lv_famst LIKE ls_final_node-famst.
DATA lv_gbpas LIKE ls_final_node-gbpas.
DATA lv_stras LIKE ls_final_node-stras.
DATA lv_ort01 LIKE ls_final_node-ort01.
DATA lv_pstlz LIKE ls_final_node-pstlz.
DATA lv_telnr LIKE ls_final_node-telnr.
DATA lv_locat LIKE ls_final_node-locat.
DATA lv_usrid LIKE ls_final_node-usrid.
* navigate from <CONTEXT> to <FINAL_NODE> via lead selection
lo_nd_final_node = wd_context->get_child_node( name = wd_this->wdctx_final_node ).
* get element via lead selection
lo_el_final_node = lo_nd_final_node->get_element( ).
* get single attribute
lo_el_final_node->get_attribute(
EXPORTING
name = `INITS`
IMPORTING
value = lv_inits ).
* get single attribute
lo_el_final_node->get_attribute(
EXPORTING
name = `NACHN`
IMPORTING
value = lv_nachn ).
* get single attribute
lo_el_final_node->get_attribute(
EXPORTING
name = `VORNA`
IMPORTING
value = lv_vorna ).
* get single attribute
lo_el_final_node->get_attribute(
EXPORTING
name = `TITEL`
IMPORTING
value = lv_titel ).
* get single attribute
lo_el_final_node->get_attribute(
EXPORTING
name = `GESCH`
IMPORTING
value = lv_gesch ).
* get single attribute
lo_el_final_node->get_attribute(
EXPORTING
name = `NATIO`
IMPORTING
value = lv_natio ).
* get single attribute
lo_el_final_node->get_attribute(
EXPORTING
name = `FAMST`
IMPORTING
value = lv_famst ).
* get single attribute
lo_el_final_node->get_attribute(
EXPORTING
name = `GBPAS`
IMPORTING
value = lv_gbpas ).
* get single attribute
lo_el_final_node->get_attribute(
EXPORTING
name = `STRAS`
IMPORTING
value = lv_stras ).
* get single attribute
lo_el_final_node->get_attribute(
EXPORTING
name = `ORT01`
IMPORTING
value = lv_ort01 ).
* get single attribute
lo_el_final_node->get_attribute(
EXPORTING
name = `PSTLZ`
IMPORTING
value = lv_pstlz ).
* get single attribute
lo_el_final_node->get_attribute(
EXPORTING
name = `LAND1`
IMPORTING
value = lv_land1 ).
* get single attribute
lo_el_final_node->get_attribute(
EXPORTING
name = `LOCAT`
IMPORTING
value = lv_locat ).
* get single attribute
lo_el_final_node->get_attribute(
EXPORTING
name = `TELNR`
IMPORTING
value = lv_telnr ).
* get single attribute
lo_el_final_node->get_attribute(
EXPORTING
name = `USRID`
IMPORTING
value = lv_usrid ).
DATA lv_new_pernr LIKE ls_final_node-new_pernr.
* get single attribute
lo_el_final_node->SET_attribute(
EXPORTING
name = `NEW_PERNR`
IMPORTING
value = lv_new_pernr ).
CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'
* EXPORTING
* PERNR = '00000000'
* MASSN =
* ACTIO = 'INS'
* TCLAS = 'A'
* BEGDA = SY-DATUM
* ENDDA = '99991231'
* OBJPS =
* SEQNR =
* SPRPS =
* SUBTY =
* WERKS =
* PERSG =
* PERSK =
* PLANS =
* DIALOG_MODE = '0'
* LUW_MODE = '1'
* NO_EXISTENCE_CHECK = ' '
* NO_ENQUEUE = ' '
* IMPORTING
* RETURN =
* RETURN1 =
* HR_RETURN =
TABLES
proposed_values =
* MODIFIED_KEYS =
endmethod. -
Function Module to get pernr number based on first name and last name
Hi All,
What is the Function Module to get pernr number based on first name and last name.
Could you please help me.
T@R.
Vidyahi Vidya,
you can get perner from PA0002 based on firs name and last name.
use select query and get perner.
Maybe you are looking for
-
I'm having a problem connecting my BlueRay DVD player and other non-Mac devices to my AirPort Express network. Is there a limit on the number of devices I can connect to the wireless network? I never have a problem connecting a new Apple product (Air
-
Handling unit transfer (311 move) using bapi_goodsmvt_create
MII is using bapi_goodsmvt_create to do a 311 type Handling unit movement. While BAPI is successful and returns a response back as "Delivery 80817152 created". But in ERP, this BAPI is creating a outbound delivery while it should be inbound delivery.
-
Remove Reverb from Voice Tracks in GarageBand
I am testing out the version of GarageBand that came with my iMac. I had previously been using GarageBand '09. In GB 10.0 when I add any voice track, it automatically includes this reverb that I can't get rid of. The default "audio track" has no re
-
Ok so I'm having a huge problem with when I go from lightroom to photoshop to edit it is changing the color space on my photos and is causing me a lot of headache and my photos to look muddy and the colors to be off. I know this because the photos I
-
Automatic Batch Number Creation
Dear All, is it possible to create automatic batch number creation through DI API..? tell the me the solution to create Automatic batch number.. Thanks in Advance