0% found this document useful (0 votes)
25 views4 pages

ZDUDUBATCHINPUT

Uploaded by

Allan Camargo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views4 pages

ZDUDUBATCHINPUT

Uploaded by

Allan Camargo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

*&---------------------------------------------------------------------*

*& Report ZDUDUBATCHINPUT


*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

report zdudubatchinput.

tables kna1.

**********************************************************************
* TYPES *
**********************************************************************
data: begin of t_bdc occurs 0.
include structure bdcdata.
data: end of t_bdc.

types: begin of ty_kna1,


kunnr type kna1-kunnr,
name1 type kna1-name1,
end of ty_kna1.

**********************************************************************
* 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.

* Monta BDC para chamada do Call Transaction


perform zf_monta_bi using:
'X' 'SAPMF02D' '0101',
' ' 'BDC_CURSOR' 'RF02D-KUNNR',
' ' 'BDC_OKCODE' '/00',
' ' 'RF02D-KUNNR' w_kna1-kunnr,
' ' 'RF02D-D0110' 'X',

'X' 'SAPMF02D' '0110',

' ' 'BDC_CURSOR' 'KNA1-NAME2' ,


' ' 'BDC_OKCODE' '=UPDA' ,
' ' 'KNA1-NAME2' v_name2 .

** Chama XD02 modificando o campo NAME2


call transaction 'XD02' using t_bdc
mode v_mode
update c_update
messages into t_msg.

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy