SAP Function Modules

Share |

ABL_MOVE_REQUIRED_LENGTH SAP Function module - Required length for MOVE to a type C target field

Pattern for FM ABL_MOVE_REQUIRED_LENGTH - ABL MOVE REQUIRED LENGTH
Associated Function Group: SABL
Released Date: Not Released
CALL FUNCTION 'ABL_MOVE_REQUIRED_LENGTH' "Required length for MOVE to a type C target field
  EXPORTING
    srctype =                   " rsex2in-type  ABAP/4 type of source field
*   srclen =                    " rsex2in-length  Internal length of source field
*   srcdecs = 0                 " rsex2in-decimals  Number of decimal places (type P only)
  IMPORTING
    destlen =                   " rsex2in-length  Safe length for a type C target field
  EXCEPTIONS
    ILLEGAL_TYPE = 1            "               Invalid or inconvertible type
    ILLEGAL_LEN = 2             "               Invalid length
    ILLEGAL_DECS = 3            "               Invalid number of decimal places
    .  "  ABL_MOVE_REQUIRED_LENGTH

SAP Documentation for FM ABL_MOVE_REQUIRED_LENGTH


FUNCTIONALITY

If you want to use a MOVE statement to move data from a source field to a type C field, this function module calculates the required length of the target field so that no data is lost. If the type C field is then reassigned to the source field, the contents of the source field do not change.

EXAMPLE
Applied to the source field type F (float point number), the function module returns 24 as the required length because a floating point number can include 1 leading sign, up to 17 valid digits, 1 decimal point, the letter "E", 1 exponential sign and up to 3 exponential places.

HINTS
The module does not check each time whether the combination of input values makes sense.
If you use this function module to calculate the "safe" target field length for WRITE TO or the output length for WRITE, you should be aware of the following:

  • The maximum output length for WRITE is 255, whereas the target field length for WRITE TO is unrestricted.

  • This function module ignores formatting characters with WRITE or WRITE TO.
  • Documentation extract taken from SAP system, Copyright (c) SAP AG






    Share |