PACK (ABAP Keyword)


PACK is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details.

PACK

Basic form
PACK f TO g.

Effect
Places the character field f in packed format in the field g . Reverse of the UNPACK command.

Example

DATA C_FIELD(4) TYPE C VALUE ‘0103’,
P_FIELD(2) TYPE P.
PACK C_FIELD TO P_FIELD.

C_FIELD: C’0103′ –> P_FIELD: P’103C’

Note
The field f can contain up to 16 characters.