0% found this document useful (0 votes)
68 views

Specific Commands

Uploaded by

Gyanendra Dubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views

Specific Commands

Uploaded by

Gyanendra Dubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 14

Specific Commands

Content
 Macros
 Function Modules
Macros

 Like subroutines and function modules, macro modules can be used in HR to


modularize source code.

 These macros are defined in the program SAPDBPNP (include DBPNPMAC)


with the keyword DEFINE. They can be used in any program that uses the
logical database PNP.

 If you want to use these macros in reports that do not use the logical database
PNP, you must include program DBPNPMAC with the keyword INCLUDE.

 You can also define your own macros. In accordance with the naming
convention, the first two letters stand for the application.

 Some macros are also stored in the table Macros in ABAP Programs (TRMAC)
Macros
Macros

 The RP_PROVIDE_FROM_LAST
macro retrieves the last valid data record
in the data selection period.

 The parameters for


RP_PROVIDE_FROM_LAST are:
Infotype, subtype, start date, & end date.

 You can also process the first valid data


record using the
RP_PROVIDE_FROM_FRST macro.

 The PNP-SW-FOUND macro return


code has the value 1 if there is a
corresponding entry in the infotype table
in the specified period. It has the value 0
if no entry was found.
Macros

 Due to the large amount of data in


HR, the infotypes 2000 – 2999
should not be read when GET
PERNR occurs. Therefore, these
infotypes are declared with the
enhancement MODE N.

 As a result, the infotype tables under


GET PERNR are not filled. The
time infotype tables are filled
subsequently using the macro
RP_READ_ALL_TIME_ITY, but
only for the time interval specified
by PN-BEGDA and PN-ENDDA.
Function Modules

 You can use the standard function modules to help you process large quantities
of data. Make sure that you check whether allowed entries are not already
defined for specific functions in standard function modules.

 Most function modules in HR start with "RP" ‚"HR" and "BAPI". In


transaction SE37, select the menu Utilities -> Find. For example, if you are
looking for a function module that determines an employee's hiring date, search
for the entries the "RP*" and "HR*" in the selection criterion Function module
and "*Entry*" in the Short description field.
Function Modules

 You can also read infotype records for a


particular personnel number without
using the logical database.

 To do this, use the function module


HR_READ_INFOTYPE. However, you
must ensure that the internal table for the
required infotype is declared with the
INFOTYPE statement.

 The function module reads the HR infotype


records for a person (employee or applicant)
in accordance with the specified selection
criteria.

 The function module carries out an


authorization check.
Function Modules

 The return code can have the following values:


0: The return table contains all the records requested
4: The return table contains records, but is incomplete due to
missing authorization
8: The return table is empty as no records were found for the
criteria specified
12: The return table is empty due to missing authorization

 Note: You should not use this function module in reports that use the
logical database PNP. If you want to read an infotype separately in one
of these reports, you can call the subroutine READ-INFOTYPE
directly in the database program SAPDBPNP (PERFORM READ-
INFOTYPE(SAPDBPNP)). . .). In this case, you declare the infotypes in
the statement INFOTYPES with enhancement MODE N.
Function Modules

 You can use this function module to


determine an employee's entry date.
The following infotypes can be used
to determine this date:

1. P0000 Measures
2. P0001 Organizational assignment
3. P0016 Contract components
4. P0041 Date specifications
Function Modules

 Before you change employee data, you


must lock the personnel number. You
can do this using the function module
BAPI_EMPLOYEE_ENQUEUE.

 Messages are returned in the RETURN


parameter. If errors occur, this structure
contains the following information, for
example:
Message type (TYPE field)
Message text (MESSAGE field)

 If no errors occur, the structure is blank.

 You must therefore unlock the data after


it has been changed. You can do this
using the function module
BAPI_EMPLOYEE_DEQUEUE.
Function Modules

 You can use this function module to


maintain employee and applicant master
data. You can specify one data record

 All validations that would normally take


place if the infotypes were maintained in
dialog mode with the individual
maintenance screens are also carried out
here

 The following values are amongst those


available for the OPERATION
parameter: MOD (change), COPY
(copy), DEL (delete), INS (insert), LIS9
(delimit).
Function Modules

 You can use the UPDATE statement.


Note that the system does not check
whether the new field contents are
correct when a direct database update
takes place.

 The SY-DBCNT system field contains


the number of changed records

 Authorization checks are not


supported by the UPDATE
statement and should be carried out
at the program level.
Function Modules

 Authorization checks are not


supported by the SELECT statement
and must therefore be executed at
the program level.

 In this case, you must use the


function module
HR_CHECK_AUTHORITY_INF
TY to check whether the user has
the required authorization for data
and persons.

 SAP recommends that you use the


logical database PNP as it
automatically runs authorization
checks.
Function Modules
DATA :LIT_PBWLA TYPE TABLE OF PBWLA

CALL FUNCTION 'RP_FILL_WAGE_TYPE_TABLE' Indirect Valuation:


EXPORTING
BEGDA = IT_FINAL-FPBEG
ENDDA = IT_FINAL-FPEND Some times entries in Infotype 0008,
INFTY = '0008' 0014, 0015
PERNR = IT_FINAL-PERNR
SUBTY = ' ‘ etc are stored for indirect valuation (ie the
wagetype has
TABLES to be valuated indirectly). The entries
PPBWLA = LIT_PBWLA
will not be stored in the infotype tables.
EXCEPTIONS We have to use any of the function
ERROR_AT_INDIRECT_EVALUATION = 1 modules for indirect
OTHERS = 2.
valuation to read the data.
IF SY-SUBRC <> 0.

ENDIF.

You might also like