Ver Mensaje Individual
  #2  
Viejo 08/07/09, 16:24:54
patrigir patrigir is offline
Junior Member
 
Fecha de Ingreso: oct 2007
Mensajes: 2
REPORT ZCARGA_CONV_CUENTAS NO STANDARD PAGE HEADING LINE-SIZE 110.


************************************************************************
* Definición variables y tablas
************************************************************************
DATA i_dynfields LIKE dynpread OCCURS 1 WITH HEADER LINE.

DATA: BEGIN OF i_table OCCURS 0,
l_line(100) type c.
DATA: END OF i_table.

************************************************************************
* Definition of parameters and ranges of selection.
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME title text-001.

PARAMETERS: p_file type localfile OBLIGATORY.

SELECTION-SCREEN END OF BLOCK block1.



************************************************************************
* AT SELECTION-SCREEN
************************************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
*subroutine that allows to look for the wished file
PERFORM seleccionar_fichero USING p_file.



************************************************************************
* START-OF-SELECTION. *
************************************************************************
START-OF-SELECTION.

* Carga de datos de la tabla con origen en fichero
perform f_carga_fichero tables i_table
using p_file.

* El contenido de la tabla se pone en la tabla ZPAT_PROVA
perform f_actualizar_tabla tables i_table.





*&---------------------------------------------------------------------*
*& Form SELECCIONAR_FICHERO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_P_FILE text
*----------------------------------------------------------------------*
FORM SELECCIONAR_FICHERO USING P_P_FILE.

CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_p_file.

ENDFORM. " SELECCIONAR_FICHERO
*&---------------------------------------------------------------------*
*& Form F_CARGA_FICHERO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_I_TABLE text
* -->P_P_FILE text
*----------------------------------------------------------------------*
FORM F_CARGA_FICHERO TABLES i_table STRUCTURE i_table
USING P_P_FILE.

data: v_files type string.

v_files = p_p_file.

refresh i_table.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_files
filetype = 'ASC'
TABLES
data_tab = i_table
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.

if sy-subrc ne 0.
write: /'Not good'.
endif.

ENDFORM. " F_CARGA_FICHERO
*&---------------------------------------------------------------------*
*& Form F_ACTUALIZAR_TABLA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_I_TABLE_L_LINE text
*----------------------------------------------------------------------*
FORM F_ACTUALIZAR_TABLA TABLES P_I_TABLE STRUCTURE i_table.

data: C_TAB TYPE C VALUE cl_abap_char_utilities=>horizontal_tab.


DATA: I_TAB TYPE ZCONV_CUENTAS,
l_tabix type sy-tabix.


loop at P_I_TABLE.

l_tabix = sy-tabix.
split p_i_table-l_line at c_tab into
i_tab-zpcvu
i_tab-ztext
i_tab-zcaes.

i_tab-mandt = sy-mandt.

modify zconv_cuentas from i_tab.

if sy-subrc ne 0.
exit.
endif.

endloop.

ENDFORM. " F_ACTUALIZAR_TABLA
Responder Con Cita