SAP PROCEDURE PARAM ABEXA

Get Example source ABAP code based on a different SAP table
  


ARTIClE

Passing Parameters
The example demonstrates the difference between passing a parameter in a procedure by value or by reference.

ABAP_SOURCE_CODE
ABAP_EXEC

ABAP_DESCRIPTION
Method fibb calculates the sequence term with number range of a Fibonacci sequence using the start values x and y . As a rule, the next sequence term is always the total of two previous sequence terms (therefore two start values). The method takes the parameters, a structured parameter l_line used to pass the input values, and a parameter r of type i used to output the result. Since the parameter l_line is defined as an IMPORTING parameter but still has to be changed in the method, the method definition must contain the keyword value before the parameter; otherwise a syntax error occurs. This ensures that within the method a local copy of the parameter is used. The addition value to the output parameter r has the effect that the result is assigned to the static class attribute res only after the method has been processed completely. Otherwise res would be changed in each single step of the algorithm.
The internal table param contains the input values for calculating three different sequence terms of the Fibonacci sequence. Method fill_table is used to fill param with values, and method solve_table is used to calculate and output fibb for each line of param.