Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
*PROGRAM INFORMATION *
************************************************************************
*PROGRAM : ZPROGRAM_DOWNLOAD *
*TITLE : Download Program with includes to a folder in PC *
*OWNER : Anil kumar *
*AUTHOR : Anil kumar (LOGICA) *
*DATE WRITTEN�......: 28th MAY 2008 *
*COMPANY NAME�......: LOGICA *
*----------------------------------------------------------------------*
*PROGRAM FUNCTION: *
*This program is used to download any program with all its code in the *
*includes to any location on PC selected by the user *
*----------------------------------------------------------------------*
*PROGRAM TYPE�.: Type1 : Executable (please dont change the code) *
************************************************************************
REPORT zprogram_download.
*INITIALIZATION.
*
*pfolder = 'E:\Anil'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_prgnam.
ENDIF.
*-----------------------------------------------------------------------
* Display a directory picker window
*-----------------------------------------------------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pfolder.
wa_dynpread-fieldname = 'PFOLDER'.
APPEND wa_dynpread TO i_dynpread.
ENDIF.
ENDIF.
IF sy-batch IS INITIAL.
CREATE OBJECT objfile.
IF sy-subrc = 0.
pfolder = pickedfolder.
ELSE.
WRITE: / 'An error has occured picking a folder'.
ENDIF.
ENDIF.
INITIALIZATION.
g_c = 'INCLUDE'.
APPEND g_c TO itab1.
START-OF-SELECTION.
REFRESH : itab.
IF sy-subrc EQ 0.
*Use the system code for obtaining any include in the report.
SCAN ABAP-SOURCE itab TOKENS INTO itab5 STATEMENTS INTO itab6
KEYWORDS FROM itab1.
REFRESH : itab.
ENDIF.
ENDLOOP.
*download the file into a file on the pc.
PERFORM dowload_file USING itab4[]
pfolder.
*Printing the whole program on the screen.
LOOP AT itab4 INTO g_string.
WRITE : / g_string.
ENDLOOP.
ELSE.
*download the program to pc path.
PERFORM dowload_file USING itab[]
pfolder.
WRITE : / g_string.
ENDLOOP.
ENDIF.
ELSE.
ENDIF.
*&---------------------------------------------------------------------*
*& Form dowload_file
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_ITAB4[] text
* -->P_PFOLDER text
*----------------------------------------------------------------------*
FORM dowload_file USING p_itab4
p_pfolder.
DATA: objfile TYPE REF TO cl_gui_frontend_services.
DATA : filenamewithpath TYPE string.
IF sy-subrc <> 0.
* strsubrc = sy-subrc.
* CONCATENATE `File save error: ` filename ` sy-subrc: ` strsubrc
*INTO statusmessage.
* PERFORM displaystatus USING statusmessage 3.
ENDIF.
*&---------------------------------------------------------------------*
*& Form determinefrontendopsystem
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_FRONTENDSLASHSEPARATOR text
* -->P_FRONTENDOPSYSTEM text
*----------------------------------------------------------------------*
FORM determinefrontendopsystem USING separator
operatingsystem.
DATA: platformid TYPE i VALUE 0.
DATA: objfile TYPE REF TO cl_gui_frontend_services.