Está en la página 1de 2

function zpm_rfc_region_comunas.

*"----------------------------------------------------------------------
*"*"Interfase local
*" TABLES
*" T_ZPM_REGION_COMUNA STRUCTURE ZST_REGION_COMUNA
*" E_BAPIRET2 STRUCTURE BAPIRET2
*"----------------------------------------------------------------------
data: begin of it_t005f occurs 0,
regio like t005f-regio,
bezei like t005f-bezei,
counc like t005f-counc,
end of it_t005f.

data: begin of it_t005u occurs 0,


bezei like t005u-bezei,
bland like t005u-bland,
end of it_t005u.

select regio as e_cod_region


bezei as e_des_comuna
counc as e_cod_comuna
into corresponding fields of table t_zpm_region_comuna
from t005f
where spras eq 'S'
and land1 eq 'CL'.

if not t_zpm_region_comuna[] is initial.


*
select bezei bland
into corresponding fields of table it_t005u
from t005u
for all entries in t_zpm_region_comuna
where spras = 'S'
and land1 = 'CL'
and bland = t_zpm_region_comuna-e_cod_region.

loop at t_zpm_region_comuna.
loop at it_t005u where bland = t_zpm_region_comuna-e_cod_region.
move: it_t005u-bezei to t_zpm_region_comuna-e_des_region.
endloop.
if sy-subrc = '0'.
modify t_zpm_region_comuna.
endif.
endloop.

endif.
if not t_zpm_region_comuna[] is initial.
e_bapiret2-type = 'S'.
e_bapiret2-id = 'CT'.
e_bapiret2-number = '001'.
e_bapiret2-message = 'Consulta de datos finalizado con éxito'..
append e_bapiret2.
else.
e_bapiret2-type = 'E'.
e_bapiret2-id = 'CT'.
e_bapiret2-number = '001'.
e_bapiret2-message = 'No hay información'.
append e_bapiret2.
endif.

endfunction.

También podría gustarte