Foro de programaciσn ABAP
SAP / ABAP => Basis => Mensaje iniciado por: Carlos en 13 de Noviembre de 2007, 11:49:46 am
-
Hola, queremos hacer un Backup de nuestros programas y funciones 'Z'.
ΏMe podιis aconsejar?
Gracias.
-
Hola Carlos,
Los backup de sistema se hacen de la BBDD.
Lo mejor es meter los programas y las funciones Z en una o varias ordenes de trasporte y liberarlas.
Despuιs a nivel de sistema operativo copias del directorio /usr/sap/trans, el archivo data y el archivo coffile correspondiente a dichas ordenes y te los llevas. Esta ordenes son importables a cualquier sistema SAP.
-
Muchas gracias oscar. ;)
Buscando por internet encontrι este programa de Alvaro (Blag) en el siguiente enlace:
http://atejada.blogspot.com/2006/10/backup-de-programas-en-abap.html (http://atejada.blogspot.com/2006/10/backup-de-programas-en-abap.html)
**************************************************************
* Programa : Z_PROGRAMS_DOWNLOAD. *
* Mσdulo : BC - Basis. *
* Consultor ABAP : Alvaro Tejada Galindo. *
* February 14, 2006 12:33:22 PM *
**************************************************************
REPORT z_dummy_atg NO STANDARD PAGE HEADING.
*=============================================================
* VARIABLES
*=============================================================
DATA: fullname(30) TYPE c,
one LIKE pcfile-drive,
two LIKE pcfile-path,
filepath(128) TYPE c.
DATA: app_name TYPE string,
ddtext_name TYPE string,
dummy TYPE string,
include_name TYPE string.
*=============================================================
* TABLAS INTERNAS
*=============================================================
DATA: BEGIN OF source_table OCCURS 0,
linea(150) TYPE c.
DATA: END OF source_table.
DATA: BEGIN OF include_table OCCURS 0,
linea(150) TYPE c.
DATA: END OF include_table.
DATA: BEGIN OF dynpro_table OCCURS 0,
linea(250) TYPE c.
DATA: END OF dynpro_table.
DATA: BEGIN OF t_trdir OCCURS 0,
name LIKE trdir-name,
END OF t_trdir.
DATA: BEGIN OF t_log OCCURS 0,
error TYPE string,
END OF t_log.
DATA: data_ddtext TYPE STANDARD TABLE OF textpool
WITH HEADER LINE.
*=============================================================
* SELECTION-SCREEN
*=============================================================
SELECTION-SCREEN BEGIN OF BLOCK test WITH FRAME.
PARAMETERS:
prgname LIKE trdir-name,
listname LIKE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK test.
*=============================================================
* AT SELECTION-SCREEN
*=============================================================
AT SELECTION-SCREEN ON VALUE-REQUEST FOR listname.
PERFORM get_filename CHANGING listname.
*=============================================================
* START-OF-SELECTION
*=============================================================
START-OF-SELECTION.
PERFORM load_data.
IF NOT t_log[] IS INITIAL.
WRITE: 'se encontraron los siguientes errores: '.
ENDIF.
ULINE.
SKIP 1.
LOOP AT t_log.
WRITE:/ t_log-error.
ENDLOOP.
**
* FORM GET_FILENAME *
**
FORM get_filename CHANGING listname.
CALL FUNCTION 'ws_filename_get'
EXPORTING
def_filename = listname
def_path = 'c:\downloads\lista'
mask = ',*.*,*.*. '
mode = 's'
title = 'guardar en'
IMPORTING
filename = listname
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
ENDFORM. "GET_FILENAME
**
* FORM LOAD_DATA *
**
FORM load_data.
DATA: w_file LIKE pcfile-path.
w_file = listname.
CALL FUNCTION 'pc_split_complete_filename'
EXPORTING
complete_filename = w_file
IMPORTING
drive = one
path = two
EXCEPTIONS
invalid_drive = 1
invalid_extension = 2
invalid_name = 3
invalid_path = 4
OTHERS = 5.
CONCATENATE one ':' two INTO filepath.
CONCATENATE prgname '%' INTO fullname.
SELECT name
INTO TABLE t_trdir
FROM trdir
WHERE name LIKE fullname.
IF sy-subrc EQ 0.
PERFORM fill_list.
PERFORM download_apps.
ENDIF.
ENDFORM. "LOAD_DATA
**
* FORM FILL_LIST *
**
FORM fill_list.
CALL FUNCTION 'ws_download'
EXPORTING
filename = filepath
filetype = 'asc'
TABLES
data_tab = t_trdir
EXCEPTIONS
file_open_error = 1
file_write_error = 02
invalid_filesize = 03
invalid_table_width = 04
invalid_type = 05
no_batch = 06
unknown_error = 07.
ENDFORM. "FILL_LIST
**
* FORM FILL_LIST_INCLUDE *
**
FORM fill_list_include.
CONCATENATE filepath 'includes.txt' INTO listname.
CALL FUNCTION 'ws_download'
EXPORTING
filename = listname
filetype = 'asc'
mode = 'a'
TABLES
data_tab = include_table
EXCEPTIONS
file_open_error = 1
file_write_error = 02
invalid_filesize = 03
invalid_table_width = 04
invalid_type = 05
no_batch = 06
unknown_error = 07.
ENDFORM. "FILL_LIST_INCLUDE
*&-*
*& Form DOWNLOAD_APPS *
*&-*
FORM download_apps.
LOOP AT t_trdir.
CLEAR: app_name, include_name.
REFRESH: source_table.
CLEAR: source_table.
READ REPORT t_trdir-name INTO source_table.
READ TEXTPOOL t_trdir-name INTO data_ddtext LANGUAGE sy-langu.
CONCATENATE filepath t_trdir-name '.abp' INTO app_name.
CONCATENATE filepath t_trdir-name '_ddtext.txt'
INTO ddtext_name.
PERFORM download_form USING app_name.
PERFORM download_ddtext USING ddtext_name.
LOOP AT source_table.
SEARCH source_table-linea FOR 'include'.
IF sy-subrc EQ 0.
IF source_table-linea+0(8) NE 'include'.
CONTINUE.
ENDIF.
CLEAR include_name.
SPLIT source_table-linea AT space
INTO dummy include_name.
SPLIT include_name AT '.'
INTO include_name dummy.
REFRESH: source_table.
CLEAR: source_table.
MOVE include_name TO include_table.
READ TABLE include_table WITH KEY linea = include_table.
IF sy-subrc NE 0.
APPEND include_table.
ENDIF.
READ REPORT include_table INTO source_table.
IF sy-subrc EQ 0.
CONCATENATE filepath include_name '.abp'
INTO include_name.
PERFORM download_form USING include_name.
PERFORM fill_list_include.
ENDIF.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM. "DOWNLOAD_APPS
**
* FORM DOWNLOAD_FORM *
**
FORM download_form USING app_name.
CALL FUNCTION 'gui_download'
EXPORTING
filename = app_name
filetype = 'asc'
TABLES
data_tab = source_table
EXCEPTIONS
file_write_error = 1
no_batch = 2
invalid_type = 4
no_authority = 5
unknown_error = 6
file_not_found = 19
OTHERS = 22.
IF sy-subrc NE 0.
t_log-error = app_name.
APPEND t_log.
ENDIF.
ENDFORM. "DOWNLOAD_FORM
*--*
* FORM DOWNLOAD_DDTEXT *
*--*
FORM download_ddtext USING ddtext_name.
CALL FUNCTION 'gui_download'
EXPORTING
filename = ddtext_name
filetype = 'asc'
TABLES
data_tab = data_ddtext
EXCEPTIONS
file_write_error = 1
no_batch = 2
invalid_type = 4
no_authority = 5
unknown_error = 6
file_not_found = 19
OTHERS = 22.
IF sy-subrc NE 0.
t_log-error = ddtext_name.
APPEND t_log.
ENDIF.
ENDFORM. "DOWNLOAD_DDTEXT
-
Por la transacciσn AL11 miras el directorio TRANS
El file y el cofile los bajas a ficheros locales por la transacciσn CG3Y
Saludes.
-
lo que se copia de seguridad de Programas 'Z'