어딘가에 관련 펑션이 있을 것 같은데 찾지 못해 자료 찾아 보고 만든 간단한 소스입니다.

Company Code에 할당된 Fiscal Variant 값을 사용하여 입력된 Posting Period에 대한 Calendar date을

리턴하는 프로그램입니다.

 

혹시 관련 펑션 알고 계시면 알려 주세요... ^^;.

 

1918603C512F5E3F3279ED

 

014D5C3C512F5E40028763

 

 

REPORT  ZLOCAL_POSTING_PERIOD.

DATA : LS_T001  TYPE T001.
DATA : LS_POPER TYPE T009B-POPER,
       LS_PERIV TYPE T009B-PERIV,
       LS_BDATJ TYPE T009B-BDATJ.

DATA : FROM_DATE           LIKE  SY-DATUM,
       LAST_NORMAL_PERIOD  LIKE  T009B-POPER,
       TO_DATE             LIKE  SY-DATUM,
       FROM_DATE_ORIG      LIKE  SY-DATUM.

PARAMETERS : P_BUKRS TYPE BUKRS.
PARAMETERS : P_YEAR  TYPE GJAHR.
PARAMETERS : P_MONAT TYPE MONAT.


START-OF-SELECTION.
  CLEAR : LS_T001.

  SELECT SINGLE *
    INTO CORRESPONDING FIELDS OF LS_T001
    FROM T001
    WHERE BUKRS = P_BUKRS.

  MOVE P_YEAR  TO  LS_BDATJ.
  MOVE P_MONAT TO  LS_POPER.


  CALL FUNCTION 'G_POSTING_DATE_OF_PERIOD_GET'
    EXPORTING
      PERIOD              = LS_POPER
      VARIANT             = LS_T001-PERIV
      YEAR                = LS_BDATJ
    IMPORTING
      FROM_DATE           = FROM_DATE
      LAST_NORMAL_PERIOD  = LAST_NORMAL_PERIOD
      TO_DATE             = TO_DATE
      FROM_DATE_ORIG      = FROM_DATE_ORIG
    EXCEPTIONS
      PERIOD_NOT_DEFINED  = 1
      VARIANT_NOT_DEFINED = 2
      OTHERS              = 3.

END-OF-SELECTION.
  WRITE 'Posting Period Conver to Calendar date.'.
  WRITE : / 'Posting Year   : ' , LS_BDATJ.
  WRITE : / 'Posting Period : ' , LS_POPER.
  WRITE : / 'Posting Period Calendar Start Date :' ,FROM_DATE .
  WRITE : / 'Posting Period Calendar End   Date :' ,TO_DATE .