FUNCTION zdk_rgb_to_ole_color.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IV_RGB) TYPE CSEQUENCE
*" EXPORTING
*" REFERENCE(EV_COLOR) TYPE CSEQUENCE
*" EXCEPTIONS
*" INVALID_COLOR
*"----------------------------------------------------------------------
CONSTANTS: lc_rgb TYPE i VALUE 256.
DATA: lv_color TYPE c LENGTH 6.
DATA: lv_int TYPE i.
DATA: lv_ole TYPE int4.
DATA: lv_hex TYPE xstring.
IF iv_rgb+0(1) = '#'.
lv_color = iv_rgb+1(*).
ELSE.
lv_color = iv_rgb+0(*).
ENDIF.
IF strlen( lv_color ) <> 6.
RAISE invalid_color.
ENDIF.
lv_hex = lv_color+0(2).
lv_int = lv_hex.
lv_ole = lv_ole + lv_int.
lv_hex = lv_color+2(2).
lv_int = lv_hex.
lv_ole = lv_ole + ( lv_int * lc_rgb ).
lv_hex = lv_color+4(2).
lv_int = lv_hex.
lv_ole = lv_ole + ( lv_int * lc_rgb * lc_rgb ).
ev_color = lv_ole.
CONDENSE ev_color.
ENDFUNCTION.
FUNCTION zdk_ole_to_rgb_color.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IV_COLOR) TYPE CSEQUENCE
*" EXPORTING
*" REFERENCE(EV_RGB) TYPE CSEQUENCE
*" EXCEPTIONS
*" INVALID_COLOR
*"----------------------------------------------------------------------
CONSTANTS lc_rgb TYPE i VALUE 256.
DATA: lv_color TYPE int4.
DATA: lv_red TYPE i.
DATA: lv_gre TYPE i.
DATA: lv_blue TYPE i.
DATA: lv_ole TYPE int4.
DATA: lv_temp TYPE p DECIMALS 1.
DATA: lv_hex TYPE xstring.
DATA: lv_chars TYPE char02.
lv_ole = iv_color.
lv_red = lv_ole MOD lc_rgb.
lv_hex = lv_red.
lv_chars = lv_hex.
ev_rgb = lv_chars.
lv_temp = trunc( lv_ole / lc_rgb ).
lv_gre = lv_temp MOD lc_rgb.
lv_hex = lv_gre.
lv_chars = lv_hex.
CONCATENATE ev_rgb lv_chars
INTO ev_rgb.
lv_temp = trunc( lv_ole / lc_rgb / lc_rgb ).
lv_blue = lv_temp MOD lc_rgb.
lv_hex = lv_blue.
lv_chars = lv_hex.
CONCATENATE ev_rgb lv_chars
INTO ev_rgb.
CONDENSE ev_rgb.
ENDFUNCTION.
'SAP' 카테고리의 다른 글
How to find WebDynpro includes (0) | 2024.08.27 |
---|