SAP FUNCTION ABAP Statements



Get Example source ABAP code based on a different SAP table
  


ID FUNCTION
• FUNCTION ABAP Statement

FUNCTION
Short Reference

ABAP_SYNTAX
FUNCTION func.
*'---------------------------------------------------------
*' <(>Local Interface<)>:
*' parameter_interface
*'---------------------------------------------------------
...
ENDFUNCTION.

What does it do?
Between the statements FUNCTION and ENDFUNCTION, the functionality of a function module func is implemented in a function pool. The function module and its interface are defined in the ABAP Development Tools (ADT)
BEGIN_SECTION VERSION 5 OUT or in the Function Builder tool
END_SECTION VERSION 5 OUT .
BEGIN_SECTION VERSION 5 OUT The function module interface defined in the Function Builder is automatically displayed in comment lines below the statement FUNCTION as parameter_interface.
END_SECTION VERSION 5 OUT
Within the function module, local data types and data objects can be declared. There is also access to the formal parameters of the function module and to the global data types and data objects of the function pool. A function module is called using the statement CALL FUNCTION.



Latest notes:

The predicate expression IS SUPPLIED can be used in the function module to determine whether an actual parameter has been specified for when a formal parameter is called.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Implements a function module that reads data in a table-like formal parameter flight_tab under the condition of an elementary formal parameter id. The parameter interface defined in Function Builder is visible as a comment. FUNCTION read_spfli_into_table.
*'---------------------------------------------------------
*' Local Interface:
*' IMPORTING
*' VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
*' EXPORTING
*' FLIGHT_TAB TYPE SPFLI_TAB
*'---------------------------------------------------------
SELECT *
FROM spfli
WHERE carrid = @id
INTO TABLE @flight_tab.
ENDFUNCTION.
ABAP_EXAMPLE_END

Return to menu