SAP Program SAPDBPNPCE - PNPCE Logical Database: Database Program

Purpose
The PNPCE logical database supports the evaluation of HR master data. Itincludes the functions of the PNP logical database and offers additionalevaluation options. Therefore, you should use the PNPCE logical databaseinstead of the PNP logical database for all new developments.
The enhanced functionality of PNPCE in comparison to PNP essentiallyconcerns the evaluation of Concurrent Employment, that is, thepossibility to group evaluate several assignments/personnel numbers of aperson. The new events 'GET PERSON' and 'GET GROUP' as well as anenhanced syntax for the INFOTYPES statement (addition AS PERSON TABLE)for the procurement of infotype data enable you to use the newfunctionality. The use of these new functions is optional. You can run aPNPCE report that does not use the new events and the addition for theINFOTYPES statement in a PNP-compatible session. Since the PNPCE alsohas an improved selection screen, each report benefits from this even ifthe report does not use the functions for evaluating ConcurrentEmployment.

Prerequisites
A report that wants to use the PNPCE must enter this in its reportattributes under Logical database.
In addition, the PERNR structure must be declared in the report usingthe 'TABLES PERNR' statement. You can only use the PERNR structure againin certain circumstances. The use of the 'GET PERNR' event is thereforeforbidden. Instead, use the 'GET PERAS' event. Except for thePERNR-PERNR component, all other components of the PERNR structure areno longer filled and have initial values. This kind of programming (withthe exception of PERNR-PERNR) is 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 declarethem using the NODES statement ('NODES PERSON', 'NODES GROUP', or 'NODESPERAS').
Explanation of Terms
If the 'GET PERSON' and 'GET GROUP' events and the 'AS PERSON TABLE'addition for the INFOTYPES statement are not used, the report indicatesthat it does not require the functionality for evaluating ConcurrentEmployment. In this case, the report runs in a PNP-compatible session.This is referred to as PNP mode in the following documentation.On the other hand, if the report uses the functionality for evaluatingConcurrent Employment we refer to CE mode.

Features

Process of an Evaluation
The PNPCE selection screen offers you as standard a range of functionsthat you can use to restrict the personnel number and person selection.These are discussed in more detail in the following sections. Theprocess is initially as follows regardless of whether the report runs inCE or PNP mode. All available functions and selection conditions leadsto the selection of personnel numbers. If you use the sorting function,this set of personnel numbers is then sorted according to the sortcriteria you selected. In PNP mode, the GET PERAS event is triggered asa result for each personnel number.
In CE mode, the persons belonging to the personnel numbers aredetermined first for all personnel numbers selected. The GET PERSONevent is then triggered for each person. The person ID is specified inthe OBJID component of the PERSON structure. PERNR_NUM contains thetotal number of personnel assignments (= personnel numbers) that thisperson has and the ALL_PERNRS table, which contains a list of thesepersonnel numbers regardless of whether they were actually selected ornot. The SELECTED flag is set to X for the personnel numbers selected.The flag is initial for all personnel numbers that are not selected. ThePROCESS flag specifies whether the personnel number should be processedin the rest of the process. This flag is set to X by default for thepersonnel numbers selected. However, the report can set or delete thisflag at the GET PERSON event for all personnel numbers. In this way,report and logical database communicate with each other which enablesthe report to control the rest of the process.
In the next step, the logical database groups all personnel numbers of aperson that are to be processed (that is, all personnel numbers thathave the PROCESS flag set). The report can control the type of groupingusing the PNPCE_GROUPING_FROM_PAYROLL flag (normal or payroll grouping)and using the PNPGPRSN (grouping reason) and PNPGPVAL (grouping value)parameters of the selection screen. The GET GROUP event is triggered foreach group of personnel numbers determined. The GROUPING_REASON andGROUPING_VALUE components contain the grouping reason and grouping valueof this group. The number of personnel numbers that belong to this groupand that are processed subsequently is in PERNR_NUM. The includedALL_PERNR table contains a list of these personnel numbers withadditional information. The SELECTED flag specifies whether the currentpersonnel number was originally selected (flag is set) or was marked bythe report as to be processed. GROUPING_BEGDA and GROUPING_ENDDA containthe validity period that the personnel number has for this grouping. TheNO_AUTHORITY flag is set if there is insufficient authorization for apersonnel number. This personnel number is not processed further. TheSORT component defines a standard sort order for the personnel numbersof a group. The report can change this by overwriting the values. Inthis way, report and logical database communicate with each other, whichcontrols the further pr
ocessing sequence of the personnel numbers.
The GET PERAS event is then triggered for all personnel numbers of thegroup (with the exception of the personnel numbers for which noauthorization exists) in the sequence defined by the SORT component (seeabove). The SELECTED, GROUPING_BEGDA, and GROUPING_ENDDA components havethe same meaning here as with the GET GROUP event. The PROCESSED_BEFOREflag specifies whether the personnel number has already been processedonce before (it is possible that the personnel number belongs to severalgroupings and has been therefore been processed several times).
Sort Order
You can sort the list of selected personnel numbers using the Sortfunction in the application toolbar. You can choose to include up toseven fields from infotype 0001 for the sort. Since several data recordscan exist for infotype 0001 for a personnel number, you also need tospecify for period evaluations (not the case for key date evaluations)whether the sort should take place according to the values of the lastor of the first data record in the person selection period.
In PNP mode, the sorted sequence determines exactly the sequence inwhich the GET PERAS event is called. In CE mode, the sort determines thesequence in which the GET PERSON event is called. The list of persons iscreated based on the (sorted) sequence of personnel numbers. If only oneperson exist for each selected personnel number, the sequence of personscorresponds exactly to the sequence of personnel numbers. However, ifseveral selected personnel numbers lead to the same person, only thefirst personnel number determines the sort sequence of persons. Allother personnel numbers only determine the sequence in which the GETPERAS event is subsequently called. Provided that the report does notrequire the personnel numbers to be resorted by manipulating the SORTcomponent at the GET GROUP event (see above), the GET PERAS event iscalled for the personnel numbers of a person in the sequence in whichthe personnel numbers were (originally) sorted.

Retrieving Infotype Data Records
As well as triggering the GET PERSON, GET GROUP, and GET PERAS events,the logical database also provides the data records of the infotypesthat are requested using the INFOTYPES statement. In the report, youmust specify the INFOTYPES statements where the variable declarationsare made. You should do this in any case before the first code isentered.
In principle, there are three types of INFOTYPES statements:
INFOTYPES nnnn
The nnnn infotype is provided with the data records of the currentpersonnel number at the GET PERAS event. Only the data records that arein the evaluation period specified in the selection screen are provided( this is different to PNP, which provides all data records by default).Alternatively, the report can specify which data records are to beprovided using the RP_SET_DATA_INTERVAL, RP_SET_DATA_INTERVAL_INFTY, andRP_SET_DATA_INTERVAL_ALL macros.
INFOTYPES nnnn AS PERSON TABLE
The nnnn infotype is provided at the GET GROUP event with the datarecords of all personnel numbers that are in the included ALL_PERNRStable (of the GROUP structure) and for which authorization exists(NO_AUTHORITY flag is not set). Only the data records that are in theevaluation period specified in the selection screen are provided.Alternatively, the report can specify which data records are to beprovided using the RP_SET_DATA_INTERVAL, RP_SET_DATA_INTERVAL_INFTY, andRP_SET_DATA_INTERVAL_ALL macros.
INFOTYPES nnnn AS PERSON TABLE MODE P
The nnnn infotype is provided at the GET PERSON event with the datarecords of all personnel numbers that are in the included ALL_PERNRStable (of the PERSON structure). No authorization check is performed andall existing data records are provided independent of how the evaluationperiod is defined in the selection screen. The use of theRP_SET_DATA_INTERVAL, RP_SET_DATA_INTERVAL_INFTY, andRP_SET_DATA_INTERVAL_AL macros also has no influence here.

Selection Options
You can use all the functions and selection options in the selectionscreen (initially) to select personnel numbers regardless of whether thereport is running in PNP or CE mode. Only in CE mode, the personsbelonging to these personnel numbers are then determined. The functionsthat PNPCE provides to restrict the selection are described in thefollowing. The environment in which these functions are actually useddepends on the report and its report category. You can assign a reportcategory to a report in maintenance of report attributes (SE38,Attributes, Change button -> HR report category button). The customercan override this assignment. To do so, perform theAssign Report Categories Customizing activity under'Personnel Management' -> 'Human Resources Information System' ->'Reporting' -> 'Adjusting the Standard Selection Screen'. Follow thesame path to define and change report categories in theCreate Report Categories Customizing activity.Since the PNP logical database also uses the concept of reportcategories, ensure that you assign only one report category that iscreated specially for the PNPCE database to a PNPCE report.
Selection Fields of the 0000 and 0001 Infotypes
You can use all the standard fields of the 0000 and 0001 infotypes forselection. You can also use additional selection fields that are theconcatenation of two or more of these infotype fields. If possible, donot use these concatenated fields because they do not play a significantrole in the selection and can lead to long runtimes in certaincircumstances. You can show and hide the required selection fields usingthe Selection Fields function in the application toolbar. The reportcategory defines a preselection of fields that should be available.
Dynamic Selections
The dynamic selections enable you to select according to any infotypefields and, in particular, according to customer-specific infotypefields. You can show and hide the dynamic selections using the DynamicSelections function in the application toolbar. The report categorycontrols whether this appears as a dialog box or inplace, that iswhether the dynamic selections are supported at all. The basis for thedynamic selections is a selection view that defines which infotypes andwhich fields can be used for selection. You can define the selectionview in the ABAP Workbench. You must choose For any table as the type ofselection view (the For logical database type is not permitted althoughyou may have presumed differently at first). The report category is usedto control which selection view is used for the dynamic selections. Ifyou use the dynamic selections, the Restrict by OrgStructure, SearchHelp, and Selection ID functions are not available.
Restrict by OrgStructure
You can also select personnel numbers by their position in theorganizational structure. To do so, you use the OrgStructure function inthe application toolbar. This button displays the organizationalstructure. Here you can select the organizational units to which thepersonnel numbers to be selected should belong. It is insignificant ifthe personnel numbers are assigned to the selected organizational unitdirectly or to one of its subordinate organizational units. If yourestrict the selection by organizational structure, the DynamicSelections, Search Help, and Selection ID functions are not available.
Search Help
You can use the included search helps of the PREM collective search helpby clicking Search Help function in the application toolbar. You canalso add customer-specific search helps here. For a description of howto do this, see the Customizing for Personnel Management -> PersonnelAdministration -> Basic Settings -> Maintain SearchHelps. If you use a search help, the Dynamic Selections, Restrict byOrgStructure, and Selection ID functions are not available.
Selection ID
You can also restrict the number of personnel numbers to be selectedusing a predefined selection method called a Selection ID. Forinformation on how to use and create selection IDs, see theDefine Selection IDs Customizing activityunder 'Personnel Management' -> 'Human Resources Information System' ->Define Selection IDs. How youSpecify Groupings of selection IDs is alsodescribed here. The selection IDs whose grouping is stored in the reportcategory are available to you for selection on the PNPCE selectionscreen. When you select a selection ID, it is always performed. Thishappens either explicitly when you press the button (behind the selectedselection ID), or implicitly when output starts (F8). If you use aselection ID, the Dynamic Selections, Restrict by OrgStructure, andSearch Help functions are not available.
Evaluation Period
The PNPCE (and the PNP) differentiates between the data selectionperiod and the person selection period. Both these periods aresummarized in the term evaluation period. Whereas the personselection period affects the selection of personnel numbers, the dataselection period controls the retrieval of data requested by theINFOTYPES statement. You can configure both separately on the selectionscreen by selecting an appropriate entry in each list box.Alternatively, you can set up both selection periods at the same timeusing a common list box. You can control which entries are in the listboxes (that is which evaluation intervals are supported) using thereport category. The person selection period you have set up is takeninto consideration when the personnel numbers are selected. Only thepersonnel numbers are selected that fulfill the selection conditions onat least one (key) date in the specified person selection period. Alldata records of the requested infotypes that are valid on at least one(key) date in the specified data selection period are retrieved bydefault for these personnel numbers. You can set up a differentprocedure using the RP_SET_DATA_INTERVAL, RP_SET_DATA_INTERVAL_INFTY,and RP_
SET_DATA_INTERVAL_ALL macros. Retrieving data records for infotypes thatwere defined by the AS PERSON TABLE MODE P addition is an exception. Inthis case, all data records are retrieved independent of the dataselection period.
The payroll period should be considered as a special feature for theevaluation period. You can select either the current payroll period oranother payroll period. You must enter the payroll area in both cases.The evaluation period is calculated from these specifications. Thisinterval is used as evaluation period (as person selection period and asdata selection period) for the further (internal) processing.
The report can query the evaluation period used via the PN structure.The BEGDA and ENDDA contain the data selection period whereas BEGPS andENDPS contain the person selection period. Inversely, the report canalso set the data and person selection period explicitly. The reportmust also fill the relevant components of the PN structure at theSTART-OF-SELECTION event. This is only meaningful if the manualmaintenance of the evaluation period was hidden using the reportcategory.

Communication Between Report and PNPCE
The DBPNPCECOM include is an element of the PNPCE logical database. Thisis automatically included in each report that is based on PNPCE. Thecommon part defined in this include means that the report and PNPCE havea common data area. This data area enables the data exchange forcommunication between the report and PNPCE. All switches that can beused by the report to control the process of PNPCE are defined here. TheDBPNPCECOM include also contains a number of macros that PNPCE uses tomake additional functions available to the report. Most of these macroswere adopted by PNP and defined there in the DBPNPMAC include.Additional macros still exist in the TRMAC table, which has in themeanwhile become obsolete. Do not use these macros for any purpose. Youcan find all the macros defined in PNP that affect the functionality ofthe logical database in the DBPNPCECOM include. They have a slightlydifferent spelling; underscore_ instead of hyphen-, for exampleRP_PROVIDE_FROM_LAST instead of PROVIDE-FROM-LAST. Some of the TRMACmacros in the DBPNPCECOM include were redefined with the same spellingbut without the functionality so that any incorrect use (of the TRMACmacros) leads to a syntax error and is therefore excluded.
The following describes the functions made available by the switches andmacros defined in the DBPNPCECOM include. For information about theexact syntax for calling a macro in view of its parameters and typespecifications, see the definition of the macro in the DBPNPCECOMinclude.
Evaluation Period in the PN Structure
The PN structure contains information about the evaluation period forwhich the evaluation is started regardless of how this is specified onthe selection screen. A report should access the fields of the PNstructure only if it requires this information and should not access thePNPBEGDA, PNPENDDA, and other selection fields of the selection screen.
The PN-BEGPS and PN-ENDPS fields contain the person selection period forwhich the personnel number selection was performed. The PN-BEGDA andPN-ENDDA fields contain the data selection period. If you have specifiedthe evaluation period using a payroll period, PN-PABRP contains thepayroll period, PN-PABRJ the payroll year, and PN-PERMO the periodparameters. The payroll period and payroll year are also in PN-PAPER.
The report can also fill the PN-BEGDA, PN-ENDDA, PN-BEGPS, and PN-ENDPSfields with values at the START-OF-SELECTION event and in doing so,specifies the evaluation period. In cases like this, it is notmeaningful to have this setting option on the selection screen and itshould therefore be hidden using the report category. In addition, thereport must ensure that the values specified are valid since there is nolonger a validation of these values.
Setting the Data Selection Period: RP_SET_DATA_INTERVAL,RP_SET_DATA_INTERVAL_INFTY, RP_SET_DATA_INTERVAL_ALL
The report uses the INFOTYPES statement to request infotype data recordsthat are read and made available by PNPCE. The report can specify thatit only requires data records that are valid in the specified periodusing the 'VALID FROM .. TO ..' addition. Unfortunately, you cannot usethe 'VALID FROM .. TO ..' addition in most cases because it does notaccept dynamic date specification. It only accepts constants. If you donot use the 'VALID FROM .. TO ..' addition, PNPCE returns all datarecords that are in the specified data selection period on the selectionscreen by default. If this is not required, the report can call theRP_SET_DATA_INTERVAL, RP_SET_DATA_INTERVAL_INFTY, andRP_SET_DATA_INTERVAL_ALL macros to restrict the infotype data records toa different validity period. The RP_SET_DATA_INTERVAL macro sets thevalidity period for an individual infotype whose name you specify in thefirst parameter. Do not confuse the name of the infotype, P0001 orPP0001 for example, with the number of the infotype 0001. You specifythe validity period in the second and third parameters. You should usethe RP_SET_DATA_INTERVAL_INFTY macro in the same way but instead ofentering the name in the first parameter, enter the number of theinfotype. Since the same infotype can be used several times (underdifferent names) when you use the INFOTYPES additions 'AS PERSON TABLE'or 'NAME ...', this macro sets the validity period for all infotypes ofthe same number. In contrast, the RP_SET_DATA_INTERVAL_ALL macro onlyhas the validity period as a parameter and sets this for all infotypesused.
Setting the Mode of an Infotype: PNP_SET_INFTY_MODE_BY_NAME,PNP_SET_INFTY_MODE_BY_NUMBER
The INFOTYPES statement can use the MODE addition to control whether theinfotype should be processed and how this should proceed. If theaddition is not used, this corresponds to a MODE Y and the PNPCE logicaldatabase reads the infotype and places it in the internal infotypetable. MODE N enables the internal infotype table to be declared but noinfotype data records are read by the PNPCE logical database. MODE P canonly be used together with the 'AS PERSON TABLE' addition and causes allinfotype data records of all personnel numbers of a person to be read atthe GET PERSON event without authorization check or period restriction.The report can use the PNP_SET_INFTY_MODE_BY_NAME andPNP_SET_INFTY_MODE_BY_NUMBER macros to change the MODE specified by theINFOTYPES statement (dynamically) at runtime. The macros must be calledat the INITIALIZATION or START-OF-SELECTION events. ThePNP_SET_INFTY_MODE_BY_NAME macro sets the MODE for an individualinfotype whose name you specify in the first parameter. Do not confusethe name of the infotype, P0001 or PP0001 for example, with the numberof the infotype 0001 You should use the RP_SET_INFTY_MODE_BY_NUMBERmacro in the same way but instead of entering the name in the firstparameter, enter the number of the infotype. Since the same infotype canbe used several times (under different names) when you use the INFOTYPESadditions 'AS PERSON TABLE' or 'NAME ...', this macro sets the MODE forall infotypes of the same number.
Reading Time Management Infotypes: RP_READ_ALL_TIME_ITY,RP_READ_ALL_PERSON_TIME_ITY
Time management infotypes (2000-2999) often contain a large number ofdata records, particularly if positive recording is implemented. If adataset that is too large is requested using the INFOTYPES statements,this can lead to performance problems or in an extreme case, to memoryoverflow. For this reason, there are the RP_READ_ALL_TIME_ITY andRP_READ_ALL_PERSON_TIME_ITY macros, which can be used to read timemanagement data in a targeted manner. The time management infotypes aredefined by the INFOTYPES statement with the MODE N addition. Thisenables the internal infotype table to be declared but no data is read(at the moment) by the PNPCE logical database. The report can thendecide at the GET GROUP and GET PERAS events whether it wants to readthe time management data and for which period. At the GET GROUP event,the report can call the RP_READ_ALL_PERSON_TIME_ITY macro to read alltime management data on the personnel numbers of a person that should beprocessed. In other words, the time management data that is in theincluded ALL_PERNRS table of the GROUP structure. The data is thenwritten to the infotypes that were declared by the INFOTYPES statementwith the AS PERSON TABLE addition.
However, at the GET PERAS event, the report can call theRP_READ_ALL_TIME_ITY macro to read the time management data on thecurrent personnel number. In both cases, you must specify the period inwhich the data records should be valid when the macro is called. ThePNP-SW-IGNORELOCKEDRECORDS switch is also taken account of in both casesand controls whether locked data records are read or not. In addition,an authorization check is performed for all data records. If noauthorization exists for a data record, this data record is rejected(that is, it is not placed in the infotype table). If data records arerejected because of missing authorization, thePNP-SW-AUTH-SKIPPED-RECORD global switch is set to 1. This switch isotherwise set to 0.
Locked Data Records: PNP-SW-IGNORELOCKEDRECORDS
In HR master data maintenance, you can lock individual infotype datarecords. These data records are normally ignored during evaluationsusing PNPCE. If you set the PNP-SW-IGNORELOCKEDRECORDS switch to N (atthe INITIALIZATION or START-OF-SELECTION events), the report can howeverinstruct PNPCE to read locked data records too.
Authorization Check: PNP_SW_SKIP_PERNR, PNP_GET_AUTH_SKIPPED_PERNRS

The PNPCE logical database performs an authorization check for allinfotype data records that are requested by the report using theINFOTYPES statement. If no authorization exists for even one individualdata record of one of the infotypes used, processing of the personnelnumbers is terminated by default. In PNP mode, this means that the GETPERAS event (for the personnel number) is skipped. The report is onlyaware of this if it then (if possible at the END-OF-SELECTION event)calls the PNP_GET_AUTH_SKIPPED_PERNRS macro, which returns a list of theskipped personnel numbers.
In CE mode, the NO_AUTHORITY flag is set in the included ALL_PERNRStable at the GET GROUP event, which indicates to the report that noauthorization exists. The following event, GET PERAS, is also notexecuted for this personnel number. As in PNP mode, the report can get alist of the personnel numbers for which no authorization exists usingthe PNP_GET_AUTH_SKIPPED_PERNRS macro.
You can enter different settings using the PNP_SW_SKIP_PERNR switch. Ifyou set this switch (at the INITIALIZATION or START-OF-SELECTION events)to N, no more personnel numbers (without authorization) are skipped.Only the data records for which no authorization exists are rejected(that is, not made available). The report has no way of knowing thatdata records are being withheld from it.
Mass Access By Array-Fetch: PNPCE_ARRAY_FETCH_SIZE
The infotype data records are not read for each personnel numberindividually but in a mass access for several personnel numberssimultaneously. This reduces the number of database accesses andperformance can be considerably improved. You cannot read the infotypedata records of all personnel numbers at once since this can lead toproblems with memory space depending on the number of selected personnelnumbers and existing data records. For this reason, the personnelnumbers are segmented into blocks of a fixed size and the personnelnumbers of a block are always read together. The size of the block isset to 100 by default (this means that the personnel numbers from 100persons are processed at the same time). The report can change thissetting using the PNPCE_ARRAY_FETCH_SIZE switch at the INITIALIZATION orSTART-OF-SELECTION event. Be very careful if you change this value. Ifthe value is set too high, it can lead to a memory overflow. If thevalue is too low, performance is affected. You must choose a suitablevalue based on the number of requested infotypes and their expecteddatasets.
Locking Persons/Personnel Numbers
By default, the logical database does not lock any personnel numbers orpersons. However, the report can request this. In CE mode, the reportmust set the PNPCE_ENQUEUE_PERSONS switch to X. This enables the LDB toset locks for all personnel numbers of a person. The person is regardedas locked and is processed further only if all personnel numbers havebeen successfully locked. Otherwise, they are skipped. It is the reportstask to remove this lock. To do so, the report calls thePNPCE_DEQUEUE_PERSON macro by specifying the person ID. Persons thatcould not be locked and were skipped are logged by the logical database.After processing has finished, the report can query this list using thePNPCE_GET_ENQ_FAILED_PERSONS macro. However, not all persons are logged,only the first N persons. The report can find out how many this isexactly using the PNPCE_LOG_ENQ_FAILED_PERSONS switch. 1 means that allpersons should be logged. If the report calls thePNPCE_GET_ENQ_FAILED_PERSONS macro, the total number of skipped personsis returned with the first N logged persons.
In PNP mode, individual personnel numbers can be locked. The report (andPNP) must set the PNP-SW-ENQUEUPERNR switch to Y to enable this. Thereport is here also responsible for unlocking the personnel numbers andcan call the PNP_DEQUEUE_PERNR macro for this by specifying thepersonnel number. The report can get a list of the personnel numbersthat could not be locked by calling the PNP_GET_ENQ_FAILED_PERNRS macro.Only the first N personnel numbers and the total number of skippedpersonnel numbers are returned. The number of personnel numbers thatshould be logged can be specified using the PNP_LOG_ENQ_FAILED_PERNRSswitch. 1 means that all personnel numbers should be logged.
Determining the First Data Record in the Period:RP_PROVIDE_FROM_FRST
The RP_PROVIDE_FROM_FRST macro analyzes the infotype data records thatwere transferred in an internal table to the macro with regard to thespecified period. It places the first data record that is valid in thespecified period (the data record with the lowest ENDDA) in the headerof the internal table. If no data record exists in the specified period,the PNP-SW-FOUND global switch is set to 0. Otherwise it has the value1. If the infotype contains subtypes, you also need to specify thesubtype for which the last valid data record should be determined. Ifyou do not specify the subtype, the result is undefined. In addition,the data records of the internal table must be sorted according toprimary key. The data records are sorted if the data records weredetermined by PNPCE logical database using the INFOTYPES statement.Analyze the implementation of the macro if the exact functions of themacro are unclear. If in doubt, do not use the macro. Instead implementa suitable solution for the report in question.
Determining the Last Data Record in the Period: RP_PROVIDE_FROM_LAST
The RP_PROVIDE_FROM_LAST macro analyzes the infotype data records thatwere transferred in an internal table to the macro with regard to thespecified period. It places the last data record that is valid in thespecified period (the data record with the highest ENDDA) in the headerof the internal table. If no data record exists in the specified period,the PNP-SW-FOUND global switch is set to 0. Otherwise it has the value1. If the infotype contains subtypes, you also need to specify thesubtype for which the last valid data record should be determined. Ifyou do not specify the subtype, the result is undefined. In addition,the data records of the internal table must be sorted according toprimary key. The data records are sorted if the data records weredetermined by PNPCE logical database using the INFOTYPES statement. Aspecial feature of infotypes with time constraint 3 in this case is thatthe data record with the highest ENDDA is not necessarily returned, butthe first data record (if it exists) that is valid on the end date ofthe specified period. Analyze the implementation of the macro if theexact functions of the macro are unclear. If in doubt, do not use themacro. Instead implement a suitab
le solution for the report in question.
Reading Infotypes: RP_READ_INFOTYPE
The RP_READ_INFOTYPE macro reads the data records of an infotype for thespecified personnel numbers that are valid in the specified period, andwrites these to the internal table specified. This table must becompleted correctly. If no data records exist in the specified period,the PNP-SW-FOUND global switch is set to 0. Otherwise it has the value1. In addition, an authorization check is performed for all datarecords. If no authorization exists for a data record, this data recordis rejected (that is, it is not placed in the internal table). If datarecords are rejected because of missing authorization, thePNP-SW-AUTH-SKIPPED-RECORD global switch is set to 1. This switch isotherwise set to 0. The PNP-SW-IGNORELOCKEDRECORDS switch is also takenaccount of when the data records are read and controls whether lockeddata records are read or not.
Normally, infotypes are read using the HR_READ_INFOTYPE function module.The RP_READ_INFOTYPE macro can improve performance when the data recordshave already been read by PNPCE and are in the internal buffer. PNPCEonly read the data records that were requested by the report using theINFOTYPES statement. In addition, the buffer is deleted again at thelatest after 100 processed personnel numbers. If however the reportrequests the data records using an INFOTYPES statement, it is notparticularly meaningful to request the data records again for the samepersonnel number using the RP_READ_INFOTYPE macro. The buffer is onlyuseful when the data records are called for a different personnel numberif these personnel numbers belong to the block of the 100 currentbuffered personnel numbers. Always weigh up the advantages of this macroagainst the consequences of its use for performance.
Excluding Withdrawn Employees: RP_SEL_EIN_AUS_INIT
If this macro is called at the INITIALIZATION event, only personnelnumbers are selected that do not have the status withdrawn in thespecified person selection period. From a technical point of view, theselect option PNPSTAT2 (STAT2 from infotype 0000) is filled with ' 0'for this. This is a default value for the selection condition displayedon the selection screen that the user can change or delete at a laterdate.
Progress Indicator: PNPCE_NO_PROGRESS_INDICATOR,PNPCE_PROGRESS_BLOCK_SIZE
The PNPCE logical database uses the standard technique of displayingprocessing progress (process indicator). If the report wants to set upits own progress indicator or does not want to have a progress indicatordisplayed, it can switch this indicator off by setting thePNPCE_NO_PROGRESS_INDICATOR switch to X. The PNPCE_PROGRESS_BLOCK_SIZEswitch enables the report to control how often (that is, after how manyprocessed persons) the progress indicator should be updated. If theprogress indicator is updated too often, performance suffers.
Payroll Grouping: PNPCE_GROUPING_FROM_PAYROLL
If you set the switch to X, the grouping of personnel numbers (asreturned at the GET GROUP event) should be performed on the basis ofpayroll data.
Personnel Numbers Skipped Due to Error: PNP_GET_ERR_SKIPPED_PERNRS

A special logic for determining data records is implemented in PNPCE forcertain infotypes. This is performed using a function module(HR_COST_DISTRIBUTION_GET) for infotypes 0027 and 0266. In the case ofan error, the function module can trigger an exception. PNPCE reacts toan exception by terminating processing of the personnel numbers forwhich the error occurred (that is, the PUT PERAS event is nottriggered). If the report wants to know which personnel numbers wereskipped due to this error, it can call the PNP_GET_ERR_SKIPPED_PERNRSmacro.

Comments
Headers of Infotype Tables
PNPCE fills the table body with infotypes defined by INFOTYPES. It doesnot fill headers. These are initialized. Therefore, it is not permittedto program headers. This is in part different in the PNP logicaldatabase. In certain cases, the header is also filled but in many casesit is not filled. Since this depends on various factors, which, inparticular, cannot be traced or controlled by the report, you are alsonot permitted to program headers.
Infotype Administration Table $RINFO$
In the $RINFO$ table, infotypes are managed that the report definesusing the INFOTYPES statement. It is defined in the DBPNPCECOM includeso that the report also has access to this table. You are forbidden tomanually modify this table for the purpose of changing infotypecharacteristics by the report. Instead, use the macros that enable youto set the infotype characteristics (set the MODE byPNP_SET_INFTY_MODE_BY_NAME and PNP_SET_INFTY_MODE_BY_NUMBER; set thevalidity period by RP_SET_DATA_INTERVAL, RP_SET_DATA_INTERVAL_INFTY, andRP_SET_DATA_INTERVAL_ALL).
Starting a PNPCE Report Using Preselected Personnel NumberSet/Person Set
You can also start a PNPCE report using an externally predefinedpersonnel number set. You must provide the PNPINDEX parameter with therelevant personnel number when you call the report using SUBMIT. Since,technically speaking, the select option for PNPINDEX is hidden, you mustspecify the personnel numbers in a RANGE structure that consists ofSIGN, OPTION, and LOW. For each personnel number, SIGN must contain thevalue I, OPTION the value EQ, and LOW the personnel number. For SUBMIT,the range table should be transferred to PNPINDEX by the IN operator.
Example:
RANGES: pernr_index FOR pernr-pernr.
CLEAR pernr_index.
pernr_index-sign = 'I'.
pernr_index-option = 'EQ'.
pernr_index-low = '00000815'.
APPEND pernr_index.
SUBMIT pnpce_report WITH pnpindex IN pernr_index.
If a set of personnel numbers is defined in this way, you cannot use theDynamic Selections, Restrict by OrgStructure, Search Help, and SelectionID functions to (further) restrict the set of personnel numbers.However, the conditions entered for the selection fields of infotypes0000 and 0001 are taken into account.
Similarly, you can start a PNPCE report with a specified set of persons.You must provide the PNPPERID parameter with the relevant person IDswhen you call the report using SUBMIT. Unlike PNPINDEX, PNPPERID is nota range but is an internal table whose row type is the PERSONID dataelement.
Example:
DATA: personid_index TYPE STANDARD TABLE OF personid.
APPEND '00000815' TO personid_index.
SUBMIT pnpce_rerpot WITH pnpperid = personid_index.
If a set of persons is defined in this way, you cannot define a set ofpersonnel numbers (using PNPINDEX) at the same time. Also in this case,you cannot use the Dynamic Selections, Restrict by OrgStructure, SearchHelp, and Selection ID functions to (further) restrict the set ofpersonnel numbers.
Using Several Selection Options Simultaneously
In addition to selecting fields of infotypes 0000 and 0001 as describedabove, PNPCE offers six other options for selecting personnel numbers.They are selection using dynamic selections, using organizationalstructure, using search help, using selection ID, and by explicitlyspecifying a personnel number set in PNPINDEX or a person set inPNPPERID when you call the report. These six options exclude each other,that is you can only use one of these options at a time. Appropriatequeries on the selection screen attempt to ensure this. It can happen incertain cases, however, that more than one of these functions is used(for example, when you call the PNPCE report by explicitly specifying apersonnel number set in PNPINDEX as well as one of the variants to beused in which dynamic selections were also stored). In this case, onlyone function, which is the first function used, is taken into accountwith regard to the following sequence:
Dynamic Selections
Restrict by OrgStructure
Search Help
Selection ID
Explicit Specification or Personnel Numbers in PNPINDEX
Explicit Specification or Persons in PNPPERID
The personnel number set found this way is always restricted further bythe selection conditions specified in the 0000 and 0001 infotypes.

Example
PNP Mode (without functions for evaluating concurrent employment)

TABLES: PERNR.
NODES: PERAS.
INFOTYPES: 0006 NAME P0006.
GET PERAS.
* table P0006 is filled with infotype 0006 data of PERNR
* stored in PERAS-PERNR
WRITE :/ PERAS-PERNR.
...
CE Mode (with function for evaluating concurrent employment)
TABLES: PERNR.
NODES: PERSON, GROUP, PERAS.
INFOTYPES: 0001 NAME ALL_0001 AS PERSON TABLE MODE P.
INFOTYPES: 0001 NAME PP0001 AS PERSON TABLE.
INFOTYPES: 0006 NAME P0006.
GET PERSON.
* table ALL_0001 is filled with infotype 0001 data of all PERNRs
* stored in PERSON-ALL_PERNRS without authority check !!!
WRITE :/ PERSON-OBJID.
...
GET GROUP.
* table P0001 is filled with infotype 0001 data of all PERNRs
* stored in GROUP-ALL_PERNRS
WRITE :/ GROUP-GROUPING_REASON, GROUP-GROUPING_VALUE.
...
GET PERAS.
* table P0006 is filled with infotype 0006 data of PERNR
* stored in PERAS-PERNR
WRITE :/ PERAS-PERNR.
...