Ejemplo simple que sirve de plantilla para cargas mediante Batch Input
report ZBI_PA30_0006
no standard page heading line-size 255.
**********************************************************************
*DECLARACION DATOS
**********************************************************************
types: begin of st_data,
num_personal(8),
direccion1(30),
direccion2(30),
end of st_data.
data: ti_data type table of st_data with header line.
data: file type string.
**********************************************************************
*PANTALLA SELECCION
**********************************************************************
parameters: p_file type rlgrap-filename obligatory.
selection-screen skip 1.
include bdcrecx1.
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
field_name = 'P_FILE'
importing
file_name = p_file.
**********************************************************************
*DATOS PANTALLA
**********************************************************************
initialization.
ctu = 'X'.
ctumode = 'N'.
**********************************************************************
*INICIO BI
**********************************************************************
start-of-selection.
move p_file to file.
call function 'GUI_UPLOAD'
exporting
filename = file
has_field_separator = 'X'
tables
data_tab = ti_data
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 <> 0.
write / sy-subrc.
exit.
endif.
perform open_group.
loop at ti_data from 2.
perform bdc_dynpro using 'SAPMP50A' '1000'.
perform bdc_field using 'BDC_OKCODE'
'=MOD'.
perform bdc_field using 'RP50G-PERNR'
ti_data-num_personal.
perform bdc_field using 'RP50G-TIMR6'
'X'.
perform bdc_field using 'BDC_CURSOR'
'RP50G-CHOIC'.
perform bdc_field using 'RP50G-CHOIC'
'0006'.
perform bdc_dynpro using 'MP000600' '2000'.
perform bdc_field using 'BDC_CURSOR'
'P0006-STRAS'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'P0006-BEGDA'
'24.08.2010'.
perform bdc_field using 'P0006-ENDDA'
'31.12.9999'.
perform bdc_field using 'P0006-NAME2'
ti_data-direccion1.
perform bdc_field using 'P0006-STRAS'
ti_data-direccion2.
perform bdc_field using 'P0006-PSTLZ'
'0000000'.
perform bdc_field using 'P0006-ORT01'
'XXX'.
perform bdc_field using 'P0006-STATE'
'13'.
perform bdc_field using 'P0006-LAND1'
'CL'.
perform bdc_transaction using 'PA30'.
endloop.
perform close_group.
No hay comentarios:
Publicar un comentario