Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Get data from PNPCE LDB in ABAP hr

Former Member
0 Kudos

Hi all,

I am workng on ABAP Hr.In it I am using PNPCE LDB, when I

use GET PERNR statement it don't give any syntax problem but the selection screen does not generate due to GET PERNR statement.

Is there any Other statement to find the PERNR.

Points will be sured for valuable answers.

Thanks

Sanket sethi

1 ACCEPTED SOLUTION

HemendraS
Participant
0 Kudos

A report that wants to use the PNPCE must enter this in its report attributes under Logical database.

In addition, the PERNR structure must be declared in the report using the 'TABLES PERNR' statement. You can only use the PERNR structure again in certain circumstances. The use of the 'GET PERNR' event is therefore forbidden. Instead, use the 'GET PERAS' event. Except for the PERNR-PERNR component, all other components of the PERNR structure are no longer filled and have initial values. This kind of programming (with the exception of PERNR-PERNR) therefore not permitted.

In addition to the 'GET PERAS' event, you can also use the GET PERSON' and 'GET GROUP' events. To be able to use these events, you must declare them using the NODES statement (NODES PERSON', 'NODES GROUP', or. NODES PERAS'.LdB's for HR are as follows:

PA----


PNP

Payroll----


PNPCE

Recruitment -


PAP

Orgmanagement -


PCH

PA report Example in attrubutes u have to add LDB is PNPCE

REPORT ZHR_TEST.

************************************************************************

Type-Pools *

************************************************************************

TYPE-POOLS : slis.

************************************************************************

Nodes *

************************************************************************

NODES: person,group,peras.

*************************************************************************

Tables *

************************************************************************

TABLES: pernr,t512w,tfkbt,pa0022,pa0016,bkpf.

************************************************************************

Infotypes *

************************************************************************

INFOTYPES : 0000, "Actions

0001, "Org Details

0022, "Education Details

0041, "Date Specification

0002, "Personal Details

0016.

************************************************************************

Internal Tables *

************************************************************************

DATA :BEGIN OF t_output OCCURS 0,

pernr TYPE pernr_d, " Personnel No.

ename TYPE emnam, " Employee Name

btrtl TYPE btrtl, "Personnel Subarea

btext TYPE btext, "Personnel Subarea Text

persk TYPE persk, "Grade

ptext TYPE pktxt, "gradeText

END OF t_output.

DATA: t_fcat TYPE slis_t_fieldcat_alv.

*----


ALV Variable

*----


DATA : w_fieldcat TYPE slis_t_fieldcat_alv,

wa_fieldcat TYPE slis_fieldcat_alv.

************************************************************************

Event : GET Pernr *

************************************************************************

GET peras.

PERFORM read_data. "Data Selection

************************************************************************

Event : End-Of-Selection *

************************************************************************

END-OF-SELECTION.

PERFORM f_addcat. "Field Cat

PERFORM f_display. "Display

&----


*& Form read_data

&----


FORM read_data.

*Organizational Assignment

rp_provide_from_last p0001 space pn-begda pn-endda.

IF pnp-sw-found EQ 1.

t_output-pernr = p0001-pernr.

t_output-ename = p0001-ename.

t_output-btrtl = p0001-btrtl.

t_output-persk = p0001-persk.

*Personal sub area text

SELECT SINGLE btext FROM t001p

INTO t_output-btext

WHERE btrtl = t_output-btrtl.

*Grade text

SELECT SINGLE ptext FROM t503t

INTO t_output-ptext

WHERE persk = t_output-persk AND

sprsl = 'EN'.

ENDIF.

APPEND t_output.

CLEAR t_output.

ENDFORM. "

&----


*& Form f_addcat

&----


FORM f_addcat .

*************Filling field catelog here.**************

&----


*& Form f_display

&----


FORM f_display.

*Local Variable

DATA : lv_repid LIKE sy-repid,

ls_layout TYPE slis_layout_alv.

lv_repid = sy-repid.

ls_layout-zebra = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = lv_repid

is_layout = ls_layout

it_fieldcat = t_fcat

i_save = 'A'

TABLES

t_outtab = t_output

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " f_display

4 REPLIES 4

Former Member
0 Kudos

Hi,

make sure you declared the stmt

TABLES: pernr.

prerequisits of using PNPCE:

In addition, the PERNR structure must be declared in the report using the 'TABLES PERNR' statement.

The use of the 'GET PERNR' event is forbidden. Instead, use the 'GET PERAS' event.

Except for the PERNR-PERNR component, all other components of the PERNR structure are no longer filled and have initial values. This kind of programming (with the exception of PERNR-PERNR) therefore not permitted.

reward if useful,

regards,

teja.

0 Kudos

Hi Teja,

I already declare the statement;

TABLES: pernr.

The main problem occurs on selection screen generation due to GET PERNR statement.

HemendraS
Participant
0 Kudos

A report that wants to use the PNPCE must enter this in its report attributes under Logical database.

In addition, the PERNR structure must be declared in the report using the 'TABLES PERNR' statement. You can only use the PERNR structure again in certain circumstances. The use of the 'GET PERNR' event is therefore forbidden. Instead, use the 'GET PERAS' event. Except for the PERNR-PERNR component, all other components of the PERNR structure are no longer filled and have initial values. This kind of programming (with the exception of PERNR-PERNR) therefore not permitted.

In addition to the 'GET PERAS' event, you can also use the GET PERSON' and 'GET GROUP' events. To be able to use these events, you must declare them using the NODES statement (NODES PERSON', 'NODES GROUP', or. NODES PERAS'.LdB's for HR are as follows:

PA----


PNP

Payroll----


PNPCE

Recruitment -


PAP

Orgmanagement -


PCH

PA report Example in attrubutes u have to add LDB is PNPCE

REPORT ZHR_TEST.

************************************************************************

Type-Pools *

************************************************************************

TYPE-POOLS : slis.

************************************************************************

Nodes *

************************************************************************

NODES: person,group,peras.

*************************************************************************

Tables *

************************************************************************

TABLES: pernr,t512w,tfkbt,pa0022,pa0016,bkpf.

************************************************************************

Infotypes *

************************************************************************

INFOTYPES : 0000, "Actions

0001, "Org Details

0022, "Education Details

0041, "Date Specification

0002, "Personal Details

0016.

************************************************************************

Internal Tables *

************************************************************************

DATA :BEGIN OF t_output OCCURS 0,

pernr TYPE pernr_d, " Personnel No.

ename TYPE emnam, " Employee Name

btrtl TYPE btrtl, "Personnel Subarea

btext TYPE btext, "Personnel Subarea Text

persk TYPE persk, "Grade

ptext TYPE pktxt, "gradeText

END OF t_output.

DATA: t_fcat TYPE slis_t_fieldcat_alv.

*----


ALV Variable

*----


DATA : w_fieldcat TYPE slis_t_fieldcat_alv,

wa_fieldcat TYPE slis_fieldcat_alv.

************************************************************************

Event : GET Pernr *

************************************************************************

GET peras.

PERFORM read_data. "Data Selection

************************************************************************

Event : End-Of-Selection *

************************************************************************

END-OF-SELECTION.

PERFORM f_addcat. "Field Cat

PERFORM f_display. "Display

&----


*& Form read_data

&----


FORM read_data.

*Organizational Assignment

rp_provide_from_last p0001 space pn-begda pn-endda.

IF pnp-sw-found EQ 1.

t_output-pernr = p0001-pernr.

t_output-ename = p0001-ename.

t_output-btrtl = p0001-btrtl.

t_output-persk = p0001-persk.

*Personal sub area text

SELECT SINGLE btext FROM t001p

INTO t_output-btext

WHERE btrtl = t_output-btrtl.

*Grade text

SELECT SINGLE ptext FROM t503t

INTO t_output-ptext

WHERE persk = t_output-persk AND

sprsl = 'EN'.

ENDIF.

APPEND t_output.

CLEAR t_output.

ENDFORM. "

&----


*& Form f_addcat

&----


FORM f_addcat .

*************Filling field catelog here.**************

&----


*& Form f_display

&----


FORM f_display.

*Local Variable

DATA : lv_repid LIKE sy-repid,

ls_layout TYPE slis_layout_alv.

lv_repid = sy-repid.

ls_layout-zebra = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = lv_repid

is_layout = ls_layout

it_fieldcat = t_fcat

i_save = 'A'

TABLES

t_outtab = t_output

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " f_display

rainer_hbenthal
Active Contributor

Do not use table statement for PERNR/PERAS, use nodes statement.