ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 프로그레스바 진행률 표시
    SAP/ABAP 2013. 3. 19. 09:14

    *&---------------------------------------------------------------------*
    *& Report  Z_PROGRESS_BAR                                              *
    *&                                                                     *
    *&---------------------------------------------------------------------*
    *&                                                                     *
    *&                                                                     *
    *&---------------------------------------------------------------------*

    REPORT  Z_PROGRESS_BAR                                              .

    DATA GV_WK_CNT      TYPE I,
           GV_WK_TOTAL    TYPE I,
           GV_WK_DISP_CNT TYPE I,
           GV_WK_DISP_MAX TYPE VALUE 1000.

    CONSTANTS GC_TOTAL_TIME  TYPE VALUE 30.


    START-OF-SELECTION.
      PERFORM INIT_PROGRESS_BAR USING GC_TOTAL_TIME.

      DO GC_TOTAL_TIME TIMES.
        PERFORM DISP_PROGRESS_BAR USING 'ING..' SY-TABIX.
        WAIT UP TO SECONDS.
      ENDDO.
    *---------------------------------------------------------------------*
    *      Form  INIT_PROGRESS_BAR
    *---------------------------------------------------------------------*
    FORM INIT_PROGRESS_BAR  USING   P_TOTAL.
      CLEAR GV_WK_CNTGV_WK_TOTAL.
      GV_WK_TOTAL P_TOTAL.
    ENDFORM.                    " INIT_PROGRESS_BAR
    *---------------------------------------------------------------------*
    *      Form  disp_progress_bar
    *---------------------------------------------------------------------*
    FORM DISP_PROGRESS_BAR  USING  P_TITLE
                                   P_CNT.
      DATAGV_WK_GUI_MSG(100),
            GV_WK_PERCENT TYPE I,
            GV_WK_TEXT1(15),
            GV_WK_TEXT2(15).

      GV_WK_CNT      GV_WK_CNT + 1.
      GV_WK_DISP_CNT GV_WK_DISP_CNT + 1.
      CHECK GV_WK_DISP_CNT >= P_CNT.
      CLEAR GV_WK_DISP_CNT.

      GV_WK_PERCENT GV_WK_CNT * 100 / GV_WK_TOTAL.

      CLEAR GV_WK_GUI_MSG.
      GV_WK_GUI_MSG+0(3GV_WK_PERCENT.
      GV_WK_GUI_MSG+3(1'%'.

      WRITE GV_WK_CNT   TO GV_WK_TEXT1 UNIT 'PC'.
      WRITE GV_WK_TOTAL TO GV_WK_TEXT2 UNIT 'PC'.

      CONDENSE GV_WK_TEXT1 NO-GAPS.
      CONDENSE GV_WK_TEXT2 NO-GAPS.

      CONCATENATE GV_WK_GUI_MSG P_TITLE
                  '(' GV_WK_TEXT1 ' / ' GV_WK_TEXT2 ')'
         INTO GV_WK_GUI_MSG SEPARATED BY ' '.

      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
        EXPORTING
          PERCENTAGE GV_WK_PERCENT
          TEXT       GV_WK_GUI_MSG.

    ENDFORM.                    " DISP_PROGRESS_BAR

Designed by Tistory.