메뉴 건너뛰기

SAP 한국 커뮤니티

workingday 기준으로 N일 후 날짜구하는 펑션입니다.

홍성현 2007.08.08 09:39 조회 수 : 5029 추천:18

 

function z_test_date.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     VALUE(I_DATE) TYPE  DATUM
*"     VALUE(CNT) TYPE  I
*"  EXPORTING
*"     VALUE(O_DATE) TYPE  DATUM
*"----------------------------------------------------------------------


  data: itab like iscal_day occurs 0 with header line"휴일을 받아오는 inner table
           line type i" itab의 라인수
           isholy type c"휴일여부
           acc_date type datum, " 기준일
           res_date type datum, " 리턴일
           workingdaycnt type i" 근무일수

  acc_date = i_date.
  workingdaycnt = 0.

  check cnt > 0.

  do.
    isholy = 'N'.

*------------------------------------------------
* 기준일에 하루를 더한다.
    clear res_date.
    call function 'RP_CALC_DATE_IN_INTERVAL'
      exporting
        date      = acc_date
        days      = '1'
        months    = '00'
        signum    = '+'
        years     = '00'
      importing
        calc_date = res_date.
*------------------------------------------------

*------------------------------------------------
* 오늘 날짜가 휴일인지 체크
    clear o_date.
    clear itab.
    refresh itab.

    call function 'HOLIDAY_GET'
      exporting
        holiday_calendar = 'KR' " COUNTRY CODE
        factory_calendar = 'KR' " FACTORY ID
        date_from        = res_date
        date_to          = res_date
      tables
        holidays         = itab.

    if sy-subrc = 0.
      describe table itab lines line.
      if line <> 0.
*        loop at itab.
*        itab-date,
*        itab-freeday,
*        itab-holiday,
*        itab-holiday_id,
*        itab-txt_short,
*        itab-txt_long.
*        endloop.
        isholy = 'Y'.
      endif.
    endif.
*------------------------------------------------

    move res_date to acc_date.

    if isholy = 'N'" 휴일이 아니면 근무일을 더한다.
      add 1 to workingdaycnt .
    endif.

    if workingdaycnt = cnt.
      o_date = res_date.
      exit.
    endif.

  enddo.


endfunction.
번호 제목 글쓴이 날짜 조회 수
427 Five Different "User Types" D.Y.Kim 2007.07.20 4779
426 설명이 비교적 자세하고 원리를 알수 있는 효과적인 ABAP코딩 문서.doc [13] file 박영신 2007.07.26 4041
425 pop up message 보내고 싶을때 허접하지만 오다리 2007.07.30 4392
424 user-exit 찾기 [12] file 솔로몬 2007.07.31 6040
423 일/주/월/분기/년..연산가능 펑션~ [7] 초짜 2007.07.31 5208
422 인용부호를 변수에 저장하려면 [2] 푸른밤 2007.07.31 3847
421 트리 만들기 [6] 푸른밤 2007.07.31 5351
420 SQL 추적 사용하기 [1] 푸른밤 2007.07.31 3581
419 SAP Logo 바꾸기.. 애니메이션 로고.. [2] 푸른밤 2007.07.31 4004
418 ALV에 아이콘 넣는 방법 [1] 푸른밤 2007.07.31 7625
417 ALV에 아이콘 넣는 방법2 푸른밤 2007.07.31 10879
416 SY 모음 [4] 푸른밤 2007.07.31 4153
415 대문자 소문자 관련 신종철 2007.07.31 4157
414 new_abap_editor [3] file Lastforone 2007.07.31 3734
413 ICON으로 DISPLAY sapjoy 2007.08.06 4028
» workingday 기준으로 N일 후 날짜구하는 펑션입니다. [4] 홍성현 2007.08.08 5029
411 "GRAPH_HPGL" 수치데이터를 그래프로 표시해주는 펑션 [1] 홍성현 2007.08.08 3643
410 ABAP에서 .Net connector로 .Net Function호출 시 한글이 깨질 경우 홍성현 2007.08.08 4120
409 Useful SAP System Administration Transactions [2] 홍성현 2007.08.08 12752
408 유지보수 view 생성 후 Field selection 화면 나오게 하려면? [7] file 나침반친구 2007.08.08 7899