Google Search - Blog...........

ABAP - Encode and Decode Data Befor Saving To Database Table.

There is a time that we need to encode our data before we save it to database table.
I try encoded and decoded string data using method IF_HTTP_UTILITY~DECODE_BASE64 and IF_HTTP_UTILITY~ENCODE_BASE64 in class CL_HTTP_UTILITY.
Here the snippet:
DATA: ENCODED TYPE STRING,
UNENCODED TYPE STRING.

START-OF-SELECTION.

UNENCODED = 'This is test value'.
WRITE: / 'Unencoded string:', UNENCODED.

ENCODED = cl_http_utility=>if_http_utility~encode_base64( unencoded = UNENCODED ).
WRITE: / 'Encoded string:', ENCODED.

CLEAR: UNENCODED.
UNENCODED = cl_http_utility=>if_http_utility~decode_base64( encoded = ENCODED ).
WRITE: / 'Unencoded string:', UNENCODED.

No comments:

Post a Comment