*lee un archivo de texto con los clientes y les modifica cierto campo
report ZBATCH_CTES_NVOESQEMA
no standard page heading line-size 255.
parameters: p_name(128) type c.
data: begin of record occurs 0.
data kunnr like mara-kunnr.
data end of record.
include bdcrecx1.
at selection-screen on value-request for p_name.
call function 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = sy-repid
dynpro_number = sy-dynnr
field_name = ''
static = ''
mask = ''
CHANGING
file_name = p_name
EXCEPTIONS
mask_too_long = 1
others = 2.
start-of-selection.
perform leer_archivo.
"perform open_group.
loop at record.
perform bdc_dynpro using 'SAPMF02D' '0101'.
perform bdc_field using 'BDC_CURSOR'
'RF02D-D0310'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02D-KUNNR'
record-kunnr.
perform bdc_field using 'RF02D-BUKRS'
''.
perform bdc_field using 'RF02D-VKORG'
'0030'.
perform bdc_field using 'RF02D-VTWEG'
'10'.
perform bdc_field using 'RF02D-SPART'
'10'.
perform bdc_field using 'RF02D-D0310'
'X'.
perform bdc_dynpro using 'SAPMF02D' '0310'.
perform bdc_field using 'BDC_CURSOR'
'KNVV-KALKS'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
perform bdc_field using 'KNVV-KALKS'
'3'.
perform bdc_transaction using 'XD02'.
endloop.
"perform close_group.
*&---------------------------------------------------------------------*
*& Form leer_archivo
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- nbsp="nbsp" p2="p2" p="p" text="text">*----------------------------------------------------------------------*
FORM leer_archivo.
data: begin of i_upload occurs 0,
line(10000), "Linea de archivo
end of i_upload.
data filename type string.
filename = p_name.
* Para cargar el archivo de entrada
refresh i_upload.
call function 'GUI_UPLOAD'
EXPORTING
filename = filename
TABLES
data_tab = i_upload
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.
loop at i_upload.
* split i_upload-line at ',' into
* record-kunnr.
record-kunnr = i_upload-line.
append record.
clear record.
endloop.
endform.
-->
jueves, 1 de noviembre de 2012
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario