SAP Functions
SAP Functions
SAP Functions
ABAP_DOCU_DOWNLOAD Download ABAP documentation in HTML format.
APPL_LOG_DELETE With this function module you delete logs in the
database according to specified selection
conditions
APPL_LOG_DISPLAY With this function module you can analyze logs in
the database.
APPL_LOG_DISPLAY_INTERN With this function module you can analyze logs in
local memory, e.g. when you have only collected
log records at runtime and do not want to write to
the database.
APPL_LOG_INIT This function module checks whether the
specified object or sub-object exists and deletes
all existing associated data in local memory.
APPL_LOG_READ_DB With this function module you read the log data in
the database for an object or sub-object
according to specified selection conditions.
APPL_LOG_READ_INTERN With this function module you read all log data
whose log class has at least the specified value,
from local memory, for the specified object or
sub-object.
APPL_LOG_SET_OBJECT With this function module, you create a new
object or sub-object for writing in local memory.
With a flag you can control whether the
APPL_LOG_WRITE_... messages are written in
local memory or are output on the screen.
APPL_LOG_WRITE_DB With this function module you write all data for
the specified object or sub-object in local
memory to the database. If the log for the object
or sub-object in question is new, the log number
is returned to the calling program.
APPL_LOG_WRITE_HEADER With this function module, you write the log
header data in local memory.
APPL_LOG_WRITE_LOG_PARAMETERS With this function module, you write the name of
the log parameters and the associated values for
the specified object or sub-object in local
memory. If this function module is called
repeatedly for the same object or sub-object, the
existing parameters are updated accordingly. If
you do not specify an object or sub-object with
the call, the most recently used is assumed.
APPL_LOG_WRITE_MESSAGE_PARAMS With this function module you write a single
message, with parameters, in local memory.
Otherwise the function module works like
APPL_LOG_WRITE_SINGLE_MESSAGE.
APPL_LOG_WRITE_MESSAGES With this function module you write one or more
messages, without parameters, in local memory.
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 2 of 21
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 3 of 21
Example:
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 4 of 21
i_cdhdr = lt_cdhdr.
Example:
Example:
input = 123
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 5 of 21
output = 0000000000000...000000000000123
CONVERSION_EXIT_ALPHA_OUTPUT converts any number with zeroes right into a
simple integer
Example:
input = 00000000000123
output = 123
CONVERT_ABAPSPOOLJOB_2_PDF convert abap spool output to PDF
CONVERT_OTF Convert SAP documents (SAPScript) to other
types.
Example:
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 6 of 21
processing.
ENQUEUE_ESFUNCTION Lock an abap program so that it cannot be
executed.
Example:
Example:
data:
begin of t_values occurs 2,
value like kna1-begru,
end of t_values,
t_values = 'PAR*'.
append t_values.
t_values = 'UGG'.
append t_values.
if sy-subrc = 0.
read table t_return index 1.
o_begru-low = t_return-fieldval.
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 7 of 21
if o_begru-low = 'PAR*'.
o_begru-option = 'CP'.
else.
o_begru-option = 'EQ'.
endif.
o_begru-sign = 'I'.
Example:
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 8 of 21
include structure csdep_descr.
data: end of tdep_descr.
Function Group GRAP is now SAP recommends using functions in function group
obsolete. SFES instead. Below is an overview of the
changes.
G_SET_GET_ALL_VALUES Fetch values from a set.
GET_CURRENT_YEAR Get the current fiscal year.
Example:
GET_PAYSLIP
GUI_CREATE_DIRECTORY Create a directory on the presentation server
GUI_DELETE_FILE Replaces WS_FILE_DELETE. Delete a file on the
presentation server
GUI_DOWNLOAD Replaces WS_DOWNLOAD. Download table from
the app server to presentation server
GUI_EXEC Replaces WS_EXECUTE. Start a File or Program
Asynchronously with WinExec
GUI_GET_DESKTOP_INFO Replaces WS_QUERY. Delivers Information About
the Desktop (client)
GUI_REMOVE_DIRECTORY Delete a directory on the presentation server
GUI_RUN Start a File or Program Asynchronously with
ShellExecute
GUI_UPLOAD Replaces WS_UPLOAD. Upoad file from
presentation server to the app server
HELP_START Display help for a field. Useful for doing AT
SELECTION SCREEN ON VALUE REQUEST for those
fields that do not provide F4 help at the DDIC
level.
HELP_VALUES_GET_WITH_TABLE Show a list of possible values for F4 popup help on
selection screens. This function module pops up a
screen that is just like all the other F4 helps, so it
looks like the rest of the SAP system. Very useful
for providing dropdowns on fields that do not have
them predefined.
Example:
tables: t001w.
ltab_fields-tabname = 'T001W'.
ltab_fields-fieldname = 'NAME1'.
ltab_fields-selectflag = space.
APPEND ltab_fields.
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 10 of 21
EXPORTING
fieldname = 'WERKS'
tabname = 'T001W'
title_in_values_list = 'Select a value'
IMPORTING
select_value = lc_werks
TABLES
fields = ltab_fields
valuetab = ltab_values
EXCEPTIONS
field_not_in_ddic = 01
more_then_one_selectfield = 02
no_selectfield = 03.
HOLIDAY_CHECK_AND_GET_INFO Useful for determining whether or not a date is a
holiday. Give the function a date, and a holiday
calendar, and you can determine if the date is a
holiday by checking the parameter
HOLIDAY_FOUND.
Example:
if sy-subrc = 0 and
lc_holiday_found = 'X'.
write: / ld_date, 'is a holiday'.
else.
write: / ld_date, 'is not a holiday, or there was an error calling the function'.
endif.
HOLIDAY_GET Provides a table of all the holidays based upon a
Factory Calendar &/ Holiday Calendar.
Call the HR feature to determine the Benefit Area
HR_BEN_GET_FROM_FEATURE_BAREA for an employee
Call the HR feature to determine the Benefit
HR_BEN_GET_FROM_FEATURE_BENGR Group for an employee
Call the HR feature to determine the Benefit
HR_BEN_GET_FROM_FEATURE_BSTAT Status for an employee
Call the HR feature to determine the Cover Group
HR_BEN_GET_FROM_FEATURE_COVGR for an employee
Call the HR feature to determine the CSTV1
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 11 of 21
Example:
REPORT ZZKNB_BAPI_INFOTYPE_CALL .
start-of-selection.
IF l_bapireturn-id NE space.
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 12 of 21
WRITE: / l_p0169-pernr, 'Enqueue failed'.
exit.
ENDIF.
IF l_bapireturn-id NE space.
WRITE: / p_pernr,
20 'Create was unsuccessful',
l_bapireturn-id,
l_bapireturn-message+0(40).
ELSE.
WRITE: / p_pernr,
20 'Create was successful',
l_bapireturn-id,
l_bapireturn-message+0(40).
ENDIF.
Example:
W_BEGDA = '20010101'.
W_PERNR = '00000001'.
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 13 of 21
no_period_found = 1
no_valid_permo = 2.
CHECK sy-subrc = 0.
Example:
W_BEGDA = '20010101'.
W_PERNR = '00000001'.
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 14 of 21
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 15 of 21
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 16 of 21
Example:
write: / new_date.
text.
POPUP_TO_DISPLAY_TEXT Create a dialog box in which you display a two
line message
POPUP_TO_SELECT_MONTH Popup to choose a month
POPUP_WITH_TABLE_DISPLAY Provide a display of a table for user to select one,
with the value of the table line returned when
selected.
PRICING Return pricing conditions in an internal table. Use
structure TCOMK for parameter COMM_HEAD_1,
and structure TCOMP for parameter
COMM_ITEM_1, and set CALCULATION_TYPE to B.
The pricing conditions will be returned in XOMV.
You must fill TCOMP, and TCOMK with the
appropriate values before callling the function in
order for it to work.
PROFILE_GET Read an Entry in an INI File on the frontend
PROFILE_SET Write an Entry in an INI File on the frontend
READ_TEXT To load long text into SAP
REGISTRY_GET Read an Entry from the Registry
REGISTRY_SET Set an entry in the Registry
RFC_ABAP_INSTALL_AND_RUN Runs an ABAP program that is stored in the table
PROGRAM when the MODE = 'F'. Table WRITES
contains the ouput of the program. Allows you to
run a program without having the source code in
the target system.
get org info and put in tables suitable for
RH_DATA_COLLECTOR_ORGCHART displaying an org structure
RH_GET_ACTIVE_WF_PLVAR Return the active HR Plan
RH_GET_DATE_DAYNAME return the day based on the date provied
generic PD infotype read with authorization
RH_READ_INFTY checks
RH_START_EXCEL_WITH_DATA starts Excel with the contents of an internal
table. This function finds Excel in the desktop
registry. It also uses a local PC working directory
to save the file (that's what the 'W' value for data
path flag does). Very transparent to user!
RH_STRUC_GET Returns all related org info
RHP0_POPUP_F4_SEARK is a matchcode for any type of HR Planning
object, including the possibility to fill the field
that you want
Example:
F4 = 'X'
PLVAR = '01'
OTYPE = 'O '
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 18 of 21
F4 = 'X'
PLVAR = '01'
OTYPE = 'P '
Example:
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 19 of 21
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 20 of 21
Example:
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003
ABAP Hints and Tips - SAP Functions Page 21 of 21
file://E:\appl\ABAP\eHR2\SAP_Functions.html 12/5/2003