ZDUDUBATCHINPUT
ZDUDUBATCHINPUT
report zdudubatchinput.
tables kna1.
**********************************************************************
* TYPES *
**********************************************************************
data: begin of t_bdc occurs 0.
include structure bdcdata.
data: end of t_bdc.
**********************************************************************
* Tabelas internas *
**********************************************************************
data: t_msg like bdcmsgcoll occurs 0 with header line,
t_kna1 type table of ty_kna1.
**********************************************************************
* Work Areas *
**********************************************************************
data: w_kna1 type ty_kna1.
**********************************************************************
* Constantes *
**********************************************************************
constants: c_update type c value 'S'.
**********************************************************************
* Variaveis *
**********************************************************************
data: v_mode type c value 'A', "Exibindo todas as telas
v_msg_erro(255) type c,
v_name2 type kna1-name2.
**********************************************************************
* Tela de Seleo
**********************************************************************
selection-screen begin of block b1 with frame title text-001.
select-options s_kunnr for kna1-kunnr.
selection-screen end of block b1.
**********************************************************************
* Lgica *
**********************************************************************
start-of-selection.
** Seleciona clientes
select kunnr name1
from kna1
into table t_kna1
where kunnr in s_kunnr.
if sy-subrc is initial.
loop at t_kna1 into w_kna1.
case w_kna1-name1(1).
when 'A'.
v_name2 = 'Cliente - teste A'.
when 'B'.
v_name2 = 'Cliente - teste B'.
when 'C'.
v_name2 = 'Cliente - teste C'.
when 'D'.
v_name2 = 'Cliente - teste D'.
when 'E'.
v_name2 = 'Cliente - teste E'.
when 'F'.
v_name2 = 'Cliente - teste F'.
when 'G'.
v_name2 = 'Cliente - teste G'.
when 'H'.
v_name2 = 'Cliente - teste H'.
when 'I'.
v_name2 = 'Cliente - teste I'.
when 'J'.
v_name2 = 'Cliente - teste J'.
when 'L'.
v_name2 = 'Cliente - teste L'.
when 'M'.
v_name2 = 'Cliente - teste M'.
when 'N'.
v_name2 = 'Cliente - teste N'.
when 'O'.
v_name2 = 'Cliente - teste O'.
when 'P'.
v_name2 = 'Cliente - teste P'.
when 'Q'.
v_name2 = 'Cliente - teste Q'.
when 'R'.
v_name2 = 'Cliente - teste R'.
when 'S'.
v_name2 = 'Cliente - teste S'.
when 'T'.
v_name2 = 'Cliente - teste T'.
when 'U'.
v_name2 = 'Cliente - teste U'.
when 'V'.
v_name2 = 'Cliente - teste V'.
when 'X'.
v_name2 = 'Cliente - teste X'.
when 'Z'.
v_name2 = 'Cliente - teste Z'.
when 'Y'.
v_name2 = 'Cliente - teste Y'.
when 'W'.
v_name2 = 'Cliente - teste W'.
when others.
endcase.
refresh t_bdc.
clear v_name2.
endloop.
endif.
if not sy-subrc eq 0.
read table t_msg with key msgtyp = 'E'. "Erro
call function 'FORMAT_MESSAGE'
exporting
id = t_msg-msgid
lang = 'PT'
no = t_msg-msgnr
v1 = t_msg-msgv1
v2 = t_msg-msgv2
v3 = t_msg-msgv3
v4 = t_msg-msgv4
importing
msg = v_msg_erro
exceptions
not_found = 1
others = 2.
if sy-subrc is initial.
write v_msg_erro.
endif.
endif.
*&---------------------------------------------------------------------*
*& Form zf_monta_bi
*&---------------------------------------------------------------------*
form zf_monta_bi using dynbegin
name
value.
clear t_bdc.
if dynbegin = 'X'.
move: name to t_bdc-program,
value to t_bdc-dynpro,
'X' to t_bdc-dynbegin.
else.
move: name to t_bdc-fnam,
value to t_bdc-fval.
endif.
append t_bdc.
endform. "zf_monta_bi