Convert internal date to output format according user’s config

Use FM CONVERT_DATE_TO_EXTERNAL to convert data from internal format, to user format.

FORM convert_date_format
    USING
      value(p_internal_format)  TYPE datum
    CHANGING
      p_external_format  TYPE char10.
 CLEAR p_external_format.
 CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
   EXPORTING
     date_internal            = p_internal_format
   IMPORTING
     date_external            = p_external_format
   EXCEPTIONS
     date_internal_is_invalid = 1
     others                   = 2.
 IF sy-subrc <> 0.
     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
   ENDIF.
 ENDFORM.