Foro -Documentación -Código fuente -Contacto -Empleo

Buscar

Traducir

Amazon

ZBC_TRANSPORTE PDF Imprimir E-mail
Usar puntuación: / 0
MaloBueno 
Código fuente - Utilidades con ficheros
Escrito por Administrator   
Lunes, 20 de Septiembre de 2004 14:59

Programa para subir reports a sistemas sin utilizar el sistema de transportes

  ****************************************************************
******** * * * PROGRAMA DE TRANSPORTE DE REPORT A DISTINTOS SISTEMAS *
* *
************************************************************************
 report zbc_transporte.
*----------------------------------------------------------------------*
* declaracion de variables *
*----------------------------------------------------------------------*
* variables globales
 data: g_answer.
* constantes
 constants: c_char value '\',
            c_charn value 'N',
            c_text1(45value
             'No se puede sobrescribir el programa origen',
            c_text2(30value 'El progroma no existe en SAP',
            c_text3(15value 'Información',
            c_text4(30value 'Va a sobreescribir el programa',
            c_text5(15value '¿Está seguro?',
 c_pgmid type pgmid value 'R3TR', c_object type trobjtype value 'PROG'.
* Tabla para recoger el fuente del Programa
 databegin of t_report
 occurs 0line(72).
 dataend of t_report.
*----------------------------------------------------------------------*
* pantalla de seleccion *
*----------------------------------------------------------------------*
 selection-screen begin of block sel with frame title text-001.
 parameters: p_prog like tadir-obj_name obligatory default 'Z*',
 p_fich(128default 'C:\' obligatory.
 selection-screen end of block sel.
*----------------------------------------------------------------------*
* verificaciones pantalla de seleccion *
*----------------------------------------------------------------------*
* ayuda de búsqueda de ruta del fichero
 at selection-screen on
  value-request for p_fich.
   perform help_fich.
* verificaciones generales
 at selection-screen.
* comprobamos que no estamos machacando el programa origen
   if p_prog = sy-repid.
     message e208(00with
     c_text1.
   endif.
* comprobamos la existencia del programa
   perform
   check_report.
*----------------------------------------------------------------------*
* start of selection *
*----------------------------------------------------------------------*
 start-of-selection.
* mensaje de confirmación perform confirm.
   check g_answer = 'J'.
* recogemos el codigo fuente
   perform get_fuente.
*  insertamos el codigo del programa y lo generamos
   insert report p_prog
   from t_report.
   generate report p_prog.
************************************************************************
* * * subrutinas * * *
************************************************************************

*&---------------------------------------------------------------------*
*& form help_fich
*&---------------------------------------------------------------------*
 form help_fich.
* variables locales
   data: l_name type localfile,
   l_path type localfile.
* recogemos el nombre del fichero
   l_path =
   p_fich.
* tratamos
   shift: l_path up to c_char, l_path by 1 places
   right.
   condense l_path no-gaps.
* modulo de funciones para recoger el fichero del pc
   call function 'WS_FILENAME_GET'
     exporting
       def_filename     = p_fich
       def_path         = l_path
       mask             = ',*.*,*.*.'
       mode             = 'S'
     importing
       filename         = l_name
     exceptions
       inv_winsys       = 01
       no_batch         = 02
       selection_cancel = 03
       selection_error  = 04.
* recogemos la ruta completa
   check sy-subrc = 0.
   p_fich = l_name.
 endform" help_fich
*&---------------------------------------------------------------------*
*& form check_report
*&---------------------------------------------------------------------*
 form check_report.
* variables locales
   data: ls_tadir type tadir,
   ls_trdir type trdir.
* comprobamos la existencia del programa
   select
   single * into ls_tadir from tadir where pgmid = c_pgmid and object =
   c_object and obj_name = p_prog.
   select single * into ls_trdir from
   trdir where name = ls_tadir-obj_name .
* mostramos mensaje de error
   check sy-subrc <> 0 or ls_tadir is initial.
   message e208(00with
   c_text2.
 endform" check_report
*&---------------------------------------------------------------------*
*& form confirm
*&---------------------------------------------------------------------*
 form confirm.
* modulo de funciones para confirmar la generación del report
   call function 'POPUP_TO_CONFIRM_WITH_MESSAGE'
     exporting
       defaultoption = c_charn
       diagnosetext1 = space
       diagnosetext2 = space
       diagnosetext3 = space
       textline1     = c_text4
       textline2     = c_text5
       titel         = c_text3
     importing
       answer        = g_answer
     exceptions
       others        = 0.
 endform"confirm
*&---------------------------------------------------------------------*
*& form get_fuente
*&---------------------------------------------------------------------*
 form get_fuente.
* modulo de funciones apra recoger el código fuente
   call function 'WS_UPLOAD'
     exporting
       filename = p_fich
       filetype = 'ASC'
     tables
       data_tab = t_report.
 endform" get_fuente

Comentarios
Buscar
¡Sólo los usuarios registrados pueden escribir comentarios!

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Actualizado ( Jueves, 17 de Julio de 2008 10:54 )
 
home search