วันศุกร์ที่ 3 กันยายน พ.ศ. 2553

Program ABAP : zbot_exchangerate : get_back_working_day

<< Start-Of-Selection

*&---------------------------------------------------------------------*
*&      Form  GET_BACK_WORKING_DAY
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_P_DATE  text
*      -->P_CHANGE  text
*      -->P_GV_BDATE  text
*----------------------------------------------------------------------*
form get_back_working_day  using    value(pa_date)
                           changing p_bdate.
  data : lv_date type sy-datum.
  clear gi_holi[].
  lv_date = pa_date .

  do.
    call function 'HOLIDAY_GET'
     exporting
       holiday_calendar                 = 'T1'
       factory_calendar                 = 'T1'
       date_from                        = lv_date
       date_to                          = lv_date
* IMPORTING
*   YEAR_OF_VALID_FROM               =
*   YEAR_OF_VALID_TO                 =
*   RETURNCODE                       =
      tables
        holidays                         = gi_holi
     exceptions
       factory_calendar_not_found       = 1
       holiday_calendar_not_found       = 2
       date_has_invalid_format          = 3
       date_inconsistency               = 4
       others                           = 5
              .
    if sy-subrc <> 0.
      message id sy-msgid type sy-msgty number sy-msgno
              with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    else.
      read table gi_holi with key date = lv_date.
*                                  FREEDAY = 'X'
*                                  HOLIDAY = 'X'.
      if sy-subrc eq 0.
        lv_date = lv_date - 1.
      else.
        p_bdate  = lv_date.
        exit.
      endif.
    endif.
  enddo.
endform.                    " GET_BACK_WORKING_DAY

<< Start-Of-Selection 

ไม่มีความคิดเห็น:

แสดงความคิดเห็น