HR Application Log © 2012 SAP Page 1 HR Application Log
HR Application Log
© 2012 SAP Page 2
Copyright
No part of this brochure may be reproduced or transmitted in any form or for
any purpose without the express permission of SAP AG. The information
contained herein may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain
proprietary software components of other software vendors.
Microsoft®, WINDOWS®, NT®, EXCEL®, Word® and SQL Server® are
registered trademarks of Microsoft Corporation.
IBM®, DB2®, OS/2®, DB2/6000®, Parallel Sysplex®, MVS/ESA®, RS/6000®,
AIX®, S/390®, AS/400®, OS/390®, and OS/400® are registered trademarks of
IBM Corporation.
ORACLE® is a registered trademark of ORACLE Corporation, California, USA.
INFORMIX®-OnLine for SAP is a registered trademark of Informix Software
Incorporated.
UNIX®, X/Open®, OSF/1®, and Motif® are registered trademarks of The Open
Group.
HTML, DHTML, XML, XHTML are trademarks or registered trademarks of
W3C®, World Wide Web Consortium, Laboratory for Computer Science NE43-
358, Massachusetts Institute of Technology, 545 Technology Square,
Cambridge, MA 02139.
JAVA® is a registered trademark of Sun Microssystems, Inc. , 901 San
Antonio Road, Palo Alto, CA 94303 USA.
JAVASCRIPT® is a registered trademark of Sun Microsystems, Inc., used
under license for technology invented and implemented by Netscape.
SAP, SAP Logo, mySAP.com, mySAP.com Marketplace, mySAP.com
Workplace, mySAP.com Business Scenarios, mySAP.com Application Hosting,
WebFlow, R/2, R/3, RIVA, ABAP, SAP Business Workflow, SAP EarlyWatch,
SAP ArchiveLink, BAPI, SAPPHIRE, Management Cockpit, SEM, are trademarks
or registered trademarks of SAP AG in Germany and in several other countries
all over the world. All other products mentioned are trademarks or registered
trademarks of their respective companies.
HR Application Log
© 2012 SAP Page 3
Contents
1. Objective and Scope ................................................................................................................... 4
1.1 Introduction ........................................................................................................................... 4
1.1.1 Glossary .......................................................................................................................... 5
1.2 Technical Details ................................................................................................................... 6
1.2.1Function Modules ............................................................................................................ 6
1.2.2 Service Class................................................................................................................. 29
1.2.3 Accessibility to new report selection screen ................................................................. 36
1.3 Implementation in Detail with an example ......................................................................... 38
1.3.1 Convert existing report into HR application Log report............................................... 38
1.3.2 Sample Implementation ................................................................................................ 46
1.3.3 Test Scenario ................................................................................................................ 59
HR Application Log
© 2012 SAP Page 4
1. Objective and Scope
1.1 Introduction
HR Application Log is application which generates the end-result of report in a standardized
way. This tool generates end-result in navigation tree (nodes and leaf). The HR Application Log
is a set of function modules which enhance the look and feel of every HR application.
This application will produce an “Accessible” log enabling visually challenged people to
navigate output screen easily using special tools1.
After converting old report output into HR Application Log report output will look like as below.
Figure 1: Report output without and with HR Application log
Integration of HR Application Log with the existing applications can be achieved by using
existing set of function modules and classes. These function modules belong to the function
group HRPADPAL00.
1 For more information on accessibility, visit:
http://help.sap.com/saphelp_nw70/helpdata/en/fd/7c4a41edf0db2be10000000a1550b0/content.htm http://www.sapdesignguild.org/editions/edition9/print_leading_article.asp
Without HR Application Log With HR Application Log
HR Application Log
© 2012 SAP Page 5
SAP Version Support:
HR Application Log is available from SAP release 4.6C onwards.
1.1.1 Glossary Node: A node is the basic element of a tree. It can contain data or can be left empty. A node can
contain other nodes under it, creating a tree like structure.
Category: A category defines the type of the node. One category can be used for multiple nodes
which are of same type. Each node must have a category.
Data: The data is displayed in a node. The way in which the data is rendered in a node depends
on category of the node. It could be tabular, message or single value, in a pre-defined structure
that is associated with the category.
1.1.1.1 Where to use HR Application Log
For new reports, you can consider HR Application Log based output instead of traditional
output technologies like ABAP List or ALV grid display. It is easier to implement and
provides better look and feel.
You can also consider converting output of existing reports to HR Application Log based
output if required. This could be due to requirement to support accessibility, or to achieve
a more standardized look and feel across reports of your solution.
1.1.1.2 Basic steps to create HR Application Log report
1. Create category C1 of type any structure.
2. Create a node N1 of category C1.
3. Add the rows (data) to the node N1.
4. Display node N1.
HR Application Log
© 2012 SAP Page 6
1.2 Technical Details This tool is composed of function modules, class methods and tables. All function modules are
grouped into HRPADPAL00 function group. These function modules are used to create or
convert existing report into HR Application Log report.
Class CL_HR99B_PAL is service class which reduces complexity of developing report output
using HR Application Log. The methods of this class call multiple function modules in a
sequential manner thus ensuring that the sequence of function modules is correct. The following
are the added functionalities that the methods provide: -
(1) Creating node level variants
(2) Switching between reports and transactions at runtime
(3) Hiding/showing fields on selection screen.
TERPSOFTSWITCHES and T599V tables are used for accessibility of old and new reports
based on country grouping.
1.2.1Function Modules Function modules used for HR Application Log belongs to HRPADPAL00 function group which
contains the following function modules:
Sr. No. Function Module
1 HR_PAL_CREATE_NODE_CATEG
2 HR_PAL_NODE_ADD
3 HR_PAL_NODE_ADD_ROW
4 HR_PAL_NODE_MSG_ADD
5 HR_PAL_PERNR_MSG_ADD
6 HR_PAL_STATS_MSG_ADD
7 HR_PAL_STATS_STANDARD_MSG_ADD
8 HR_PAL_LOG_DISPLAY
9 HR_PAL_LOG_AND_ALV_DISPLAY
10 HR_PAL_LOG_REFRESH
11 HR_PAL_CATEG_GET_ROWS
12 HR_PAL_NODE_GET
13 HR_PAL_PERNR_GET_SACHN
14 HR_PAL_EPERN_MSG_ADD
15 HR_PAL_FORMS_ROW_ADD
16 HR_PAL_GENRL_MSG_ADD
17 HR_PAL_GET_MSG_FIELDCAT
18 HR_PAL_TABLE_CREATE_COLUMN
19 HR_PAL_CATEG_MSG_ADD
20 HR_PAL_CREATE_LOG_CATEG
HR Application Log
© 2012 SAP Page 7
1.2.1.1 Categories of function modules
Segregate function modules into three categories:
1. Primary function modules
These function modules are required to create any type of log tree, and hence offers the bare
minimum functionality that makes up application log output.
2. Basic function modules
These function modules provide the basic functionality like creating nodes and adding records in
the log tree.
3. Additional function modules
These function modules provide common functionalities on log output. For example statistics,
messages with and without personal number, and so on. The functionality that these function
modules provide can also be recreated with the use of basic function modules mentioned above.
1.2.1.2 Brief introduction about function modules
1. HR_PAL_CREATE_NODE_CATEG
Category: Primary function module
Mandatory import parameter:
I_CATEG_ID (Category ID) - the name of the category you are creating
Functionality:
This function module enables you to create category for HR Application log. This function
module is of mandatory use. It has to be used in order to create any type of LOG TREE.
Create one category per type of row of data that you have to display. To create a category you
can use either a data dictionary (DDIC) structure or a field catalog created in the code.
There are some predefined categories you can use: PERNR, STATS, GENRL, %MSGS. You
will need category to create nodes.
Following are some important parameters which needs to be considered:
I_CATEG_ID (mandatory field) is the name of the category you are creating
I_STRUCTURE_NAME (optional field): name of the DDIC structure that defines the
structure of the rows of data
HR Application Log
© 2012 SAP Page 8
IT_FIELDCAT (optional field): field catalog that defines the structure of the rows of
data. Use either this parameter or the I_STRUCTURE_NAME
I_CLBK (optional field): defines the call-back program and routine to call in case of a
button click
IS_PUSHBUTTONS (optional field): defines the buttons to add to the AVL header
2. HR_PAL_NODE_ADD
Category: Basic function module
Mandatory import parameter:
I_RELATKEY (HR application protocol) - the parent node‟s node_key or if it is first
node then mention 'ROOT'.
I_NODE_TXT (Node text) - node text/ name.
Functionality:
This function module enables you to create node for the category. It has to be used in order to
create nodes of LOG TREE.
You can create multiple nodes of one category. To create node it is necessary to pass category,
which is either created, or is predefined e.g. PERNR, STATS, %MSGS.
If predefined category names are passed to create node then respective categories will get created
using function module 'HR_PAL_CREATE_NODE_CATEG'.
If you don‟t pass category name (I_CATEG_ID) category will get created using function module
'HR_PAL_CREATE_NODE_CATEG' and one row will be added with the same name of node
i.e. value passed to „I_NODE_TXT‟ parameter.
For creating node „I_RELATKEY‟ and „I_NODE_TXT‟ parameters need to be passed and
related node index number will get in „E_NODE_KEY‟ parameter.
Following are some important parameters which need to be considered:
I_RELATKEY (mandatory field): name of the parent node on the tree. Use “ROOT” if
the node is the first added to the log tree.
I_NODE_TXT (mandatory field): text that will be shown in the log for this node
I_ICON (optional field): icon that will represent the node in the tree
I_CATEG_ID (optional field): If the node will contain data, then the name of the
category describing the type of the data to be shown must be given in this parameter.
E_NODE_KEY (optional field): reference to the created node. It is necessary to add rows
of data to it or to add children nodes.
HR Application Log
© 2012 SAP Page 9
3. HR_PAL_NODE_ADD_ROW
Category: Basic function module
Mandatory import parameter:
I_NODE_KEY (HR application protocol) - pass the parent node‟s node_key or if it is first node
then mention 'ROOT'.
I_ROW_DATA – pass record that needs to be added in node.
Functionality:
This function module enables you to add records to existing node.
To add records to existing node you need to pass record one at a time as this function module
will not accept multiple records i.e. internal table at a time.
It will find node key details like node text, parent node, and node category
It will take your records and pass it to function module 'HR_99S_COPY_STRUC1_STRUC2'.
Following are some important parameters which needs to be consider,
I_NODE_KEY (mandatory field): node to which you want to add the row of data
I_ROW_DATA (mandatory field): the line of data you want to add. It must be of the
same type as the used to create the category of the NODE I_NODE_KEY.
4. HR_PAL_NODE_MSG_ADD
Category: Additional function module
Mandatory import parameter:
I_NODE_KEY (HR application protocol) – pass message node name
I_MSGID (Message Class) – pass message class
I_MSGNO (Message number) – pass message number
Functionality:
This function module enables you to add messages to message node.
We need to pass node key, message id, and message no.
It will call function module 'HR_PAL_NODE_ADD_ROW' to add messages into given node.
HR Application Log
© 2012 SAP Page 10
If message used here has extended text associated, then additional info button appears along with
message in the message node. Message type (error, warning etc.) will propagate from the
children nodes to the parent node.
Figure 2: Message node with messages
Following are some important parameters which need to be considered:
I_NODE_KEY: the node to which you want to add the message. This node must be of
category MSGS.
I_MSGID: The message class id, this indicator denotes the application area to which the
error message belongs.
I_MSGTY: The message type: E for Error, W for Warning. Default message type is 'E'.
I_MSGNO: The message number within his class
I_MSGV1..4: Texts for the message. The text for each parameter can‟t be longer than 50
characters.
5. HR_PAL_PERNR_MSG_ADD
Category: Additional function module
Mandatory import parameter:
I_PERNR (Personnel Number) – pass personnel number
I_MSGID (Message Class) – pass message class
I_MSGNO (Message number) – pass message number
Functionality:
This function module enables you to add specifically employee related messages to message
node.
HR Application Log
© 2012 SAP Page 11
The interface is the same as the one of the HR_PAL_MSG_ADD but with the additional
parameter I_PERNR to indicate the personal number associated to the message.
We need to pass PERNR, Message id, and message no.
If node_key is not provided then first it will check table ‘T799L30’ for an entry for structure of
category 'PERNR' and calling program. If it exists, then assigns that structure to
'l_structure_name' and uses this structure to create „PERNR‟ category.
Then it will call function module 'HR_PAL_CREATE_NODE_CATEG' to create 'PERNR'
category then it will call 'HR_PAL_NODE_ADD' to create node of category 'PERNR'.
Figure 3: Flow of function module code execution if node_key is not provided
Now finally it will call function module 'HR_PAL_NODE_MSG_ADD' to add message in node.
If used message has an extended text, then additional info button appears along with message in
the message node.
The message type (error, warning etc.) will propagate from the children nodes to their father
node.
Figure 4: PERNR message node along with person specific message
HR Application Log
© 2012 SAP Page 12
Following are some important parameters which need to be considered:
I_NODE_KEY: the node to which you want to add the message.
I_MSGTY: The message type: E for error, W for warning. Default message type is 'E'.
I_MSGV1..4: Text for the message.
6. HR_PAL_STATS_MSG_ADD
Category: Additional function module
Mandatory import parameter:
I_MSGID (Message Class) – pass message class
I_MSGNO (Message number) – pass message number
Functionality:
This function module enables you to add a simple statistical message to message node.
Advantage of this function module is we can pass custom text messages to the node.
function module 'BAL_DSP_ICON_MSGTY_READ' to get the symbol for message.
I_MSGID and I_MSGNO are the mandatory fields. And default message type is „S‟. Along with
these parameters to provide count, number is passed to „I_STCNT‟.
If node_key is provided it will call 'HR_PAL_NODE_ADD_ROW' and add message to node
else it will create the category and call function 'HR_PAL_NODE_ADD' to create node. Then it
will call 'HR_PAL_NODE_ADD_ROW' to add rows into it.
Following are some important parameters which need to be considered:
I_STCNT: is the number to be displayed on the statistics log.
I_NODE_KEY: the related node may be either the ROOT node or of category „STATS‟
I_MSGTY: (message type) default value is „S‟.
HR Application Log
© 2012 SAP Page 13
Figure 5: Static messages along with count
7. HR_PAL_STATS_STANDARD_MSG_ADD
Category: Additional function module
Mandatory import parameter:
I_SELECTED_EE (number of selected employees) – pass the count for selected
employees
I_SUCCESSFUL_EE (number of successfully processed employees) - pass the count for
successfully processed employees
HR Application Log
© 2012 SAP Page 14
I_ERRONEOUS_EE (number of rejected employees) - pass the count for rejected
employees.
Functionality:
This function module enables you to show count against standard messages.
The standard statistics includes the number of selected employees, the number of processed
employees, the number of successfully processed employees and the number of rejected
employees.
It will accept count for I_SELECTED_EE, I_SUCCESSFUL_EE and I_ERRONEOUS_EE and
calculates I_PROCESSED_EE (processed employee count).
This will call function module 'HR_PAL_STATS_MSG_ADD' for selected employees,
processed employees, successfully processed employees and rejected employees.
Figure 6: Standard messages along with count
8. HR_PAL_LOG_DISPLAY
HR Application Log
© 2012 SAP Page 15
Category: Additional function modules
Mandatory import parameter: -
Functionality:
This function module used to display end result into log tree structure or in flat structure.
Use this function module when you have completed construction of the log tree. No
modifications to the log tree are allowed after call to this function.
To show end result in flat structure set the parameter I_S_DISPLAY_PROFILE-FLAT = „X‟
else keep it blank.
To show log tree on left side of screen, set parameter I_S_DISPLAY_PROFILE -
TREE_ONTOP = „N‟ or to show log tree on top of screen keep it blank.
Following are the optional input parameters:
I_S_DISPLAY_PROFILE (display profile HR application protocol)
I_S_FLAT_PROFILE (display profile "flat" output HR application protocol)
Log appears as a tree or
as an ALV plain text
Display profile defines
how log is rendered
HR Application Log
© 2012 SAP Page 18
Buttons to appear on the top of the screen
Figure 8: Showing buttons for node created
9. HR_PAL_LOG_AND_ALV_DISPLAY
Category: Additional function modules
Mandatory import parameter:
T_OUTTAB (Table with data to be displayed) – pass the internal table to show it in ALV format.
Functionality:
This function module is used to display the end result of report into log tree structure or in flat
structure. If you have any ALV table data to be displayed then that can also be displayed in a
separate screen. This function module will provide button to „switch between the ALV
output and Application log based output.
Use this function module when you have finished the construction of the log tree. No
modifications to the log tree are allowed after call to this function module.
This function module calls 'HR_PAL_LOG_DISPLAY' and 'REUSE_ALV_GRID_DISPLAY‟
internally.
Following are some important parameters which need to be considered:
I_S_DISPLAY_PROFILE: how the output should be rendered, either plain AVL or tree
format
HR Application Log
© 2012 SAP Page 19
I_S_FLAT_PROFILE: how the output should be rendered in case of plain ALV format is
selected
I_CALLBACK_PROGRAM: the program is executed whenever a button is pushed.
I_GRID_TITLE: title of the ALV containing the data
IT_FIELDCAT: field catalog describing the structure of the ALV. You can use this
instead the parameter I_STRUCTURE_NAME if you have a DDIC structure to define
the structure of the ALV.
IS_LAYOUT: general properties for all the fields of the ALV of the layout.
Figure 9: Showing ALV table
HR Application Log
© 2012 SAP Page 20
Figure 10: Showing log tree
10. HR_PAL_LOG_REFRESH
Category: Additional function modules
Mandatory import parameter: -
Functionality:
HR_PAL_LOG_REFRESH is used to refresh global variables in the HR application log
(HRPADPAL00). This is used to delete all the nodes and all the information added to the log. It
has three importing parameter namely, I_WITH_ERR_AND_STAT_LIST, I_KEEP_CATEG
and I_CLEAR_ALL.
By default I_WITH_ERR_AND_STAT_LIST is „TRUE‟ and I_KEEP_CATEG and
I_CLEAR_ALL are „FALSE‟.
if i_keep_categ = false then it will refresh global variable „g_t_log_categs‟ else not.
if i_with_err_and_stat_list = false then it will refresh global variable „g_convert_done‟.
if i_clear_all = true then it will clear global variables.
This function module has a very limited use since deleting a log output to render a different log
is not a common requirement.
HR Application Log
© 2012 SAP Page 21
11. HR_PAL_CATEG_GET_ROWS
Category: Additional function modules
Mandatory import parameter:
I_CATEG_ID (Category ID) – pass the category id
Functionality:
This function module is used to get the records stored in any category.
This function module takes the category as importing parameter and returns a table with all the
records belongs to that category.
Note:
I_CATEG_ID: category from which you want to read the lines of the log.
E_TABLE_ROWS: table which is used to store the records of given category.
12. HR_PAL_NODE_GET
Category: Additional function modules
Mandatory import parameter: -
Functionality:
This function module will return node_key (node level and node number) that is node‟s position
in the Log tree.
Node name is passed to parameter „IV_NODE_NAME‟, it will check this name with node text
and node label and return „EV_NODE_KEY‟ with node level and node number.
HR Application Log
© 2012 SAP Page 22
Example -
Figure 11: Log tree
Here 5th node has „IV_NODE_NAME‟ = „Child Node 3‟ and has „EV_NODE_KEY‟ = 02 5,
where 02 represents node level and 5 is node no.
You can use this „node_key‟ to expand or select node.
13. HR_PAL_PERNR_GET_SACHN
Category: Additional function modules
Mandatory import parameter:
P_PERNR (personnel number) – pass personnel number
P_DATE – pass the current date of the application server
Functionality:
It takes PERNR and date as input parameters and it checks „Administrator Group‟ and
„Administrator‟ from infotype 0001 (Org. Assignment) for given PERNR. Using this data it
provides „Name of administrator‟ from table „T526‟.
An administrator group combines all administrators who are responsible for one organizational
area in personnel administration or recruitment.
The payroll administrator is responsible for the employees assigned to him or her. You can use
this for authorization checks.
HR Application Log
© 2012 SAP Page 23
14. HR_PAL_EPERN_MSG_ADD
Category: Additional function modules
Mandatory import parameter:
I_PERNR (personnel number) – pass personnel number
I_ENAME (Formatted name of the employee or applicant) – pass name of employee
I_MSGID (Message Class) – pass message class
I_MSGNO (Message number) – pass message number
Functionality:
'HR_PAL_EPERN_MSG_ADD' is same as function module „HR_PAL_PERNR_MSG_ADD‟
except in this ENAME is mandatory to pass.
Default I_MSGTY is „E‟. I_PERNR_FIRST is „X‟ it means PERNR be shown in first column.
First time it will call „HR_PAL_CREATE_NODE_CATEG‟ and 'HR_PAL_NODE_ADD' to
create category and node respectively.
And finally it will call function module 'HR_PAL_NODE_MSG_ADD' to add message to node.
This method will show message along with employee number and employee name.
Figure 12: Person specific message
15. HR_PAL_FORMS_ROW_ADD
Category: Additional function modules
Mandatory import parameter:
I_NAME (Form description) – pass the form description
I_FORM_TYPE – Pass the form type like PDF, OTF (for sap script)
I_TEXT (Form name) – pass the form name
Functionality:
HR Application Log
© 2012 SAP Page 24
This will take form name, form text and form type as mandatory import parameters I_NAME,
I_FORM_TYPE, I_TEXT. I_RQID is optional parameter used to mention spool request no.
And export parameter is E_FORMS_NODE_KEY.
This function module displays the details of forms created using HR Application Log. Like
output form type, name of output form and spool no. generated by print functionality.
This will be used in the reports where requirement is to display output in formats like PDF or
SAP script etc. For PDF form use I_FORM_TYPE = „PDF‟ and for SAP script form
I_FORM_TYPE = „OTF‟.
The following function modules are called for the first time to create category and node:
1. 'REUSE_ALV_FIELDCATALOG_MERGE'
2. 'HR_PAL_CREATE_NODE_CATEG'
3. 'HR_PAL_NODE_ADD'
4. 'HR_PAL_NODE_ADD_ROW'.
Example:
CALL FUNCTION 'HR_PAL_FORMS_ROW_ADD'
EXPORTING
* i_node_key =
i_name = ‘Employee Org. Assignment details’
i_form_type = ‘PDF’
i_text = ‘HR_IN_P001_PDF’
i_rqid = lv_rqid “Spool-Nummer
EXCEPTIONS
OTHERS = 9.
Figure 13: Node showing forms created
16. HR_PAL_GENRL_MSG_ADD
Category: Additional function modules
Mandatory import parameter:
I_MSGID – pass message class
I_MSGNO – pass message number
Functionality:
HR Application Log
© 2012 SAP Page 25
I_NODE_KEY is optional parameter. So if we don‟t send node key this function module will
call 'HR_PAL_CREATE_NODE_CATEG' and 'HR_PAL_NODE_ADD' function modules to
create „GENRL‟ category and node respectively.
Then it will call function module 'HR_PAL_NODE_MSG_ADD' by passing newly created
node_key and input parameters to HR_PAL_GENRL_MSG_ADD.
I_MSGTY default value 'E'.
Example:
Figure 14: General message node
17. HR_PAL_GET_MSG_FIELDCAT
Category: Additional function modules
Mandatory import parameter: -
Functionality:
To create a category you can use either a DDIC structure or a field catalog defined in the code.
This function module is used to create field catalog for the category of message type. Once field
catalog is created, use the name of this field catalog to create a category.
Note that „macro_add_fields‟ is used to define fields. Field names are show in below image.
Figure 15: Field names used for creation of message field category
HR Application Log
© 2012 SAP Page 26
In general, to create node from the field catalog, function modules are called in following
sequence.
CALL FUNCTION 'HR_PAL_GET_MSG_FIELDCAT'
IMPORTING
e_fieldcat = e_fieldcat.
CALL FUNCTION 'HR_PAL_CREATE_NODE_CATEG'
EXPORTING
i_categ_id = c_cat_id
it_fieldcat = e_fieldcat
EXCEPTIONS
program_error = 1
OTHERS = 2.
CALL FUNCTION 'HR_PAL_NODE_ADD'
EXPORTING
i_relatkey = 'ROOT'
i_node_txt = „Error_node‟
i_categ_id = c_cat_id
IMPORTING
e_node_key = g_errors_node
EXCEPTIONS
program_error = 1
OTHERS = 2.
HR Application Log
© 2012 SAP Page 27
18. HR_PAL_TABLE_CREATE_COLUMN
Category: Additional function modules
Mandatory import parameter:
I_FIELDNAME (Field name) – pass the field name that has to be created as a column in
log table.
I_ROLLNAME (Data element) – pass data element of the above mentioned field.
Functionality:
IT_FIELDCAT – pass the internal table of type „SLIS_T_FIELDCAT_ALV‟.
To create a category you can use either a DDIC structure or a field catalog. This function module
is used to create a field catalog. Once field catalog is created use the name of this field catalog to
create category.
The function module takes field name and data element as mandatory import parameters along
with other optional parameters. It will add these fields into internal table IT_FIELDCAT. Use
this internal table as field catalog for calling function module
'HR_PAL_CREATE_NODE_CATEG'. Function module 'HR_PAL_CREATE_NODE_CATEG'
is used to create category. Latter nodes can now be created and rows can be added to the node.
Example
call function 'HR_PAL_TABLE_CREATE_COLUMN'
exporting
i_fieldname = 'CONTDESC'
i_rollname = 'TEXT32'
I_SELTEXT_M = 'Contrato' “Contract
CHANGING
IT_FIELDCAT = l_temse_fcat.
call function 'HR_PAL_TABLE_CREATE_COLUMN'
exporting
i_fieldname = 'BEGDA'
i_rollname = 'BEGDA'
CHANGING
IT_FIELDCAT = l_temse_fcat.
call function 'HR_PAL_TABLE_CREATE_COLUMN'
exporting
i_fieldname = 'ENDDA'
i_rollname = 'ENDDA'
CHANGING
IT_FIELDCAT = l_temse_fcat.
HR Application Log
© 2012 SAP Page 28
call function 'HR_PAL_CREATE_NODE_CATEG'
exporting
i_categ_id = 'OK'
IT_FIELDCAT = l_temse_fcat
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
Figure 16: Node output
19. HR_PAL_CATEG_MSG_ADD - Obsolete function module
20. HR_PAL_CREATE_LOG_CATEG - Obsolete function module
HR Application Log
© 2012 SAP Page 29
1.2.2 Service Class The service class CL_HR99B_PAL encompasses functionality of this application. This class
contains 23 methods. It helps for easy and fast implementation of HR Application Log.
It is also used for accessibility switch to toggle between old and new selection screens.
Accessibility switch: Sometimes it is found that end user has developed new report from the
existing report and requirement is to support access of new as well as old report. Now with the
new report, at times selection screen of report is also changed. To access new selection screen or
switch back to old selection screen, HR Application log provides accessibility mode. This
accessibility mode facilitates the switch- active/inactive functionality.
List of methods is as below.
Sr. no. Method Name Description
1 CONSTRUCTOR Initialization for PAL-categories
2 USE_PAL_LOG Use the PAL-log
3 IS_LIST_ACTIVE Check if the switch ERP_ALL_LISTS is active
4 CREATE_GENRL_MSG Create a general message from SY in message list
5 CREATE_PERNR_MSG Create a person related message from SY in message list
6 CREATE_PERNR_NODE_INFO Create a person related node with additional info
7 DISPLAY Display the log
8 ADD_GENRL_MSG_TO_NODE Add list of general messages to PAL-node
9 ADD_PERNR_MSG_TO_NODE Add list of person related messages to PAL-node
10 ADD_ROWS_TO_NODE Add rows to a PAL-table node
11 CREATE_ALL_CATEGORIES Create all categories (except standards like Statistics,...)
12 SET_ALV_VARIANT Set the ALV-variant
13 SWITCH_REPORT Switch to other report depending on the switch status
14 SWITCH_TRANSACTION Switch to other transaction depending on the switch status
15 DEFINE_CATEGORIES Initialization for PAL-categories
16 SET_CATEGORY_PUSH_BUTTON Set pushbutton for a table category
17 MSGTY_FOUND Message types found?
18 MESSAGE_STRING_INTO_SYMSG Maps a message string to dummy message BL (001).
19 MESSAGE_TEXT_INTO_SYMSG Maps a message string to dummy message BL (001).
20 MESSAGE_WORDS_INTO_SYMSG Maps a message string to dummy message BL (001)
21 SWITCH_FIELDS_OFF Switch screen fields for List-Output OFF if switch inactive
22 TEST Method only for test situations
23 TEST_CREATE_NODES_FOR_ALL_CAT Create all categories (except standards like Statistics,...)
HR Application Log
© 2012 SAP Page 30
Important class attribute:
g_erp_all_lists: by-default it is ABAP_FALSE.
This attribute is used as basis for deciding whether accessibility to new report‟s selection screen
functionality needs to be used or not. This will be decided on values set in tables
„TERPSOFTSWITCHES‟ and „T599V‟.
This attribute (g_erp_all_lists) gets set in CONSTRUCTOR method.
1.2.2.1 Brief introduction about class methods
1. CONSTRUCTOR
This method sets the value of attribute „me->g_erp_all_lists‟. Based on value passed to importing
parameter „p_use_switch‟ it sets value of attribute „me->g_erp_all_lists‟.
If p_use_switch = „X‟ then it will call function module is_list_active() to set value of „me-
>g_erp_all_lists‟ else it will set me->g_erp_all_lists = „X‟ (abap_true).
If switch is ON (i.e. CHECK me->g_erp_all_lists EQ abap_true.) then it will create node
category for all tables/structures.
abap_true means „X‟ and abap_false means blank.
2. USE_PAL_LOG
This method is used to assign the value of class attribute „g_erp_all_lists‟ to „p_reply„.
p_reply = me->g_erp_all_lists.
3. IS_LIST_ACTIVE
This is static method. This method calls method cl_erp_switch_check=>is_list_active() to check
entry of field „IS_ACTIVE‟ in table „TERPSOFTSWITCHES‟ for given group_id and
subgroup_id.
Also this method calls method „test‟ to check user-exception per country and to check user-
exception per sub-application in table „T599V‟.
And then it will return value for „r_is_active‟, which will have value either blank (abap_false) or
„X‟ (abap_true).
4. CREATE_GENRL_MSG
Use this method to send message information that is stored in the system-variables to
the new list output. That is to pass list of system messages into message variable me-
>g_i_msg_genrl.
HR Application Log
© 2012 SAP Page 31
It will pass messages to me->g_i_msg_genrl only when switch is ON (i.e. CHECK me-
>use_pal_log( ) EQ abap_true). Method use_pal_log is used to check the value of me-
>g_erp_all_lists.
5. CREATE_PERNR_MSG
This method is used to pass PERNR related list of system messages into message variable me-
>g_i_msg_pernr.
6. CREATE_PERNR_NODE_INFO
This method is used to create a person related node with additional information. If category id
and PERNR data is provided then it adds that data to the created node.
This method will execute only when switch is ON (i.e. CHECK me-
>use_pal_log( ) EQ abap_true). Method use_pal_log is used to check the value of me-
>g_erp_all_lists.
7. DISPLAY
This method is used to display the log.
This method will execute only when switch is ON (i.e. CHECK me->g_erp_all_lists EQ
abap_true).
8. ADD_GENRL_MSG_TO_NODE
This method is used to add list of general messages to PAL-node. This method loops at attribute
„g_i_msg_genrl' and add general messages to node by calling function module
'HR_PAL_GENRL_MSG_ADD'.
This method will execute only when switch is ON (i.e. CHECK me->g_erp_all_lists EQ
abap_true).
9. ADD_PERNR_MSG_TO_NODE
This method is used to add list of person related messages to node. This method loops at attribute
„g_i_msg_pernr‟ and add messages to node by calling function module
HR_PAL_PERNR_MSG_ADD'.
This method will execute only when switch is ON (CHECK me->g_erp_all_lists EQ abap_true).
10. ADD_ROWS_TO_NODE
HR Application Log
© 2012 SAP Page 32
This method is used to add rows to a PAL-table node. This method will take node key and
internal table „p_table‟ containing all records of particular node. Then it will loop at „p_table‟
and add rows to node by calling function module 'HR_PAL_NODE_ADD_ROW'.
This method will execute only when switch is ON (CHECK me->g_erp_all_lists EQ abap_true).
11. CREATE_ALL_CATEGORIES
This method is used to create node categories for all tables/structures. However, there are some
predefined categories like PERNR, STATS, GENRL, %MSGS.
This method loops at me->g_i_pal_created_categ and call function module
'HR_PAL_CREATE_NODE_CATEG' to create categories.
Category ID & Structure names are passed to function module to create individual categories.
This method will execute only when switch is ON (CHECK me->g_erp_all_lists EQ abap_true).
12. SET_ALV_VARIANT
This is used to set variant for the output ALV table. These variants user can create their own as
per their requirement (e.g. - no. of column to be displayed) and then pass it to parameter
„p_variant‟.
Example-
if ( pn-paper(4) lt 2007 ).
obj_pal_log->set_alv_variant(
p_categ_id = c_pal_categids-ae_headline
p_variant = c_before2007 ).
else.
obj_pal_log->set_alv_variant(
p_categ_id = c_pal_categids-ae_headline
p_variant = c_current ).
endif.
13. SWITCH_REPORT
This method is used to switch to other report. Depending on the switch status, switch to another
report.
It will check switch is ON or OFF for current program using method „is_list_active‟ and then it
will call reports which are passed. So selection screen and output layout will be different.
Example-
HR Application Log
© 2012 SAP Page 33
Inside method „SWITCH_REPORT‟ -
IF is_list_active( p_molga = p_molga p_appl = p_appl ) EQ abap_true.
l_parid_rid = p_switch_on_report. “one report name
ELSE.
l_parid_rid = p_switch_off_report. “another report name
ENDIF.
14. SWITCH_TRANSACTION
Switch to other transaction depending on the switch status.
In this method two transactions are passed to parameter „p_switch_on_tcode‟ and
„p_switch_off_tcode‟.
This method will call function module „is_list_active‟ to check switch value. Based on whether
switch is ON or OFF it will call the transaction.
So in this way toggle between two selection screens and output layouts is supported. This can be
shown as below, IF is_list_active( p_molga = p_molga p_appl = p_appl ) EQ abap_true.
l_tcode = p_switch_on_tcode.
ELSE.
l_tcode = p_switch_off_tcode.
ENDIF.
And then this method will check whether this „transaction code‟ is present in table ‘TSTS’ or not.
If it is present then it will call given transaction else not.
15. DEFINE_CATEGORIES
This method is used for the initialization node categories.
It will take parameters 'p_alv_structure_names' and 'p_pal_categ_ids' as importing parameters
and fill the internal table 'me->g_i_pal_created_categ'.
'p_alv_structure_names' will have list of structure names and 'p_pal_categ_ids' will have list of
category id names. 'me->g_i_pal_created_categ' will hold the list of category ids along with their
structure which will be used later to create categories.
16. SET_CATEGORY_PUSH_BUTTON
This is used to set pushbutton for a table category.
Pass category_id, buttons properties and 'P_ROWMARK' to this method. This is used so we can
select multiple lines from table and can execute any event on those selected lines (like display,
edit etc.).
HR Application Log
© 2012 SAP Page 34
Example-
obj_pal_log->set_category_push_button(
p_categ_id = c_pal_categids-ae_csib
p_push1 = l_w_cat_push1
p_push2 = l_w_cat_push2
p_rowmark = abap_true ).
As shown below we can select multiple rows and then click on display button to show those
records in more details.
Figure 17: Display records of multiple rows
17. MSGTY_FOUND
This method used to check is there any message exist with message type 'A' or 'X' in
me->g_i_msg_genrl (general messages list) and me->g_i_msg_pernr (personal messages list).
If such message type found then it abap_true (i.e.„X‟)to parameter p_found.
18. MESSAGE_STRING_INTO_SYMSG
This method accepts message string and it will assign this string to the variable „l_sentence „.
It will condense the given string for better formatting and pass it to „l_sentence‟.
It will divide the given message into four parts each of 50 characters, so maximum length that
will get stored in variable „l_sentence‟ is 200 characters. Later on this variable will be used to
show the message. You can pass message type. Default message type is „E‟ (Error).
HR Application Log
© 2012 SAP Page 35
19. MESSAGE_TEXT_INTO_SYMSG
This method works same as above mentioned method „MESSAGE_STRING_INTO_SYMSG‟
except it accepts 10 input messages instead of single string. Then it assigns them to the variable
„l_sentence „.
It will condense the given string for better formatting and pass it to „l_sentence „.
Maximum length that will get stored in variable „l_sentence‟ is 200 characters. Later on this
variable will be used to show the message. You can pass message type or default message type is
„E‟ (Error).
20. MESSAGE_WORDS_INTO_SYMSG (absolute)
This method works same as above mentioned method „MESSAGE_STRING_INTO_SYMSG‟
except it accepts internal table „p_msg_words‟ which contains messages instead of single string.
You can pass message type or default message type is „E‟ (Error). This is obsolete method.
21. SWITCH_FIELDS_OFF
This method is used to while working on switch ON-OFF mode functionality of reports. This has
been explained in next topic „Accessibility to new report selection screen‟.
This method is used to switch screen fields for List-Output OFF if switch inactive.
To make fields invisible pass abap_false(blank value) to parameter 'p_if_is_active'. So it will call
method cl_hr99b_pal=>is_list_active() to check entries in table „TERPSOFTSWITCHES‟ and
„T599V‟ whether switch is on or off.
22. TEST
This method is called inside method „IS_LIST_ACTIVE‟.
This method checks the table „T599V‟ for user-exception per sub-application and user-exception
per country. This check will be done for accessibility to report‟s selection screen purpose.
23. TEST_CREATE_NODES_FOR_ALL_CAT
This method creates nodes and structures for all defined and created CATEG_IDs.
You can use it to create standard ALV-variants for each CATEG_ID. The call of this
method will be removed before releasing the request.
HR Application Log
© 2012 SAP Page 36
1.2.3 Accessibility to new report selection screen Accessibility switch is used to toggle between new selection screen and old selection screen of
the report. This accessibility mode facilitates the switch- active or inactive functionality. This
can be achieved by using following two tables namely. TERPSOFTSWITCHES and T599V.
This accessibility can be achieved by using above mentioned service class CL_HR99B_PAL.
SWITCH_FIELDS_OFF method is used to check the entries in table TERPSOFTSWITCHES and
T599V and then switch between old and new selection screen.
1. Soft Switches for PDF-based Forms (TERPSOFTSWITCHES)
In this table we maintain entry for GROUP_ID, SUBGROUP_ID and IS_ACTIVE fields.
In class CL_HR99B_PAL default value of GROUP_ID is set to „ALLISTS' and SUBGROUP_ID
is set to 'HCM&1'. Where „&1‟ gets replaced by country ISO code (for India = „IN‟, Australia =
„AU‟).
Example: If you are working on report for Australia (country ISO code = AU). For HR
Application log make entry in this table as GROUP_ID = „ALLISTS‟ and SUBGROUP_ID =
„HCMAU‟ or „HCMAU_BSQ1‟ where „IN‟ is country ISO code and „BSQ1‟ is application
name.
Assign IS_ACTIVE = „Y‟ to show new report screen and assign IS_ACTIVE = „N‟ to show old
report screen.
Figure 18: Table TERPSOFTSWITCHES
‘ALLISTS’ is standard format defined for HR Application log.
This is combination of 'HCM&1' or 'HCM&1_&2‟
where &1 is „country ISO code‟
and &2 is application name.
This is used to decide whether to display new report selection screen or not.
HR Application Log
© 2012 SAP Page 37
2. Universal HR Tables (T599V)
In this table we maintain entry for field „A‟ and „F‟.
Make an entry in field „A‟ as – ‟SW/group_id/subgroup_id/sy-uname‟
where for „HR Application Log‟ default group_id = „ALLISTS‟ and subgroup_id = 'HCM&1‟ or
'HCM&1_&2‟ where „&1‟ is country ISO code and „&2‟ is application name.
Example: „SW/ALLISTS/HCMIN/JOHN‟ or „SW/ALLISTS/HCMAU_BSQ1/JOHN‟. Here
„&1‟ is country ISO code, „&2‟ is application name and „&3‟ is sy-uname. So change of the
selection screen is based on user id.
Make an entry in field „F‟ as „+‟ to show new report screen and „-‟or blank to show old report
screen.
Figure 19: Table T599V
SWITCH_FIELDS_OFF method of class „CL_HR99B_PAL’ is used to hide fields of report‟s
selection screen as mentioned in „Brief introduction about class methods‟ section.
SAP Version Support:
Accessibility of new report screen is available from SAP release ECC 6.0 enhancement pack 4.
Specific pattern is mentioned as SW/group_id/subgroup_id/sy-uname ‘+’ to show new report screen and ‘-’
or blank to show old report screen
HR Application Log
© 2012 SAP Page 38
1.3 Implementation in Detail with an example
1.3.1 Convert existing report into HR application Log report
Customization-
Here are the steps to convert an output done with writes to an output done with the HR
Application Log.
1. Output analysis
The output must be analysed to find the independent parts to be converted with the HR
Application Log
Figure 20: Existing report output done with writes
Statistics
Error messages
One employee data
Table to display one type of information of the employee
Table to display another type of information of the employee
HR Application Log
© 2012 SAP Page 39
2. Identify data structures
If the output contains tables, a DDIC structure will be needed to display the same data in the HR
Application Log.
The identified data structures will be created in the DDIC.
Note:
The field labels of the data elements will be shown in the log, so, take into account that if there is
no data element with texts according to the log, new data elements must be created.
The naming convention must be taken into account when creating new structures or data
elements.
Figure 21: Identify data structures
3. Create the Categories
This is the first step that requires code changes.
To create a new category, call the function module HR_PAL_CREATE_NODE_CATEG once
per each table type that you have to display.
HR Application Log
© 2012 SAP Page 40
Figure 22: Function module ‘HR_PAL_CREATE_NODE_CATEG’
Name of the category you are creating
Name of the data structures that you just created
HR Application Log
© 2012 SAP Page 41
4. Add the statistics
In this step add the statistics if there are any, and call the function module
HR_PAL_STATS_MSG_ADD.
Figure 23: Function module HR_PAL_STATS_MSG_ADD
5. Create the node with the rejected employees
Normally (but don‟t take this as the rule) the error messages are stored in a global internal table
called ERROR.
To add an error message to the log, create first a node to contain the error messages and then add
the error messages.
It is very important to create the text elements for
each used label. If that is not done, check man errors
will appear.
Message id and
message number
HR Application Log
© 2012 SAP Page 42
Figure 24: Function module HR_PAL_NODE_ADD
Hint: If you create the error node as a global variable, then you can use it anywhere in the code
of the program to add an error message wherever it is.
6. Create a node for each employee
Each employee data should have its own node. In the case that the data to be shown of each
employee is divided into several different tables, then it is mandatory that you create a node for
the employee. The employees from which you show data can be grouped anyway you want,
adding them to an existing node or directly to the ROOT node.
Key of the error
messages node.
This is the node
where the errors
table will be
append!!
Instead of adding
the errors to the
global list, they
are added to the
errors node
HR Application Log
© 2012 SAP Page 43
Figure 25: Function module HR_PAL_NODE_ADD
7. Add the data of the employees
If the data to be displayed of each employee is only a table, then the data can be added to the
employee node directly provided the employee node has the right category.
If the data of each employee is grouped in several tables, one additional node for each table
needs to be created.
HR Application Log
© 2012 SAP Page 44
Figure 26: Function module HR_PAL_NODE_ADD_ROW
8. Display the LOG
Render the log on the screen. This is the last step.
Show the log only after it has been completely built. If you add anything to the log after having
displayed it the changes done will not be shown.
Use „HR_PAL_LOG_DISPLAY‟ or „HR_PAL_LOG_AND_ALV_DISPLAY‟ function module
to display log.
Figure 27: Function module HR_PAL_LOG_DISPLAY
Create the node to contain the data. Note
that the used CATEGORY is the
corresponding to the DDIC type created in
step 2.
Those operations have to be performed for EACH
line of data to be displayed in the table. First create
the row of data and then add it to the node.
HR Application Log
© 2012 SAP Page 45
9. Clean up the code (Optional)
When converting a report, all the code used to write the old log in the screen must be
commented, otherwise after displaying the new log on the screen, the old one will be shown.
You can delete all the codes that you have commented in a converted report since they are of no
use. The resulting program is smaller and easier to understand.
HR Application Log
© 2012 SAP Page 46
1.3.2 Sample Implementation This sample program displays report in Flat output structure and in HR Application Log output
with ALV table option.
TYPE-POOLS: slis.
PARAMETERS flat as CHECKBOX. ”Flat structure output
PARAMETERS P_ALV_1 AS CHECKBOX. ”ALV Table
PARAMETERS ontop AS CHECKBOX. ”Show Log Tree On-Top
DATA: selected_node type hrpad_pal_node_key,
expanded_nodes type hrpad_pal_disp_prof-expanded_nodes.
DATA: lt_pa0001 type table of PA0001,
lt_pa0001_row type PA0001.
PERFORM build_log CHANGING selected_node expanded_nodes.
PERFORM display_log USING selected_node expanded_nodes.
*&---------------------------------------------------------------------*
*& Form BUILD_LOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_SELECTED_NODE text
* <--P_EXPANDED_NODE text
*----------------------------------------------------------------------*
FORM BUILD_LOG CHANGING SELECTED_NODE
expanded_nodes type hrpad_pal_disp_prof-expanded_nodes.
DATA: p_node_msg type hrpad_pal_node_key,
p_node_msg_1 type hrpad_pal_node_key.
DATA: p_node_data type hrpad_pal_node_key,
p_node_data_1 type hrpad_pal_node_key.
CALL FUNCTION 'HR_PAL_CREATE_NODE_CATEG'
EXPORTING
I_CATEG_ID = 'MSG1'
* I_STRUCTURE_NAME =
I_WITH_MSG_FIELDS = 'X'
* IV_SORTED =
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.
HR Application Log
© 2012 SAP Page 47
** Category for showing table data.
data: l_sort type slis_t_sortinfo_alv with header line.
data: l_pushbuttons type hrpad_pal_s_pushbuttons.
l_sort-fieldname = 'PERNR'.
l_sort-tabname = 'PA0001'.
l_sort-down = 'X'.
append l_sort.
l_pushbuttons-cat_push1-active = 'X'.
l_pushbuttons-cat_push1-position = 1.
l_pushbuttons-cat_push1-def-text = 'ALL'.
l_pushbuttons-cat_push1-clbk-userexitp = sy-repid.
l_pushbuttons-cat_push1-clbk-userexitf = 'LIST_PUSHBUTTON_CLBK'.
l_pushbuttons-cat_push2-active = 'X'.
l_pushbuttons-cat_push2-position = 2.
l_pushbuttons-cat_push2-def-text = 'ONLY SELECTED'.
l_pushbuttons-cat_push2-clbk-userexitp = sy-repid.
l_pushbuttons-cat_push2-clbk-userexitf = 'MARK_PUSHBUTTON_CLBK'.
l_pushbuttons-cat_push3-active = 'X'.
l_pushbuttons-cat_push3-position = 3.
l_pushbuttons-cat_push3-def-text = 'ALL2'.
l_pushbuttons-cat_push3-clbk-userexitp = sy-repid.
l_pushbuttons-cat_push3-clbk-userexitf = 'LIST_PUSHBUTTON_CLBK2'.
CALL FUNCTION 'HR_PAL_CREATE_NODE_CATEG'
EXPORTING
I_CATEG_ID = 'DATA1'
I_STRUCTURE_NAME = 'PA0001' " 'STR_PA0001'
IT_SORT = l_sort[]
is_pushbuttons = l_pushbuttons
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.
CALL FUNCTION 'HR_PAL_NODE_ADD'
EXPORTING
I_RELATKEY = 'ROOT'
I_NODE_TXT = 'Message Node'
* I_NODE_LABEL =
HR Application Log
© 2012 SAP Page 48
* I_LABEL_IS_QINFO =
* I_ICON =
I_EXPAND = 'X'
IMPORTING
E_NODE_KEY = p_node_msg
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2 .
append p_node_msg to expanded_nodes.
CALL FUNCTION 'HR_PAL_NODE_ADD'
EXPORTING
I_RELATKEY = p_node_msg
I_NODE_TXT = 'Child Message Node'
* I_NODE_LABEL =
* I_LABEL_IS_QINFO =
* I_ICON =
* I_QUICKINFO =
I_CATEG_ID = 'MSG1'
IMPORTING
E_NODE_KEY = p_node_msg_1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
data: msgv1 type sy-msgv1.
data msgv2 type sy-msgv1.
msgv1 = 'This is error message added to message node.' .
CALL FUNCTION 'HR_PAL_NODE_MSG_ADD'
EXPORTING
I_NODE_KEY = p_node_msg_1
I_MSGID = 'BL'
I_MSGTY = 'E'
I_MSGNO = '001'
I_MSGV1 = msgv1
* I_MSGV2 =
* I_MSGV3 =
* I_MSGV4 =
* I_CONTEXT =
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2 .
CALL FUNCTION 'HR_PAL_NODE_ADD'
EXPORTING
HR Application Log
© 2012 SAP Page 49
I_RELATKEY = p_node_msg
I_NODE_TXT = 'Data Node'
* I_NODE_LABEL =
* I_LABEL_IS_QINFO =
* I_ICON =
* I_QUICKINFO =
I_CATEG_ID = 'DATA1'
IMPORTING
E_NODE_KEY = p_node_data_1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2 .
SELECT * FROM pa0001 into TABLE lt_pa0001 up to 10 rows.
loop at lt_pa0001 into lt_pa0001_row.
CALL FUNCTION 'HR_PAL_NODE_ADD_ROW'
EXPORTING
I_NODE_KEY = p_node_data_1
I_ROW_DATA = lt_pa0001_row
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2 .
endloop.
PERFORM add_form_node.
PERFORM show_stats_msg_node.
PERFORM show_std_msg_node.
ENDFORM. " BUILD_LOG
*&---------------------------------------------------------------------*
*& Form DISPLAY_LOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_SELECTED_NODE text
* -->P_EXPANDED_NODES text
*----------------------------------------------------------------------*
FORM DISPLAY_LOG USING SELECTED_NODE
EXPANDED_NODES .
DATA l_display_profile type hrpad_pal_disp_prof.
l_display_profile-title = sy-title.
l_display_profile-flat = flat.
HR Application Log
© 2012 SAP Page 50
l_display_profile-selected_node = selected_node.
l_display_profile-expanded_nodes = expanded_nodes.
l_display_profile-alv_first = p_alv_1.
DATA: lt_pa01 type table of PA0001.
if ontop is INITIAL.
l_display_profile-TREE_ONTOP = 'N'.
endif.
IF flat is INITIAL.
IF p_alv_1 = 'X'. "If true display ALV table and then in Log.
DATA lt_fieldcat type SLIS_T_FIELDCAT_ALV.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
* I_INTERNAL_TABNAME =
I_STRUCTURE_NAME = 'PA0001'
* I_INCLNAME =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = lt_fieldcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'HR_PAL_LOG_AND_ALV_DISPLAY'
EXPORTING
I_S_DISPLAY_PROFILE = l_display_profile
* IS_LAYOUT =
IT_FIELDCAT = lt_fieldcat
* IV_ALV_BUTTON =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = lt_pa0001
EXCEPTIONS
PROGRAM_ERROR = 1
HR Application Log
© 2012 SAP Page 51
OTHERS = 2 .
else.
CALL FUNCTION 'HR_PAL_LOG_DISPLAY' "display output only in Log
EXPORTING
I_S_DISPLAY_PROFILE = l_display_profile
* I_S_FLAT_PROFILE =
EXCEPTIONS
PROGRAM_ERROR = 1
NO_LOGS = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ELSE. "display output only in Flat
CALL FUNCTION 'HR_PAL_LOG_DISPLAY'
EXPORTING
I_S_DISPLAY_PROFILE = l_display_profile
* I_S_FLAT_PROFILE =
EXCEPTIONS
PROGRAM_ERROR = 1
NO_LOGS = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDFORM. " DISPLAY_LOG
*&---------------------------------------------------------------------*
*& Form ADD_FORM_NODE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
HR Application Log
© 2012 SAP Page 52
FORM ADD_FORM_NODE .
call function 'HR_PAL_FORMS_ROW_ADD'
exporting
* I_NODE_KEY =
i_name = 'HR_ES_TC01_0001'
i_form_type = 'PDF'
i_text = 'TC1'
* IMPORTING
* E_FORMS_NODE_KEY =
* 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.
call function 'HR_PAL_FORMS_ROW_ADD'
exporting
* I_NODE_KEY =
i_name = 'Text OTF File' " 'HR_ES_TC01_0002'
i_form_type = 'OTF'
i_text = 'TC2'
i_rqid = '0123456789'
* IMPORTING
* E_FORMS_NODE_KEY =
* 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. " ADD_FORM_NODE
*&---------------------------------------------------------------------*
*& Form SHOW_STD_MSG_NODE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM SHOW_STD_MSG_NODE .
HR Application Log
© 2012 SAP Page 53
DATA p_node_data_10 type HRPAD_PAL_NODE_KEY.
* In this 'persons processed' will be calculated based on the addition of 'I_
SUCCESSFUL_EE' and 'I_ERRONEOUS_EE'.
CALL FUNCTION 'HR_PAL_STATS_STANDARD_MSG_ADD'
EXPORTING
I_SELECTED_EE = 20
I_SUCCESSFUL_EE = 8
I_ERRONEOUS_EE = 2
IMPORTING
E_STATS_NODE_KEY = p_node_data_10
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. " SHOW_STD_MSG_NODE
*&--------------------------------------------------------------------*
*& Form SHOW_STATS_MSG_NODE
*&--------------------------------------------------------------------*
FORM SHOW_STATS_MSG_NODE .
data p_stats_node type hrpad_pal_node_key.
data: l_msgv1 type sy-msgv1.
l_msgv1 = 'Custom statistic message'.
CALL FUNCTION 'HR_PAL_STATS_MSG_ADD'
EXPORTING
* I_NODE_KEY =
I_STCNT = 2
I_MSGID = 'BL'
* I_MSGTY = 'S'
I_MSGNO = '001'
I_MSGV1 = l_msgv1
* I_MSGV2 =
* I_MSGV3 =
* I_MSGV4 =
IMPORTING
E_STATS_NODE_KEY = p_stats_node
EXCEPTIONS
PROGRAM_ERROR = 1
HR Application Log
© 2012 SAP Page 54
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.
l_msgv1 = 'Second custom statistic message'.
CALL FUNCTION 'HR_PAL_STATS_MSG_ADD'
EXPORTING
* I_NODE_KEY =
I_STCNT = 6
I_MSGID = 'BL'
* I_MSGTY = 'S'
I_MSGNO = '001'
I_MSGV1 = l_msgv1
* I_MSGV2 =
* I_MSGV3 =
* I_MSGV4 =
IMPORTING
E_STATS_NODE_KEY = p_stats_node
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. " SHOW_STATS_MSG_NODE
*&--------------------------------------------------------------------*
*& Form mark_pushbutton_clbk
*&--------------------------------------------------------------------*
form mark_pushbutton_clbk using
p_var_tab type table
changing
c_s_state type bal_s_cbuc.
data: wa_pa0001 type pa0001.
read table p_var_tab into wa_pa0001 index c_s_state-list_tabix .
if sy-subrc = 0.
message id 'RP' type 'I' number '016'
with 'You have selected employee' wa_pa0001-pernr.
endif.
HR Application Log
© 2012 SAP Page 55
endform. "mark_pushbutton_clbk
*&--------------------------------------------------------------------*
*& Form LIST_PUSHBUTTON_CLBK
*&--------------------------------------------------------------------*
form LIST_PUSHBUTTON_CLBK using
p_var_tab type table
changing
c_s_state type bal_s_cbuc.
data: wa_pa0001 type pa0001.
loop at p_var_tab into wa_pa0001.
message id 'RP' type 'I' number '016'
with 'You have selected employee' wa_pa0001-pernr.
endloop.
endform.
Selection Screen-
Figure 28: Selection Screen
HR Application Log
© 2012 SAP Page 56
Log output-
Figure 28: Log output in tree structure
ALV Table output-
Figure 29: ALV Table
HR Application Log
© 2012 SAP Page 58
Some Important points:-
During the conversion of the reports, several data structures and data elements will be
created. To keep the system clean and coherent with the existing functionality, a
naming convention has to be adopted.
Each data structure or data element to be created will follow the naming convention
PXX_YYYYY. Here, XX stands for the ISO code of the country and YYYYY refers to a name
that you specify.
Example: PES_PAMNT is a data element for SPAIN (ES) to contain a paid amount.
The development class (package) for the newly created objects will be the same as the
one in the report for which the objects have been created.
Example: if the data element PES_PAMNT is created for the report RPCTYES and the
development class of the report RPCTYES is the PB04 then the development class for the data
element PES_PAMNT must be also PB04.
HR Application Log
© 2012 SAP Page 59
1.3.3 Test Scenario This test scenario is only for accessibility testing. To toggle between the old and new selection
screen, use the TERPSOFTSWITCHES and T599V tables.
You can change the selection screen of the report by changing the values of the table.
Sr. no.
TERPSOFTSWITCHES- IS_ACTIVE T599V-F Report‟s selection screen shown
1 No entry No entry New (Hide fields of old form )
2 Y No entry New (Hide fields of old form )
N No entry Old (Hide fields of new form)
3 No entry + New (Hide fields of old form )
Blank, - Old (Hide fields of new form)
4 Y / N + New (Hide fields of old form )
Y / N Blank, - Old (Hide fields of new form)
Code inside method „SWITCH_FIELDS_OFF‟ to hide the fields of report‟s selection screen is as
below.
METHOD switch_fields_off.
IF cl_hr99b_pal=>is_list_active(
p_molga = p_molga
p_appl = p_appl
) NE p_if_is_active.
LOOP AT SCREEN.
IF screen-group1 CP p_modif_id.
screen-active = '0'.
screen-request = '0'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDMETHOD.
Here „p_if_is_active‟ is boolean variable, „p_molga‟ is country grouping, „p_appl‟ is sub
application name and „p_modif_id‟ is the field group of the fields which we want to hide. Like
„p_modif_id‟ = „SWF‟.