메뉴 건너뛰기

SAP 한국 커뮤니티

Report Program Download..

김지성 2007.06.26 11:40 조회 수 : 4007 추천:21

안녕하세요..


 


인터넷에 돌아다니다가 레포트용 프로그램을 다운로드 할 수 있게 해주는 프로그램을 발견했네요.


스크린은 비록 안되지만 단순히 레포트 프로그램은 다운로드 해줍니다.(Include 포함)


 


아주 심플하니 받아서 유용하게 사용하세요..


 


 

*&---------------------------------------------------------------------*
*& Report  Z_PRGRAM_DOWN
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  z_prgram_down
                            LINE-SIZE  80
                            LINE-COUNT 64
                            MESSAGE-ID zz
                            NO STANDARD PAGE HEADING.
*----------------------------------------------------------------------*
* Tables                                                               *
*----------------------------------------------------------------------*
TABLES : tadir.
*----------------------------------------------------------------------*
* Types                                                                *
*----------------------------------------------------------------------*
TYPESBEGIN OF t_type,
         line(72),
       END OF t_type,

       BEGIN OF t_prog,
         obj_name TYPE tadir-obj_name,
       END OF t_prog.
*----------------------------------------------------------------------*
* Internal Tables                                                      *
*----------------------------------------------------------------------*
**--Internal table to hold code
DATA: it_code TYPE TABLE OF t_type,
      wa_code TYPE t_type,
**--Internal table to hold the program names
      it_obj  TYPE TABLE OF t_type,
      wa_obj  TYPE t_type,
**--Internal table to hold the program that are not downloaded
      it_prog TYPE TABLE OF t_prog,
      wa_prog TYPE t_prog,
**--Internal table to hold the program that are downloaded
      it_dwld TYPE TABLE OF t_prog,
      wa_dwld TYPE t_prog.
*----------------------------------------------------------------------*
* Field Symbols                                                        *
*----------------------------------------------------------------------*
FIELD-SYMBOLS :.
*----------------------------------------------------------------------*
* Constants                                                            *
*----------------------------------------------------------------------*
CONSTANTS : gc_ext(4TYPE c VALUE '.txt',            "File Extension
            gc_sep    TYPE c VALUE '',               "Separator
            gc_prog   TYPE tadir-object VALUE 'PROG'"Object Type
*----------------------------------------------------------------------*
* Selection Screen                                                     *
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS : s_obj FOR tadir-obj_name.          "Object Name
PARAMETERS : p_path(200) VISIBLE LENGTH 10 OBLIGATORY.  "Folder Path
SELECTION-SCREEN END OF BLOCK b1.
*----------------------------------------------------------------------*
* At selection-screen                                                  *
*----------------------------------------------------------------------*
AT SELECTION-SCREEN.
**--Validate Path
  PERFORM validate_path.
*----------------------------------------------------------------------*
* Start Of Selection                                                   *
*----------------------------------------------------------------------*
START-OF-SELECTION.
**--Get Program Names
  PERFORM fetch_prog_names.
**--Process Program Names Internal table
  PERFORM process_itab.
*----------------------------------------------------------------------*
* End Of Selection                                                     *
*----------------------------------------------------------------------*
END-OF-SELECTION.
**--Display the list of programs that are not downloaded
  PERFORM display_itab.
*&---------------------------------------------------------------------*
*&      Form  FETCH_PROG_NAMES
*&---------------------------------------------------------------------*
*       Get Program Names
*----------------------------------------------------------------------*
FORM fetch_prog_names .
**--Get program names
  CLEAR : it_obj[].
  SELECT obj_name
    FROM tadir
    INTO TABLE it_obj
   WHERE object EQ gc_prog
     AND obj_name IN s_obj.
  IF sy-subrc NE 0.
    MESSAGE i000(zz) WITH 'No programs found'(001).
  ENDIF.

ENDFORM.                    " FETCH_PROG_NAMES
*&---------------------------------------------------------------------*
*&      Form  PROCESS_ITAB
*&---------------------------------------------------------------------*
*       Prepare programs to download
*----------------------------------------------------------------------*
FORM process_itab .

  DATA: lv_filename TYPE string.

  LOOP AT it_obj INTO wa_obj.
    CLEAR : it_code[].
    ASSIGN wa_obj-line TO .
    lv_filename = wa_obj-line.
    TRY.
**--Get the code of the program into internal table
        READ REPORT  INTO it_code.
        IF sy-subrc = 0.
          CONCATENATE p_path gc_sep lv_filename gc_ext INTO lv_filename.
          CONDENSE lv_filename NO-GAPS.
**--Download code to given path
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              filename                = lv_filename
              filetype                = 'ASC'
            TABLES
              data_tab                = it_code
            EXCEPTIONS
              file_write_error        = 1
              no_batch                = 2
              gui_refuse_filetransfer = 3
              invalid_type            = 4
              no_authority            = 5
              unknown_error           = 6
              header_not_allowed      = 7
              separator_not_allowed   = 8
              filesize_not_allowed    = 9
              header_too_long         = 10
              dp_error_create         = 11
              dp_error_send           = 12
              dp_error_write          = 13
              unknown_dp_error        = 14
              access_denied           = 15
              dp_out_of_memory        = 16
              disk_full               = 17
              dp_timeout              = 18
              file_not_found          = 19
              dataprovider_exception  = 20
              control_flush_error     = 21
              OTHERS                  = 22.
          IF sy-subrc <> 0.
**--Unable to download program
            wa_prog-obj_name = wa_obj-line.
            APPEND wa_prog TO it_prog.
            CLEAR wa_prog.
          ELSE.
            wa_dwld-obj_name = wa_obj-line.
            APPEND wa_dwld TO it_dwld.
            CLEAR wa_dwld.
          ENDIF.
        ENDIF.
      CATCH cx_sy_read_src_line_too_long.
**--Unable to download program as line length > 72
        wa_prog-obj_name = wa_obj-line.
        APPEND wa_prog TO it_prog.
        CLEAR wa_prog.
    ENDTRY.
  ENDLOOP.

ENDFORM.                    " PROCESS_ITAB
*&---------------------------------------------------------------------*
*&      Form  VALIDATE_PATH
*&---------------------------------------------------------------------*
*       Validate Directory Path
*----------------------------------------------------------------------*
FORM validate_path .

  DATA: lv_exist TYPE c,
        lv_isdir TYPE c.

  CALL FUNCTION 'TMP_GUI_GET_FILE_EXIST'
    EXPORTING
      fname          = p_path
    IMPORTING
      exist          = lv_exist
      isdir          = lv_isdir
    EXCEPTIONS
      fileinfo_error = 1
      OTHERS         = 2.
  IF sy-subrc NE 0 OR lv_exist IS INITIAL.
**--Directory does not exist
    SET CURSOR FIELD 'P_PATH'.
    MESSAGE e000(zz) WITH 'Invalid Directory Path'(002).
  ELSE.
    IF lv_isdir IS INITIAL.
**--Given Path is not a directory
      SET CURSOR FIELD 'P_PATH'.
      MESSAGE e000(zz) WITH 'Input Directory Path'(003).
    ENDIF.
  ENDIF.

ENDFORM.                    " VALIDATE_PATH
*&---------------------------------------------------------------------*
*&      Form  DISPLAY_ITAB
*&---------------------------------------------------------------------*
*       Display Programs
*----------------------------------------------------------------------*
FORM display_itab .

  LOOP AT it_dwld INTO wa_dwld.
    AT FIRST.
      WRITE :/ 'List of programs that are downloaded'(006)
                COLOR COL_HEADING.
    ENDAT.
    WRITE :/4 wa_dwld-obj_name.
  ENDLOOP.

  SKIP 2.

  LOOP AT it_prog INTO wa_prog.
    AT FIRST.
      WRITE:/ 'List of programs that are not downloaded'(005)
               COLOR COL_HEADING.
    ENDAT.
    WRITE :/4 wa_prog-obj_name.
  ENDLOOP.

ENDFORM.                    " DISPLAY_ITAB

번호 제목 글쓴이 날짜 조회 수
127 트리 만들기 [6] 푸른밤 2007.07.31 5353
126 인용부호를 변수에 저장하려면 [2] 푸른밤 2007.07.31 3847
125 일/주/월/분기/년..연산가능 펑션~ [7] 초짜 2007.07.31 5208
124 user-exit 찾기 [12] file 솔로몬 2007.07.31 6040
123 pop up message 보내고 싶을때 허접하지만 오다리 2007.07.30 4392
122 설명이 비교적 자세하고 원리를 알수 있는 효과적인 ABAP코딩 문서.doc [13] file 박영신 2007.07.26 4041
121 Five Different "User Types" D.Y.Kim 2007.07.20 4779
120 What Are Lock Objects ? D.Y.Kim 2007.07.20 7687
119 SELECT statement D.Y.Kim 2007.07.20 23647
118 일자에 포멧에 맞게 자동으로 처리하는 프로그램 [1] 박종갑 2007.07.13 3741
117 평가영역 에서 자재 평가는 불일치성 합니다(이전전기시 에러) [1] sapjoy 2007.07.03 7870
116 ABAP/4 Optimization Techniques [1] sapjoy 2007.06.30 4894
115 텍스트파일 다운받을때 유니코드 문제 해결 [8] file 솔로몬 2007.06.28 13798
114 ALV 활용해 보기 [4] file 박진만 2007.06.28 3727
113 System Administration Made Easy - Performace file 박진만 2007.06.26 2985
» Report Program Download.. [4] 김지성 2007.06.26 4007
111 바탕화면에 바로가기 생성하기 [1] 김윤승 2007.06.25 5146
110 심플한 Progress 올려봅니다. [2] 김지성 2007.06.19 4074
109 Open SQL에서 SUM 사용시 유의사항. [11] 나침반친구 2007.06.07 9591
108 New ABAP Editor Concept [4] file D.Y.Kim 2007.06.07 3847