본문 바로가기

ERP_Work/ABAP

전화번호 Conversion Exit

 

FUNCTION CONVERSION_EXIT_ZTELN_INPUT.

*"----------------------------------------------------------------------

*"*"Local interface:

*"  IMPORTING

*"     VALUE(INPUT) TYPE  CLIKE

*"  EXPORTING

*"     VALUE(OUTPUT) TYPE  CLIKE

*"----------------------------------------------------------------------

* 20100826 : Make by Franklee

*"----------------------------------------------------------------------

 

  OUTPUT = INPUT.

 

  REPLACE ALL OCCURRENCES OF REGEX '\D' IN OUTPUT WITH ''.

 

ENDFUNCTION.

 

FUNCTION CONVERSION_EXIT_ZTELN_OUTPUT.

*"----------------------------------------------------------------------

*"*"Local interface:

*"  IMPORTING

*"     VALUE(INPUT) TYPE  CLIKE

*"  EXPORTING

*"     VALUE(OUTPUT) TYPE  CLIKE

*"----------------------------------------------------------------------

* 20100826 : Make by Franklee

*"----------------------------------------------------------------------

  DATA: LV_LENGTH TYPE I.

*번호 용도

*001 ~ 009 국제전화

*010 ~ 019 무선전화, 무선호출, 부가통신망

*020, …, 090 공통 서비스 (개인번호 등)

*02x ~ 06x 지역번호

*071 ~ 079 (예비)

*081 ~ 089 시외전화

*091 ~ 099 (예비)

*100 ~ 109 사업자의 민원 및 통신업무

*110 ~ 129 긴급 민원사항

*1300 ~ 1399 생활정보 등

*1400 ~ 1499 (예비; 부가서비스 용도)

*1500 ~ 1599 사업자 자율 부가서비스

*1600 ~ 1699 공통 부가서비스

*1700 ~ 1999 (예비; 일부 사용되고 있음)

  OUTPUT = INPUT.

  REPLACE ALL OCCURRENCES OF REGEX '\D' IN OUTPUT WITH ''.

* 자리수

  LV_LENGTH = STRLEN( OUTPUT ).

  if OUTPUT+0(2) = '00'.

      CONCATENATE OUTPUT+0(3) OUTPUT+3

             INTO OUTPUT SEPARATED BY ')'.

  else.

    IF LV_LENGTH = 11.

      CONCATENATE OUTPUT+0(3) OUTPUT+3(4) OUTPUT+7(4)

             INTO OUTPUT SEPARATED BY '-'.

    ELSEIF LV_LENGTH = 10.

      CONCATENATE OUTPUT+0(3) OUTPUT+3(3) OUTPUT+6(4)

             INTO OUTPUT SEPARATED BY '-'.

    ELSEIF LV_LENGTH = 9.

      CONCATENATE OUTPUT+0(2) OUTPUT+2(3) OUTPUT+5(4)

             INTO OUTPUT SEPARATED BY '-'.

    ELSEIF LV_LENGTH = 8.

      CONCATENATE OUTPUT+0(4) OUTPUT+4(4)

             INTO OUTPUT SEPARATED BY '-'.

    ENDIF.

  endif.

 

ENDFUNCTION.