Ansicht
Dokumentation

ABENPASS_LITERAL_AS_ACTPAR - PASS LITERAL AS ACTPAR

ABENPASS_LITERAL_AS_ACTPAR - PASS LITERAL AS ACTPAR

Addresses (Business Address Services)   General Data in Customer Master  
This documentation is copyright by SAP AG.
SAP E-Book

Literals as Actual Parameters in FORM Routine Calls, Function Modules and Methods with Typed Formal Parameters

If formal parameters are typed, the system usually checks the types very strictly for type, length, and number of decimal places (for type P).

Since ABAP only has two types of literals - text literals and numeric literals, the type check is less strict when literals as actual parameters are passed as to typed formal parameters.

If there are tolerable type differences, the actual parameter literal is placed in a field with the type of the formal parameter using MOVE. The system also ensures that no information is lost when the literal is passed. This means that it may impose more restrictions than the MOVE logic itself (since data may be lost due to truncation, rounding and other factors when you use MOVE).

The following rules apply to literal passing (where "ActPar" stands for "Actual parameter" and "FormPar" stands for "Formal parameter":

Passing text literals

  1. Type C: OK when
  • Length (ActPar) <= Length (FormPar)

  1. Type D: OK when
  • Length (ActPar) = Length (FormPar) (that is, 8)

  1. Type T: OK when
  • Lenght (ActPar) = Length (FormPar) (that is, 6)

  1. Type N: OK when
  • Length (ActPar) <= Length (FormPar) AND

  • ActPar contains only the (decimal) digits 0 - 9.

  1. Type X: OK when
  • Length (ActPar) <= 2* Length (FormPar) AND

  • ActPar contains only the hexadecimal digits 0 -9 and A - F.

  1. Type F: Ok when
  • "MOVE ActPar TO FormPar" OK

  1. Type P: OK when
  • "MOVE ActPar TO FormPar" is OK AND

  • Fixed-point arithmetic on:
    Decimal places (ActPar) <= Decimal places (FormPar)
    Fixed-point arithmetic off:
    Decimal places (ActPar) = Decimal places (FormPar) OR
    ActPar = "0"

  1. Type I: OK when
  • "MOVE AktPar TO FormPar" is OK AND

  • Decimal places (ActPar) = 0

  1. Type XSEQUENCE: OK when
  • AktPar contains only hexadecimal numbers "0" to "9" and "A" to "F".

  1. Type NUMERIC: OK when
  • ActPar can be interpreted as a decimal number, that is, the literal contains only the numbers "0" to "9" and possibly a sign and a decimal point.

  1. Structures, internal tables and references: Error.

Passing numeric literals to:

  1. Type C: Error
  2. Type D: Error
  3. Type T: Error
  4. Type N: OK when
  • ActPar is not negative AND

  • Number of digits (ActPar) <= Length (FormPar)

  1. Type X: Error
  2. Type F: OK when
  • "MOVE AktPar TO FormPar" is OK

  1. Type P: OK when
  • "MOVE AktPar TO FormPar" is OK AND

  • Fixed-point arithmetic on:
    OK
    Fixed-point arithmetic off:
    Decimal places (FormPar) = 0 OR
    ActPar = 0

  1. Type I: OK when
  • "MOVE ActPar TO FormPar" is OK

  1. Type CLIKE: Error
  2. Type CSEQUENCE: Error
  3. Type XSEQUENCE: Error
  4. Structures, internal tables and references: Error





PERFORM Short Reference   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.

Length: 4749 Date: 20240419 Time: 175645     sap01-206 ( 43 ms )