CE PLUS - Nota 013366

Módulo: CÂMBIO FINANCEIRO

Funcionalidade: SISCOSERV

Data/Hora da Publicação: 23/05/2014 10:00:43

Data/Hora Última Alteração: 23/05/2014 10:00:43

Descrição da Nota: SISCOSERV, NOVO TRATAMENTO PARA CRIAÇÃO DE RAS / RVS, VÁRIOS EMBARQUES

Sintoma

Novo tratamento para a criação de RAS / RVS contendo mais de um embarque sendo eles da mesma moeda,

fornecedor e País. Sendo possível também criar adições de operações utilizando um ou mais embarque

de serviços como origem.

 

 

Solução

Criado novo tratamento para Criação / Modificação de RAS/RVS permitindo Selecionar mais de um

Embarque desde que sejam da mesma Moeda, Fornecedor/Cliente e País.

 

Versões Tratadas

9.0


Pré-Requisitos

Produto:

Nota

Descrição

SISCOSERV

SISCOSERV - ASSOCIAÇÃO - AUTOMATIZAR PAGAMENTO DO PEDIDO DE COMPRA

SISCOSERV - NBS

SISCOSERV

Informações Complementares

----------------------------------------------------------------------------------------------------

Nota Número 13366 Data: 30/10/2013 Hora: 10:08:42

----------------------------------------------------------------------------------------------------

 

----------------------------------------------------------------------------------------------------

Nota Número              : 13366

Categoria                : Melhoria

Prioridade               : Média

Versão PW.CE             : 9.0

Pacote                   : 00006

Agrupamento              : 00166

----------------------------------------------------------------------------------------------------

Referência às notas relacionadas:

Número - Ordem - Versão - Pacote - Descrição Breve

 

12480  - 00001 - 9.0    - 00001  - SISCOSERV

13077  - 00002 - 9.0    - 00005  - SISCOSERV

13109  - 00003 - 9.0    - 00005  - SISCOSERV - NBS

13310  - 00004 - 9.0    - 00006  - SISCOSERV - ASSOCIAÇÃO - AUTOMATIZAR PAGAMENTO DO PEDIDO DE COMPR

----------------------------------------------------------------------------------------------------

SISCOSERV, NOVO TRATAMENTO PARA CRIAÇÃO DE RAS / RVS, VÁRIOS EMBARQUES

----------------------------------------------------------------------------------------------------

Palavras Chave:

SISCOSERV, NOVO TRATAMENTO PARA CRIAÇÃO DE RAS / RVS, VÁRIOS EMBARQUES

 

----------------------------------------------------------------------------------------------------

Objetos da nota:

TABD /PWS/ZYCAT031

CUAD /PWS/SAPMZYCA011

DYNP /PWS/SAPMZYCA011                        0008

DYNP /PWS/SAPMZYCA011                        0007

DYNP /PWS/SAPMZYCA011                        0101

REPS /PWS/MZYCA011F01

REPS /PWS/MZYCA011I01

REPS /PWS/MZYCA011O01

REPS /PWS/MZYCA011TOP

REPS /PWS/MZYCA012F01

REPS /PWS/MZYCA012TOP

REPT /PWS/SAPMZYCA011

 

----------------------------------------------------------------------------------------------------

Modificações efetuadas em TABD /PWS/ZYCAT031

 

*** ALTERAÇÃO NA ESTRUTURA DA TABELA - /PWS/ZYCAT031

 

*** INCLUSÃO DE NOVO CAMPO NO FINAL DA TABELA

 

MODIFICAR TABELA TRANSPARENTE: /PWS/ZYCAT031

DESCRIÇÃO BREVE: Operações(Aditivos) RAS/RVS - SISCOSERV

 

CAMPOS NOVOS

 

CAMPOS:         TP. CAMPO     CH: INI: TAB.VERIF.:    TAB.REF.:     CPO.RE

--------------------------------------------------------------------------

NRSEQ_ORIGEM    /PWS/ZYCAL057 ''  ''   ''             ''            ''

 

----------------------------------------------------------------------------------------------------

Modificações efetuadas em CUAD /PWS/SAPMZYCA011

 

*** CRIAÇÃO DE STATUS GUI

 

*** Interface de usuário /PWS/SAPMZYCA011 - 0007 - Seleção Embarque Imp

 

Barra de menu                  Criar RAS/RVS c/Origem

Barra de botões                Criar RAS/RVS c/Origem

Teclas de função               Criar RAS/RVS c/Origem

   -- Código de função     ENTE  ( BOTÃO DE OK )

      Categoria de função  Função de aplicação

      Texto de função      Confirmação

      Tecla de Função      F8

 

   -- Código de função     EXIT  ( BOTÃO DE VOLTAR VERDE )

      Categoria de função  E  Comando exit

      Texto de função      Voltar

 

   -- Código de função     EXIT  ( BOTÃO DE VOLTAR AMARELO )

      Categoria de função  E  Comando exit

      Texto de função      Encerrar

 

   -- Código de função     EXIT  ( BOTÃO DE X VERMELHO )

      Categoria de função  E  Comando exit

      Texto de função      Cancelar

      Nome do Icone        ICON_CANCEL

 

 

*** Interface de usuário /PWS/SAPMZYCA011 - 0008 - Seleção Embarque Imp

 

Barra de menu                  Criar RAS/RVS c/Origem

Barra de botões                Criar RAS/RVS c/Origem

Teclas de função               Criar RAS/RVS c/Origem

   -- Código de função     ENTE  ( BOTÃO DE OK )

      Categoria de função  Função de aplicação

      Texto de função      Confirmação

      Tecla de Função      F8

 

   -- Código de função     EXIT  ( BOTÃO DE VOLTAR VERDE )

      Categoria de função  E  Comando exit

      Texto de função      Voltar

 

   -- Código de função     EXIT  ( BOTÃO DE VOLTAR AMARELO )

      Categoria de função  E  Comando exit

      Texto de função      Encerrar

 

   -- Código de função     EXIT  ( BOTÃO DE X VERMELHO )

      Categoria de função  E  Comando exit

      Texto de função      Cancelar

      Nome do Icone        ICON_CANCEL

 

----------------------------------------------------------------------------------------------------

 

Efetuar download da(s) tela(s) no Portal de Produtos, caminho:

Aplicativos -> pw.CE > Notas > NOTAS - TELAS > CAMBIO >  13366_TELAS.ZIP

Descompactar e efetuar upload no programa e tela correspondente, transação SE80.

 

 

----------------------------------------------------------------------------------------------------

Modificações efetuadas em DYNP /PWS/SAPMZYCA011                        0008

 

 

MODIFICAR LÓGICA DE PROCESSAMENTO TELA 0008

* >> Início da inclusão:

process before output.

  module status_0008.

  call subscreen ss_embexp including syst-cprog '0005'.

process after input.

  module exit_command at exit-command.

  call subscreen ss_embexp.

  module user_command.

* << Fim da inclusão

 

----------------------------------------------------------------------------------------------------

Modificações efetuadas em DYNP /PWS/SAPMZYCA011                        0007

 

MODIFICAR LÓGICA DE PROCESSAMENTO TELA 0007

* >> Início da inclusão:

process before output.

  module status_0007.

  call subscreen ss_embimp including syst-cprog '0004'.

process after input.

  module exit_command at exit-command.

  call subscreen ss_embimp.

  module user_command.

* << Fim da inclusão

 

----------------------------------------------------------------------------------------------------

Modificações efetuadas em REPS /PWS/MZYCA011F01

 

...

            and operacao = itab_zycat031t-operacao.

        if sy-subrc ne 0.

          delete itab_zycat032 where nrseq    = itab_zycat031t-nrseq

                                 and operacao = itab_zycat031t-operacao.

          delete itab_zycat031t where nrseq    = itab_zycat031t-nrseq

                                 and operacao = itab_zycat031t-operacao.

        else.

          message i061 with text-e22 itab_zycat031t-operacao text-e23.

        endif.

      endloop.

* >> Início da inclusão: FORM USER_COMMAND_0101

      loop at itab_zycat031t.

        itab_zycat031t-operacao = sy-tabix.

        modify itab_zycat031t.

      endloop.

* << Fim da inclusão

      clear v_okcode.

    when 'ENQ'.

      perform carrega_enquadramento.

      clear v_okcode.

* >> Início da inclusão: FORM USER_COMMAND_0101

    when 'INCL'.

      if not v_freteimp is initial or

         not v_segimp   is initial or

         not v_embimp   is initial.

        call screen '0007' starting at 7 13.

      elseif not v_freteexp is initial or

             not v_segexp   is initial or

             not v_embexp   is initial.

            call screen '0008' starting at 7 13.

      endif.

* << Fim da inclusão

  endcase.

endform.

form user_command_0102.

  case v_okcode.

    when 'MALL'.

      loop at itab_zycat032t where not cod_enquad is initial.

        itab_zycat032t-mark = 'X'.

        modify itab_zycat032t.

      endloop.

      clear v_okcode.

...

 

...

  select single * from /pws/zycat030

          where nrseq = /pws/zycat030-nrseq.

  if sy-subrc ne 0.

    clear v_okcode.

    message w015 with text-e05.

    stop.

  endif.

  wa_zycat030_ant = /pws/zycat030.

  select * from /pws/zycat031

    into table itab_zycat031_ant

* >> Início da exclusão: FORM SELECIONA_DADOS

    where nrseq = /pws/zycat030-nrseq.

* << Fim da exclusão

* >> Início da inclusão: FORM SELECIONA_DADOS

    where nrseq = /pws/zycat030-nrseq

    order by operacao.

* << Fim da inclusão

  if sy-subrc eq 0.

    loop at itab_zycat031_ant into wa_zycat031.

      append wa_zycat031 to itab_zycat031t.

    endloop.

  endif.

  select * from /pws/zycat032

    into table itab_zycat032

    where nrseq = /pws/zycat030-nrseq.

  if sy-subrc eq 0.

    itab_zycat032_ant[] = itab_zycat032[].

...

 

...

    when 'A'.

      select single name1 stras mcod3

        from lfa1

        into (v_name1, v_stras, v_mcod3)

        where lifnr = /pws/zycat030-bukrs_ext.

    when 'V'.

      select single name1 stras mcod3

        from kna1

        into (v_name1, v_stras, v_mcod3)

        where kunnr = /pws/zycat030-bukrs_ext.

* >> Início da inclusão: FORM SELECIONA_DADOS

  endcase.

  clear: v_embexp,

         v_embimp,

         v_freteexp,

         v_freteimp,

         v_segexp,

         v_segimp,

         v_pedcomp,

         v_sorigem.

  if /pws/zycat030-tp_origem is initial.

    v_sorigem = 'X'.

  else.

    case /pws/zycat030-tp_origem.

      when 'EE'.

        v_embexp   = 'X'.

      when 'EI'.

        v_embimp   = 'X'.

      when 'FE'.

        v_freteexp = 'X'.

      when 'FI'.

        v_freteimp = 'X'.

      when 'SE'.

        v_segexp   = 'X'.

      when 'SI'.

        v_segimp   = 'X'.

      when 'PC'.

        v_pedcomp  = 'X'.

* << Fim da inclusão

  endcase.

* >> Início da inclusão: FORM SELECIONA_DADOS

  endif.

* << Fim da inclusão

  perform verifica_bloqueio.

  clear: v_okcode, v_dynnr.

  ts_contrato-activetab = 'TB_OP'.

  set screen 0100.

  leave screen.

endform.

...

 

...

    when 'ENTE'.

      clear v_okcode.

      if v_sorigem is initial and

        r_embimp[] is initial and

        r_embexp[] is initial and

        r_pcompr[] is initial.

        message i015 with text-i24.

        exit.

      endif.

      if v_sorigem is initial.

* >> Início da exclusão: FORM USER_COMMAND_0003

        perform busca_origem changing v_erro.

* << Fim da exclusão

* >> Início da inclusão: FORM USER_COMMAND_0003

        perform busca_origem_2 changing v_erro.

* << Fim da inclusão

      endif.

      check v_erro is initial.

      set screen 0100.

      leave screen.

  endcase.

endform.

form set_screen_origem.

  loop at screen.

    if screen-name cs 'OPTI_PUSH'.

      screen-active = '0'.

...

 

...

  endif.

endform.

form busca_frete_seg_exp changing p_erro.

  data: wa_zycet001 type ty_zycet001,

        wa_zycet003 type ty_zycet003,

        wa_zycet008 type ty_zycet008,

        wa_zycet116 type ty_zycet116,

        wa_zycet156 type /pws/zycet156,

        wa_zycat030 type /pws/zycat030,

        wa_zycat046 type /pws/zycat046,

* >> Início da inclusão: FORM BUSCA_FRETE_SEG_EXP

        itab_zycet156 type table of /pws/zycet156,

        v_vlme_f    type /pws/zycet008-vlme_f,

* << Fim da inclusão

        v_tp_origem type /pws/zycat030-tp_origem,

        v_kschl     type /pws/zycet156-kschl,

        v_matnr     type /pws/zycat046-matnr.

  if not v_freteexp is initial.

    v_tp_origem = 'FE'.

    v_kschl     = 'ZFTE'.

    v_matnr     = 'FRT'.

  elseif not v_segexp is initial.

    v_tp_origem = 'SE'.

    v_kschl     = 'ZSEG'.

...

 

...

    message i015 with text-e27.

    exit.

  endif.

  select nrseq nrseqre

    up to 1 rows

    from /pws/zycet003

    into wa_zycet003

    where nrseq = wa_zycet001-nrseq.

  endselect.

  select * from /pws/zycet156

* >> Início da exclusão: FORM BUSCA_FRETE_SEG_EXP

    up to 1 rows

    into wa_zycet156

    where bukrs  = wa_zycet001-bukrs

      and codmod = 'X'

      and kschl  = v_kschl.

  endselect.

* << Fim da exclusão

* >> Início da inclusão: FORM BUSCA_FRETE_SEG_EXP

    into table itab_zycet156

    where bukrs     = wa_zycet001-bukrs

      and codmod    = 'X'

      and proccond  = v_matnr.

* << Fim da inclusão

  if sy-subrc eq 0.

    select nrseq vlme_f waers

* >> Início da exclusão: FORM BUSCA_FRETE_SEG_EXP

      up to 1 rows

* << Fim da exclusão

      from /pws/zycet008

      into wa_zycet008

* >> Início da inclusão: FORM BUSCA_FRETE_SEG_EXP

      for all entries in itab_zycet156

* << Fim da inclusão

      where nrseq  = wa_zycet001-nrseq

* >> Início da exclusão: FORM BUSCA_FRETE_SEG_EXP

        and codigo = wa_zycet156-codigo.

* << Fim da exclusão

* >> Início da inclusão: FORM BUSCA_FRETE_SEG_EXP

        and codigo = itab_zycet156-codigo.

      v_vlme_f = v_vlme_f + wa_zycet008-vlme_f.

* << Fim da inclusão

    endselect.

  endif.

...

 

...

    from /pws/zycat046

    into wa_zycat046

    where matnr      = v_matnr

      and tpprocesso = 'V'.

  move:

    wa_zycet001-bukrs      to /pws/zycat030-bukrs,

    wa_zycet116-j_1bbranch to /pws/zycat030-j_1bbranch,

    'V'                    to /pws/zycat030-tp_processo,

    wa_zycet001-codportd   to /pws/zycat030-bukrs_ext,

    wa_zycet008-waers      to /pws/zycat030-waers,

* >> Início da exclusão: FORM BUSCA_FRETE_SEG_EXP

    wa_zycet008-vlme_f     to /pws/zycat030-valor,

    wa_zycet008-vlme_f     to /pws/zycat030-saldo,

* << Fim da exclusão

* >> Início da inclusão: FORM BUSCA_FRETE_SEG_EXP

    v_vlme_f               to /pws/zycat030-valor,

    v_vlme_f               to /pws/zycat030-saldo,

* << Fim da inclusão

    wa_zycet001-nrseq      to /pws/zycat030-origem,

    v_tp_origem            to /pws/zycat030-tp_origem.

  perform informacoes_cabecalho.

  move:

    '01'                   to wa_zycat031-operacao,

    /pws/zycat030-cod_pais to wa_zycat031-cod_pais,

    wa_zycet001-dtemb      to wa_zycat031-data_ini,

* >> Início da exclusão: FORM BUSCA_FRETE_SEG_EXP

    wa_zycet008-vlme_f     to wa_zycat031-valor,

* << Fim da exclusão

* >> Início da inclusão: FORM BUSCA_FRETE_SEG_EXP

    v_vlme_f     to wa_zycat031-valor,

* << Fim da inclusão

    wa_zycat046-nbs        to wa_zycat031-nbs,

    wa_zycat046-modo_prest to wa_zycat031-modo_prest,

    wa_zycat031-valor      to wa_zycat031-saldo.

  append wa_zycat031 to itab_zycat031t.

  if not wa_zycet116-nrre is initial.

    perform inicializa_texto.

    if not v_freteexp is initial.

      concatenate text-003 wa_zycet116-nrre into wa_src-line

        separated by space.

    elseif not v_segexp is initial.

...

 

...

    clear wa_src.

   call method editor->set_text_as_r3table exporting table = itab_src[].

  endif.

endform.

form busca_emb_exp changing p_erro.

  data: wa_zycat030 type /pws/zycat030,

        wa_zycat046 type /pws/zycat046,

        wa_zycet001 type ty_zycet001,

        wa_zycet002 type ty_zycet002,

        wa_zycet008 type ty_zycet008,

* >> Início da exclusão: FORM BUSCA_EMB_EXP

        wa_zycet156 type /pws/zycet156.

* << Fim da exclusão

* >> Início da inclusão: FORM BUSCA_EMB_EXP

itab_zycet156 type table of /pws/zycet156,

itab-zycet008 type table of /pws/zycet008,

v_vlme_f      type /pws/zycet008-vlme_f.

* << Fim da inclusão

  select single nrseq bukrs dtemb codportd tipo_emb

    from /pws/zycet001

    into wa_zycet001

    where nrseq in r_embexp.

  if sy-subrc ne 0.

    p_erro = 'X'.

    message i015 with text-i25 text-i26.

    exit.

  elseif sy-subrc eq 0 and wa_zycet001-tipo_emb ne 'E'.

    p_erro = 'X'.

...

 

...

    message i015 with text-e27.

    exit.

  endif.

  select nrseq fkdat matnr

    from /pws/zycet002

    up to 1 rows

    into wa_zycet002

    where nrseq = wa_zycet001-nrseq.

  endselect.

  select * from /pws/zycet156

* >> Início da exclusão: FORM BUSCA_EMB_EXP

    up to 1 rows

    into wa_zycet156

    where bukrs  = wa_zycet001-bukrs

      and codmod = 'X'

      and kschl  = 'ZPEX'.

  endselect.

* << Fim da exclusão

* >> Início da inclusão: FORM BUSCA_EMB_EXP

    into table itab_zycet156

    where bukrs    = wa_zycet001-bukrs

      and codmod   = 'X'

      and proccond = 'FOB'.

* << Fim da inclusão

  if sy-subrc eq 0.

    select nrseq vlme_f waers

* >> Início da exclusão: FORM BUSCA_EMB_EXP

      up to 1 rows

* << Fim da exclusão

      from /pws/zycet008

      into wa_zycet008

* >> Início da inclusão: FORM BUSCA_EMB_EXP

      for all entries in itab_zycet156

* << Fim da inclusão

      where nrseq  = wa_zycet001-nrseq

* >> Início da exclusão: FORM BUSCA_EMB_EXP

        and codigo = wa_zycet156-codigo.

* << Fim da exclusão

* >> Início da inclusão: FORM BUSCA_EMB_EXP

        and codigo = itab_zycet156-codigo.

      v_vlme_f = v_vlme_f + wa_zycet008-vlme_f.

* << Fim da inclusão

    endselect.

  endif.

  select single *

    from /pws/zycat046

    into wa_zycat046

    where matnr      = wa_zycet002-matnr

      and tpprocesso = 'V'.

  move:

    wa_zycet001-bukrs      to /pws/zycat030-bukrs,

    'V'                    to /pws/zycat030-tp_processo,

    wa_zycet001-codportd   to /pws/zycat030-bukrs_ext,

    wa_zycet008-waers      to /pws/zycat030-waers,

* >> Início da exclusão: FORM BUSCA_EMB_EXP

    wa_zycet008-vlme_f     to /pws/zycat030-valor,

    wa_zycet008-vlme_f     to /pws/zycat030-saldo,

* << Fim da exclusão

* >> Início da inclusão: FORM BUSCA_EMB_EXP

    v_vlme_f               to /pws/zycat030-valor,

    v_vlme_f               to /pws/zycat030-saldo,

* << Fim da inclusão

    wa_zycet001-nrseq      to /pws/zycat030-origem,

    'EE'                   to /pws/zycat030-tp_origem.

  perform informacoes_cabecalho.

  move:

    '01'                   to wa_zycat031-operacao,

    /pws/zycat030-cod_pais to wa_zycat031-cod_pais,

    wa_zycet002-fkdat      to wa_zycat031-data_ini,

* >> Início da exclusão: FORM BUSCA_EMB_EXP

    wa_zycet008-vlme_f     to wa_zycat031-valor,

* << Fim da exclusão

* >> Início da inclusão: FORM BUSCA_EMB_EXP

    v_vlme_f               to wa_zycat031-valor,

* << Fim da inclusão

    wa_zycat046-nbs        to wa_zycat031-nbs,

    wa_zycat046-modo_prest to wa_zycat031-modo_prest,

    wa_zycat031-valor      to wa_zycat031-saldo.

  append wa_zycat031 to itab_zycat031t.

endform.

form busca_pedido_compra changing p_erro.

  data: wa_zycat030   type /pws/zycat030,

        itab_zycat046 type table of /pws/zycat046,

        wa_zycat046   type /pws/zycat046,

        wa_ekko       type ty_ekko,

...

 

...

       tables

            return_tab = itab_result

       exceptions

            others     = 5.

  if sy-subrc = 0.

  else.

  endif.

  read table itab_result into wa_result index 1.

  r_item-high = wa_result-fieldval.

endform.

* >> Início da inclusão:

form busca_origem_2 changing p_erro.

  data: v_novo(1) type c.

  v_novo = 'S'.

  if not v_freteimp is initial or

     not v_segimp   is initial.

    perform busca_frete_seg_imp_2 using v_novo

                               changing p_erro.

  elseif not v_embimp is initial.

    perform busca_emb_imp_2 using v_novo

                         changing p_erro.

  elseif not v_freteexp is initial or

         not v_segexp   is initial.

    perform busca_frete_seg_exp_2 using v_novo

                               changing p_erro.

  elseif not v_embexp is initial.

    perform busca_emb_exp_2 using v_novo

                         changing p_erro.

  elseif not v_pedcomp is initial.

    perform busca_pedido_compra changing p_erro.

  endif.

endform.

form busca_emb_imp_2 using p_novo

                  changing p_erro.

  data:

    v_valor_total type /pws/zycit006-vlmerc,

    v_count       type /pws/zycat031-operacao,

    v_existe(1)   type c,

    wa_zycit003 type ty_zycit003,

    wa_zycit006 type ty_zycit006,

    wa_zycit263 type ty_zycit263,

    wa_zycat046 type /pws/zycat046,

    begin of itab_zycit001 occurs 0,

       nrseq        type /pws/zycit001-nrseq,

       bukrs        type /pws/zycit001-bukrs,

       waers        type /pws/zycit001-waers,

       j_1bbranch   type /pws/zycit001-j_1bbranch,

       modalidade   type /pws/zycit001-modalidade,

    end of itab_zycit001,

    begin of itab_zycit003 occurs 0,

       nrseq        type /pws/zycit003-nrseq,

       ebeln        type /pws/zycit003-ebeln,

       matnr        type /pws/zycit003-matnr,

    end of itab_zycit003,

    begin of itab_zycit263 occurs 0,

       nrseq        type /pws/zycit263-nrseq,

       ebeln        type /pws/zycit263-ebeln,

       nrseq_pgfat  type /pws/zycit263-nrseq_pgfat,

    end of itab_zycit263,

    begin of itab_zycit006 occurs 0,

       nrseq        type /pws/zycit006-nrseq,

       tpfatura     type /pws/zycit006-tpfatura,

       vlmerc       type /pws/zycit006-vlmerc,

       vlfre        type /pws/zycit006-vlfre,

       vlseg        type /pws/zycit006-vlseg,

       vltotal      type /pws/zycit006-vltotal,

       lifnr        type /pws/zycit006-lifnr,

       nrseqce      type /pws/zycit006-nrseqce,

       nrseq_pgfat  type /pws/zycit006-nrseq_pgfat,

    end of itab_zycit006.

    data: begin of itab_zycat046 occurs 0.

      include structure /pws/zycat046.

    data: end of itab_zycat046.

  select nrseq bukrs waers j_1bbranch modalidade

    from /pws/zycit001

    into table itab_zycit001

   where nrseq in r_embimp.

  if sy-subrc ne 0.

    p_erro = 'X'.

    message i015 with text-i25 text-i26.

    exit.

  else.

    loop at itab_zycit001.

      if itab_zycit001-modalidade ne '02'.

        message i061 with text-i30 itab_zycit001-nrseq text-i31.

        delete itab_zycit001.

      else.

        perform verifica_operacao using itab_zycit001-nrseq

                                        'EI'

                               changing v_existe.

        if v_existe eq 'X'.

          message i061 with text-i30 itab_zycit001-nrseq text-i32.

          delete itab_zycit001.

        endif.

      endif.

    endloop.

  endif.

  if p_novo = 'N'.

    loop at itab_zycit001.

      read table itab_zycat031t

                       with key nrseq_origem = itab_zycit001-nrseq.

      if sy-subrc eq 0.

        message i061 with text-i30 itab_zycit001-nrseq text-i32.

        delete itab_zycit001.

      endif.

    endloop.

  endif.

  if itab_zycit001[] is initial.

    p_erro = 'X'.

    message i015 with text-i25 text-i26.

    exit.

  endif.

  select nrseq ebeln matnr

    from /pws/zycit003

    into table itab_zycit003

    for all entries in itab_zycit001

    where nrseq = itab_zycit001-nrseq.

  select nrseq ebeln nrseq_pgfat

    from /pws/zycit263

    into table itab_zycit263

    for all entries in itab_zycit003

    where nrseq = itab_zycit003-nrseq

      and ebeln = itab_zycit003-ebeln.

  select nrseq tpfatura vlmerc  vlfre

         vlseg vltotal  lifnr   nrseqce

         nrseq_pgfat

    from /pws/zycit006

    into table itab_zycit006

    for all entries in itab_zycit263

    where nrseq_pgfat = itab_zycit263-nrseq_pgfat.

  select *

    from /pws/zycat046

    into table itab_zycat046

    for all entries in itab_zycit003

    where matnr      = itab_zycit003-matnr

      and tpprocesso = 'A'.

  if p_novo = 'S'.

    clear: v_count.

  else.

    describe table itab_zycat031t lines v_count.

  endif.

  loop at itab_zycit001.

    clear: wa_zycat031,

           wa_zycit003,

           wa_zycit006,

           wa_zycit263,

           wa_zycat046.

    v_count = v_count + 1.

    read table itab_zycit003

       into wa_zycit003 with key nrseq = itab_zycit001-nrseq.

    read table itab_zycit263

       into wa_zycit263 with key nrseq = wa_zycit003-nrseq

                                 ebeln = wa_zycit003-ebeln.

    read table itab_zycit006

       into wa_zycit006 with key nrseq_pgfat = wa_zycit263-nrseq_pgfat.

    read table itab_zycat046

       into wa_zycat046 with key matnr = wa_zycit003-matnr.

    if v_count = 1.

      move:

        itab_zycit001-bukrs       to  /pws/zycat030-bukrs,

        itab_zycit001-j_1bbranch  to  /pws/zycat030-j_1bbranch,

        'A'                       to  /pws/zycat030-tp_processo,

        wa_zycit006-lifnr         to  /pws/zycat030-bukrs_ext,

        itab_zycit001-waers       to  /pws/zycat030-waers,

        'EI'                      to  /pws/zycat030-tp_origem.

      perform informacoes_cabecalho.

    else.

      if itab_zycit001-bukrs      ne /pws/zycat030-bukrs       or

         wa_zycit006-lifnr        ne /pws/zycat030-bukrs_ext   or

         itab_zycit001-waers      ne /pws/zycat030-waers.

        message i061

                with text-i30 itab_zycit001-nrseq text-i33 text-i34.

        continue.

      endif.

    endif.

    move:

      v_count                   to  wa_zycat031-operacao,

      /pws/zycat030-cod_pais    to  wa_zycat031-cod_pais,

      wa_zycit006-vltotal       to  wa_zycat031-valor,

      wa_zycit006-vltotal       to  wa_zycat031-saldo,

      itab_zycit001-nrseq       to  wa_zycat031-nrseq_origem,

      wa_zycat046-nbs           to  wa_zycat031-nbs,

      wa_zycat046-modo_prest    to  wa_zycat031-modo_prest.

    append wa_zycat031 to itab_zycat031t.

    v_valor_total = v_valor_total + wa_zycit006-vltotal.

  endloop.

  move: v_valor_total   to  /pws/zycat030-valor,

        v_valor_total   to  /pws/zycat030-saldo.

  clear:   r_embimp.

  refresh: r_embimp.

endform.

form busca_emb_exp_2 using p_novo

                  changing p_erro.

  data:

    wa_zycat046    type /pws/zycat046,

    wa_zycet002    type ty_zycet002,

    wa_zycet008    type ty_zycet008_aux,

    v_vlme_f       type /pws/zycet008-vlme_f,

    v_val_tot_exp  type /pws/zycit006-vlmerc,

    v_count        type /pws/zycat031-operacao,

    v_existe(1)    type c,

    begin of itab_zycet001 occurs 0,

       nrseq      type /pws/zycet001-nrseq,

       bukrs      type /pws/zycet001-bukrs,

       dtemb      type /pws/zycet001-dtemb,

       codportd   type /pws/zycet001-codportd,

       tipo_emb   type /pws/zycet001-tipo_emb,

    end of itab_zycet001,

    begin of itab_zycet002 occurs 0,

       nrseq      type /pws/zycet002-nrseq,

       fkdat      type /pws/zycet002-fkdat,

       matnr      type /pws/zycet002-matnr,

    end of itab_zycet002,

    begin of itab_zycet008 occurs 0,

       nrseq      type /pws/zycet008-nrseq,

       codigo     type /pws/zycet008-codigo,

       vlme_f     type /pws/zycet008-vlme_f,

       waers      type /pws/zycet008-waers,

    end of itab_zycet008.

  data: begin of itab_zycat030 occurs 0.

    include structure /pws/zycat030.

  data: end of itab_zycat030.

  data: begin of itab_zycat046 occurs 0.

    include structure /pws/zycat046.

  data: end of itab_zycat046.

  data: begin of itab_zycet156 occurs 0.

    include structure /pws/zycet156.

  data: end of itab_zycet156.

  select nrseq bukrs dtemb codportd tipo_emb

    from /pws/zycet001

    into table itab_zycet001

    where nrseq in r_embexp.

  if sy-subrc ne 0.

    p_erro = 'X'.

    message i015 with text-i25 text-i26.

    exit.

  endif.

  loop at itab_zycet001.

    if itab_zycet001-tipo_emb ne 'E'.

      message i061 with text-i30 itab_zycet001-nrseq text-i31.

      delete itab_zycet001.

    else.

      perform verifica_operacao using itab_zycet001-nrseq

                                      'EE'

                             changing v_existe.

      if v_existe eq 'X'.

        message i061 with text-i30 itab_zycet001-nrseq text-i32.

        delete itab_zycet001.

      endif.

    endif.

  endloop.

  if p_novo = 'N'.

    loop at itab_zycet001.

      read table itab_zycat031t

                       with key nrseq_origem = itab_zycet001-nrseq.

      if sy-subrc eq 0.

        message i061 with text-i30 itab_zycet001-nrseq text-i32.

        delete itab_zycet001.

      endif.

    endloop.

  endif.

  if itab_zycet001[] is initial.

    p_erro = 'X'.

    message i015 with text-i25 text-i26.

    exit.

  endif.

  select nrseq fkdat matnr

    from /pws/zycet002

    into table itab_zycet002

    for all entries in itab_zycet001

    where nrseq  =  itab_zycet001-nrseq.

  select * from /pws/zycet156

    into table itab_zycet156

    for all entries in itab_zycet001

    where bukrs    = itab_zycet001-bukrs

      and codmod   = 'X'

      and proccond = 'FOB'.

  if sy-subrc eq 0.

    select nrseq codigo vlme_f waers

      from /pws/zycet008

      into table itab_zycet008

      for all entries in itab_zycet001

      where nrseq  = itab_zycet001-nrseq.

    if sy-subrc eq 0.

      loop at itab_zycet008.

        read table itab_zycet156 with key codigo = itab_zycet008-codigo.

        if sy-subrc ne 0.

          delete itab_zycet008.

        endif.

      endloop.

    endif.

  endif.

  select *

    from /pws/zycat046

    into table itab_zycat046

    for all entries in itab_zycet002

    where matnr      = itab_zycet002-matnr

      and tpprocesso = 'V'.

  if p_novo = 'S'.

    clear: v_count.

  else.

    describe table itab_zycat031t lines v_count.

  endif.

  loop at itab_zycet001.

    clear: wa_zycat031,

           wa_zycat046,

           wa_zycet002,

           wa_zycet008,

           v_vlme_f.

    v_count = v_count + 1.

    loop at itab_zycet008 into wa_zycet008

                               where nrseq = itab_zycet001-nrseq.

      v_vlme_f = v_vlme_f + wa_zycet008-vlme_f.

    endloop.

    if v_count eq 1.

      move:

        itab_zycet001-bukrs      to /pws/zycat030-bukrs,

        'V'                      to /pws/zycat030-tp_processo,

        itab_zycet001-codportd   to /pws/zycat030-bukrs_ext,

        wa_zycet008-waers        to /pws/zycat030-waers,

        'EE'                     to /pws/zycat030-tp_origem.

      perform informacoes_cabecalho.

    else.

      if itab_zycet001-bukrs      ne /pws/zycat030-bukrs       or

         itab_zycet001-codportd   ne /pws/zycat030-bukrs_ext   or

         wa_zycet008-waers        ne /pws/zycat030-waers.

        message i061

                with text-i30 itab_zycet001-nrseq text-i33 text-i34.

        continue.

      endif.

    endif.

    read table itab_zycet002

       into wa_zycet002 with key nrseq = itab_zycet001-nrseq.

    read table itab_zycat046

       into wa_zycat046 with key matnr = wa_zycet002-matnr.

    move:

      v_count                 to  wa_zycat031-operacao,

      /pws/zycat030-cod_pais  to  wa_zycat031-cod_pais,

      v_vlme_f                to  wa_zycat031-valor,

      v_vlme_f                to  wa_zycat031-saldo,

      itab_zycet001-nrseq     to  wa_zycat031-nrseq_origem,

      wa_zycet002-fkdat       to  wa_zycat031-data_ini,

      wa_zycat046-nbs         to  wa_zycat031-nbs,

      wa_zycat046-modo_prest  to  wa_zycat031-modo_prest.

    append wa_zycat031 to itab_zycat031t.

    v_val_tot_exp = v_val_tot_exp + v_vlme_f.

  endloop.

  move: v_val_tot_exp  to /pws/zycat030-valor,

        v_val_tot_exp  to /pws/zycat030-saldo.

  clear:   r_embexp.

  refresh: r_embexp.

endform.

form busca_frete_seg_imp_2 using p_novo

                        changing p_erro.

  data:

    wa_zycit085   type ty_zycit085,

    wa_zycit093   type ty_zycit093,

    wa_zycit006   type ty_zycit006,

    wa_zycit001   type ty_zycit001,

    wa_zycat046   type /pws/zycat046,

    v_existe(1)   type c,

    v_count       type /pws/zycat031-operacao,

    v_valor_aux   type /pws/zycat030-valor,

    v_valor_soma  type /pws/zycat030-valor,

    v_tp_origem   type /pws/zycat030-tp_origem,

    v_tp_fatura   type /pws/zycit006-tpfatura,

    v_matnr       type /pws/zycat046-matnr,

    begin of itab_zycit094 occurs 0,

       nrseqce type /pws/zycit094-nrseqce,

       nrseq   type /pws/zycit094-nrseq,

    end of itab_zycit094,

    begin of itab_zycit006 occurs 0,

       nrseq        type /pws/zycit006-nrseq,

       tpfatura     type /pws/zycit006-tpfatura,

       vlmerc       type /pws/zycit006-vlmerc,

       vlfre        type /pws/zycit006-vlfre,

       vlseg        type /pws/zycit006-vlseg,

       vltotal      type /pws/zycit006-vltotal,

       lifnr        type /pws/zycit006-lifnr,

       nrseqce      type /pws/zycit006-nrseqce,

       nrseq_pgfat  type /pws/zycit006-nrseq_pgfat,

    end of itab_zycit006,

    begin of itab_zycit001 occurs 0,

       nrseq        type /pws/zycit001-nrseq,

       bukrs        type /pws/zycit001-bukrs,

       waers        type /pws/zycit001-waers,

       j_1bbranch   type /pws/zycit001-j_1bbranch,

       modalidade   type /pws/zycit001-modalidade,

    end of itab_zycit001,

    begin of itab_zycit093 occurs 0,

       nrseqce      type /pws/zycit093-nrseqce,

       dtemiss      type /pws/zycit093-dtemiss,

       dtcheg       type /pws/zycit093-dtcheg,

       vlfre        type /pws/zycit093-vlfre,

    end of itab_zycit093,

    begin of itab_zycit085 occurs 0,

       nrseqdi      type /pws/zycit085-nrseqdi,

       nrdi         type /pws/zycit085-nrdi,

       nrbl         type /pws/zycit085-nrbl,

       vlseg        type /pws/zycit085-vlseg,

    end of itab_zycit085.

  if not v_freteimp is initial.

    v_tp_origem = 'FI'.

    v_tp_fatura = '02'.

    v_matnr     = 'FRT'.

  elseif not v_segimp is initial.

    v_tp_origem = 'SI'.

    v_tp_fatura = '03'.

    v_matnr     = 'SEG'.

  endif.

  select nrseqce nrseq

    from /pws/zycit094

    into table itab_zycit094

    where nrseq in r_embimp.

  if sy-subrc ne 0.

    p_erro = 'X'.

    message i015 with text-i25 text-i26.

    exit.

  endif.

  loop at itab_zycit094.

    perform verifica_operacao using itab_zycit094-nrseq

                                    v_tp_origem

                           changing v_existe.

    if v_existe = 'X'.

      message i061 with text-i30 itab_zycit094-nrseq text-i32.

      delete itab_zycit094.

    endif.

  endloop.

  if p_novo = 'N'.

    loop at itab_zycit094.

      read table itab_zycat031t

                       with key nrseq_origem = itab_zycit094-nrseq.

      if sy-subrc eq 0.

        message i061 with text-i30 itab_zycit094-nrseq text-i32.

        delete itab_zycit094.

      endif.

    endloop.

  endif.

  if itab_zycit094[] is initial.

    p_erro = 'X'.

    message i015 with text-i25 text-i26.

    exit.

  endif.

  select nrseq tpfatura vlmerc  vlfre

         vlseg vltotal  lifnr   nrseqce

         nrseq_pgfat

    from /pws/zycit006

    into table itab_zycit006

    for all entries in itab_zycit094

    where nrseqce = itab_zycit094-nrseqce.

  if sy-subrc ne 0.

    p_erro = 'X'.

    message i015 with text-i25 text-i26.

    exit.

  endif.

  select nrseq bukrs waers j_1bbranch modalidade

    from /pws/zycit001

    into table itab_zycit001

    for all entries in itab_zycit094

    where nrseq = itab_zycit094-nrseq.

  select nrseqce dtemiss dtcheg vlfre

    from /pws/zycit093

    into table itab_zycit093

    for all entries in itab_zycit094

    where nrseqce = itab_zycit094-nrseqce.

  select nrseqdi nrdi nrbl vlseg

    from /pws/zycit085

    into table itab_zycit085

    for all entries in itab_zycit094

    where nrbl = itab_zycit094-nrseqce.

  select single *

    from /pws/zycat046

    into wa_zycat046

    where matnr = v_matnr

      and tpprocesso = 'A'.

  if p_novo = 'S'.

    clear: v_count.

  else.

    describe table itab_zycat031t lines v_count.

  endif.

  loop at itab_zycit094.

    clear: wa_zycat031,

           wa_zycit085,

           wa_zycit093,

           wa_zycit006,

           wa_zycit001,

           v_valor_aux.

    v_count = v_count + 1.

    read table itab_zycit001

       into wa_zycit001 with key nrseq   = itab_zycit094-nrseq.

    read table itab_zycit093

       into wa_zycit093 with key nrseqce = itab_zycit094-nrseqce.

    read table itab_zycit085

       into wa_zycit085 with key nrbl    = itab_zycit094-nrseqce.

    read table itab_zycit006 into wa_zycit006

      with key tpfatura = v_tp_fatura.

    if sy-subrc ne 0.

      read table itab_zycit006 into wa_zycit006 index 1.

    endif.

    if v_count eq 1.

      move:

        wa_zycit001-bukrs         to /pws/zycat030-bukrs,

        wa_zycit001-j_1bbranch    to /pws/zycat030-j_1bbranch,

        wa_zycit001-waers         to /pws/zycat030-waers,

        wa_zycit006-lifnr         to /pws/zycat030-bukrs_ext,

        'A'                       to /pws/zycat030-tp_processo,

        v_tp_origem               to /pws/zycat030-tp_origem.

      perform informacoes_cabecalho.

    else.

      if wa_zycit001-bukrs      ne /pws/zycat030-bukrs       or

         wa_zycit006-lifnr      ne /pws/zycat030-bukrs_ext   or

         wa_zycit001-waers      ne /pws/zycat030-waers.

        message i061

                with text-i30 itab_zycit094-nrseq text-i33 text-i34.

        continue.

      endif.

    endif.

    if v_tp_origem = 'FI'.

      if not wa_zycit093-vlfre is initial.

        v_valor_aux = wa_zycit093-vlfre.

      else.

        read table itab_zycit006 into wa_zycit006

          with key nrseqce  = itab_zycit094-nrseqce

                   tpfatura = v_tp_fatura.

        if sy-subrc eq 0.

          v_valor_aux = wa_zycit006-vlfre.

        endif.

      endif.

    else.

      if not wa_zycit085-vlseg is initial.

        v_valor_aux = wa_zycit085-vlseg.

      else.

        read table itab_zycit006 into wa_zycit006

          with key nrseqce  = itab_zycit094-nrseqce

                   tpfatura = v_tp_fatura.

        if sy-subrc eq 0.

          v_valor_aux = wa_zycit006-vlseg.

        endif.

      endif.

    endif.

    move:

      v_count                 to wa_zycat031-operacao,

      /pws/zycat030-cod_pais  to wa_zycat031-cod_pais,

      '1'                     to wa_zycat031-modo_prest,

      wa_zycit093-dtemiss     to wa_zycat031-data_ini,

      wa_zycit093-dtcheg      to wa_zycat031-data_fim,

      v_valor_aux             to wa_zycat031-valor,

      v_valor_aux             to wa_zycat031-saldo,

      itab_zycit094-nrseq     to wa_zycat031-nrseq_origem,

      wa_zycat046-nbs         to wa_zycat031-nbs,

      wa_zycat046-modo_prest  to wa_zycat031-modo_prest.

    append wa_zycat031 to itab_zycat031t.

    v_valor_soma = v_valor_soma + v_valor_aux.

    if not wa_zycit085-nrdi is initial.

      perform inicializa_texto.

      if v_tp_origem = 'FI'.

        concatenate text-001 wa_zycit085-nrdi into wa_src-line

          separated by space.

      else.

        concatenate text-002 wa_zycit085-nrdi into wa_src-line

          separated by space.

      endif.

      append wa_src to itab_src.

      clear wa_src.

     call method editor->set_text_as_r3table

                                   exporting table = itab_src[].

    endif.

  endloop.

  move: v_valor_soma   to  /pws/zycat030-valor,

        v_valor_soma   to  /pws/zycat030-saldo.

  clear:   r_embimp.

  refresh: r_embimp.

endform.

form busca_frete_seg_exp_2 using p_novo

                        changing p_erro.

  data:

    wa_zycat046    type /pws/zycat046,

    wa_zycet003    type ty_zycet003,

    wa_zycet008    type ty_zycet008_aux,

    wa_zycet116    type ty_zycet116,

    v_valor_total  type /pws/zycit006-vlmerc,

    v_vlme_f       type /pws/zycet008-vlme_f,

    v_tp_origem    type /pws/zycat030-tp_origem,

    v_kschl        type /pws/zycet156-kschl,

    v_matnr        type /pws/zycat046-matnr,

    v_count        type /pws/zycat031-operacao,

    v_existe(1)    type c,

    begin of itab_zycet001 occurs 0,

       nrseq      type /pws/zycet001-nrseq,

       bukrs      type /pws/zycet001-bukrs,

       dtemb      type /pws/zycet001-dtemb,

       codportd   type /pws/zycet001-codportd,

       tipo_emb   type /pws/zycet001-tipo_emb,

    end of itab_zycet001,

    begin of itab_zycet003 occurs 0,

       nrseq      type /pws/zycet003-nrseq,

       nrseqre    type /pws/zycet003-nrseqre,

    end of itab_zycet003,

    begin of itab_zycet008 occurs 0,

       nrseq      type /pws/zycet008-nrseq,

       codigo     type /pws/zycet008-codigo,

       vlme_f     type /pws/zycet008-vlme_f,

       waers      type /pws/zycet008-waers,

    end of itab_zycet008,

    begin of itab_zycet116 occurs 0,

       nrseqre    type /pws/zycet116-nrseqre,

       nrre       type /pws/zycet116-nrre,

       j_1bbranch type /pws/zycet116-j_1bbranch,

    end of itab_zycet116.

    data: begin of itab_zycet156 occurs 0.

      include structure /pws/zycet156.

    data: end of itab_zycet156.

  if not v_freteexp is initial.

    v_tp_origem = 'FE'.

    v_kschl     = 'ZFTE'.

    v_matnr     = 'FRT'.

  elseif not v_segexp is initial.

    v_tp_origem = 'SE'.

    v_kschl     = 'ZSEG'.

    v_matnr     = 'SEG'.

  endif.

  select nrseq bukrs dtemb codportd tipo_emb

    from /pws/zycet001

    into table itab_zycet001

    where nrseq in r_embexp.

  if sy-subrc ne 0.

    p_erro = 'X'.

    message i015 with text-i25 text-i26.

    exit.

  endif.

  loop at itab_zycet001.

    perform verifica_operacao using itab_zycet001-nrseq

                                    v_tp_origem

                           changing v_existe.

    if v_existe = 'X'.

      message i061 with text-i30 itab_zycet001-nrseq text-i32.

      delete itab_zycet001.

    endif.

  endloop.

  if p_novo = 'N'.

    loop at itab_zycet001.

      read table itab_zycat031t

                       with key nrseq_origem = itab_zycet001-nrseq.

      if sy-subrc eq 0.

        message i061 with text-i30 itab_zycet001-nrseq text-i32.

        delete itab_zycet001.

      endif.

    endloop.

  endif.

  if itab_zycet001[] is initial.

    p_erro = 'X'.

    message i015 with text-i25 text-i26.

    exit.

  endif.

  select nrseq nrseqre

    from /pws/zycet003

    into table itab_zycet003

    for all entries in itab_zycet001

    where nrseq = itab_zycet001-nrseq.

  select * from /pws/zycet156

    into table itab_zycet156

    for all entries in itab_zycet001

    where bukrs     = itab_zycet001-bukrs

      and codmod    = 'X'

      and proccond  = v_matnr.

  if sy-subrc eq 0.

    select nrseq codigo vlme_f waers

      from /pws/zycet008

      into table itab_zycet008

      for all entries in itab_zycet001

      where nrseq  = itab_zycet001-nrseq.

    if sy-subrc eq 0.

      loop at itab_zycet008.

        read table itab_zycet156 with key codigo = itab_zycet008-codigo.

        if sy-subrc ne 0.

          delete itab_zycet008.

        endif.

      endloop.

    endif.

  endif.

  select nrseqre nrre j_1bbranch

    from /pws/zycet116

    into table itab_zycet116

    for all entries in itab_zycet003

    where nrseqre = itab_zycet003-nrseqre.

  select single *

    from /pws/zycat046

    into wa_zycat046

    where matnr      = v_matnr

      and tpprocesso = 'V'.

  if p_novo = 'S'.

    clear: v_count.

  else.

    describe table itab_zycat031t lines v_count.

  endif.

  loop at itab_zycet001.

    clear: v_vlme_f,

           wa_zycat031,

           wa_zycet003,

           wa_zycet116,

           wa_zycet008.

    v_count = v_count +  1.

    read table itab_zycet003

       into wa_zycet003 with key nrseq = itab_zycet001-nrseq.

    read table itab_zycet116

       into wa_zycet116 with key nrseqre = itab_zycet003-nrseqre.

    loop at itab_zycet008 into wa_zycet008

                                     where nrseq = itab_zycet001-nrseq.

      v_vlme_f = v_vlme_f + wa_zycet008-vlme_f.

    endloop.

    if v_count = 1.

      move:

        itab_zycet001-bukrs      to /pws/zycat030-bukrs,

        wa_zycet116-j_1bbranch   to /pws/zycat030-j_1bbranch,

        'V'                      to /pws/zycat030-tp_processo,

        itab_zycet001-codportd   to /pws/zycat030-bukrs_ext,

        wa_zycet008-waers        to /pws/zycat030-waers,

        v_tp_origem              to /pws/zycat030-tp_origem.

      perform informacoes_cabecalho.

    else.

      if itab_zycet001-bukrs     ne /pws/zycat030-bukrs       or

         itab_zycet001-codportd  ne /pws/zycat030-bukrs_ext   or

         wa_zycet008-waers       ne /pws/zycat030-waers.

        message i061

                with text-i30 itab_zycet001-nrseq text-i33 text-i34.

        continue.

      endif.

    endif.

    move:

      v_count                 to wa_zycat031-operacao,

      /pws/zycat030-cod_pais  to wa_zycat031-cod_pais,

      itab_zycet001-dtemb     to wa_zycat031-data_ini,

      v_vlme_f                to wa_zycat031-valor,

      v_vlme_f                to wa_zycat031-saldo,

      itab_zycet001-nrseq     to wa_zycat031-nrseq_origem,

      wa_zycat046-nbs         to wa_zycat031-nbs,

      wa_zycat046-modo_prest  to wa_zycat031-modo_prest.

    append wa_zycat031 to itab_zycat031t.

    v_valor_total = v_valor_total + v_vlme_f.

    if not wa_zycet116-nrre is initial.

      perform inicializa_texto.

      if not v_freteexp is initial.

        concatenate text-003 wa_zycet116-nrre into wa_src-line

          separated by space.

      elseif not v_segexp is initial.

        concatenate text-004 wa_zycet116-nrre into wa_src-line

          separated by space.

      endif.

      append wa_src to itab_src.

      clear wa_src.

     call method editor->set_text_as_r3table

                                   exporting table = itab_src[].

   endif.

  endloop.

  move: v_valor_total  to  /pws/zycat030-valor,

        v_valor_total  to  /pws/zycat030-saldo.

  clear:   r_embexp.

  refresh: r_embexp.

endform.

form verifica_operacao using p_nrseq_op

                             p_origem_op

                    changing p_existe.

  data:

    wa_zycat030  type /pws/zycat030,

    wa_zycat031  type /pws/zycat031.

  clear p_existe.

  select single *

    from /pws/zycat031

    into wa_zycat031

   where nrseq_origem = p_nrseq_op.

  if sy-subrc eq 0.

    select single *

      from /pws/zycat030

      into wa_zycat030

      where nrseq      = wa_zycat031-nrseq

        and status    ne 'EX'

        and tp_origem  = p_origem_op.

    if sy-subrc eq 0.

      p_existe = 'X'.

    endif.

  else.

    select single *

      from /pws/zycat030

      into wa_zycat030

      where origem     = p_nrseq_op

        and status    ne 'EX'

        and tp_origem  = p_origem_op.

    if sy-subrc eq 0.

      p_existe = 'X'.

    endif.

  endif.

endform.

form user_command_0007.

  data: v_novo(1) type c,

        v_erro(1) type c.

  v_novo = 'N'.

  case v_okcode.

    when 'CONFIRM'.

      if not v_freteimp is initial or

         not v_segimp   is initial.

        perform busca_frete_seg_imp_2 using v_novo

                                   changing v_erro.

      elseif not v_embimp is initial.

        perform busca_emb_imp_2 using v_novo

                             changing v_erro.

      endif.

      clear:   r_embimp.

      refresh: r_embimp.

      set screen 0.

      leave screen.

    when 'CANCEL'.

      clear:   r_embimp.

      refresh: r_embimp.

      set screen 0.

      leave screen.

  endcase.

endform.

form user_command_0008.

  data: v_novo(1) type c,

        v_erro(1) type c.

  v_novo = 'N'.

  case v_okcode.

    when 'CONFIRM'.

      if not v_freteexp is initial or

         not v_segexp   is initial.

        perform busca_frete_seg_exp_2 using v_novo

                                   changing v_erro.

      elseif not v_embexp is initial.

        perform busca_emb_exp_2 using v_novo

                             changing v_erro.

      endif.

      clear:   r_embexp.

      refresh: r_embexp.

      set screen 0.

      leave screen.

    when 'CANCEL'.

      clear:   r_embexp.

      refresh: r_embexp.

      set screen 0.

      leave screen.

  endcase.

endform.

* << Fim da inclusão

 

----------------------------------------------------------------------------------------------------

Modificações efetuadas em REPS /PWS/MZYCA011I01

 

MODULE user_command INPUT.

  CASE sy-dynnr.

    WHEN '0001'.

      PERFORM user_command_0001.

    WHEN '0002'.

      PERFORM user_command_0002.

    WHEN '0003'.

      PERFORM user_command_0003.

* >> Início da inclusão: MODULE USER_COMMAND

    when '0007'.

      perform user_command_0007.

    when '0008'.

      perform user_command_0008.

* << Fim da inclusão

    WHEN '0100'.

      PERFORM user_command_0100.

    WHEN '0101'.

      PERFORM user_command_0101.

    WHEN '0102'.

      PERFORM user_command_0102.

    WHEN '0103'.

      PERFORM user_command_0103.

  ENDCASE.

ENDMODULE.

MODULE exit_command INPUT.

  CASE sy-dynnr.

    WHEN '0001'.

      LEAVE PROGRAM.

    WHEN '0002'.

      CLEAR v_path.

      SET SCREEN 0.

      LEAVE SCREEN.

    WHEN '0003'.

      LEAVE PROGRAM.

* >> Início da inclusão: MODULE EXIT_COMMAND

    when '0007' or '0008'.

      set screen 0.

      leave screen.

* << Fim da inclusão

    WHEN '0100'.

      LEAVE PROGRAM.

    WHEN '0102'.

      CLEAR: v_nrseq_enq, v_oper_enq, /pws/zycat032.

      FREE: itab_zycat032t.

      SET SCREEN 0.

      LEAVE SCREEN.

  ENDCASE.

ENDMODULE.

MODULE emp_ext INPUT.

...

 

 

----------------------------------------------------------------------------------------------------

Modificações efetuadas em REPS /PWS/MZYCA011O01

 

...

           screen-name EQ '/PWS/ZYCAT030-TP_PROCESSO' .

          screen-input = '0'.

        ELSEIF screen-name EQ '/PWS/ZYCAT030-STATUS' OR

               screen-name EQ '/PWS/ZYCAT030-N_RVS_RAS'.

          IF /pws/zycat030-processamento IS INITIAL.

            screen-input = '0'.

          ELSE.

            screen-input = '1'.

          ENDIF.

        ENDIF.

* >> Início da inclusão: MODULE STATUS_0100

        if v_sorigem is initial.

          if screen-name eq '/PWS/ZYCAT030-BUKRS_EXT' or

             screen-name eq '/PWS/ZYCAT030-WAERS' .

            screen-input = '0'.

          endif.

        endif.

* << Fim da inclusão

        MODIFY SCREEN.

      ENDLOOP.

    ELSE.

      LOOP AT SCREEN.

        IF screen-name EQ '/PWS/ZYCAT030-STATUS' OR

           screen-name EQ '/PWS/ZYCAT030-N_RVS_RAS'.

          IF /pws/zycat030-processamento IS INITIAL.

            screen-input = '0'.

          ELSE.

            screen-input = '1'.

* >> Início da inclusão: MODULE STATUS_0100

          endif.

          modify screen.

        endif.

        if v_sorigem is initial.

          if screen-name eq '/PWS/ZYCAT030-BUKRS_EXT' or

             screen-name eq '/PWS/ZYCAT030-WAERS' .

            screen-input = '0'.

* << Fim da inclusão

          ENDIF.

          MODIFY SCREEN.

        ENDIF.

      ENDLOOP.

    ENDIF.

  ELSE.

    LOOP AT SCREEN.

      IF screen-name NE 'TB_OP' AND

         screen-name NE 'TB_RE'        AND

         screen-name NE 'TAB_INFC'.

...

 

...

      ENDIF.

    ENDLOOP.

    LOOP AT tc_oper-cols INTO wa_cols.

      IF wa_cols-screen-name NE 'BT_ENQ'.

        wa_cols-screen-input = '0'.

        IF wa_cols-screen-name = '/PWS/ZYCAT031-EBELP'.

          wa_cols-screen-input = '0'.

          wa_cols-screen-active = '0'.

          wa_cols-invisible     = '1'.

        ENDIF.

* >> Início da inclusão: MODULE STATUS_0101

        if wa_cols-screen-name = '/PWS/ZYCAT031-NRSEQ_ORIGEM'.

          wa_cols-screen-input = '0'.

          wa_cols-invisible     = '1'.

        endif.

* << Fim da inclusão

        MODIFY tc_oper-cols FROM wa_cols.

      ENDIF.

    ENDLOOP.

  ELSE.

    LOOP AT SCREEN.

      screen-input = '1'.

* >> Início da inclusão: MODULE STATUS_0101

      if screen-name = 'B_INCLUI'.

        if ( sy-tcode        eq '/PWS/ZYCA011_C' and

             wa_zycat030_ant is initial )        or

           ( v_sorigem       eq 'X'   or

             v_pedcomp       eq 'X' ).

          screen-invisible = '1'.

        endif.

      endif.

* << Fim da inclusão

      MODIFY SCREEN.

    ENDLOOP.

    LOOP AT tc_oper-cols INTO wa_cols.

      IF wa_cols-screen-name NE '/PWS/ZYCAT031-SALDO'  AND

         wa_cols-screen-name NE '/PWS/ZYCAT031-WAERS'  AND

         wa_cols-screen-name NE '/PWS/ZYCAT031-STATUS' AND

         wa_cols-screen-name NE '/PWS/ZYCAT031-EBELP'.

        wa_cols-screen-input = '1'.

      ENDIF.

      IF wa_cols-screen-name = '/PWS/ZYCAT031-STATUS' AND

        NOT /pws/zycat030-processamento IS INITIAL.

        wa_cols-screen-input = '1'.

      ELSEIF wa_cols-screen-name = '/PWS/ZYCAT031-STATUS' AND

        /pws/zycat030-processamento IS INITIAL.

        wa_cols-screen-input = '0'.

      ELSEIF wa_cols-screen-name = '/PWS/ZYCAT031-EBELP'.

        wa_cols-screen-input = '0'.

        wa_cols-screen-active = '0'.

* >> Início da inclusão: MODULE STATUS_0101

        wa_cols-invisible     = '1'.

      elseif wa_cols-screen-name = '/PWS/ZYCAT031-NRSEQ_ORIGEM'.

        wa_cols-screen-input = '0'.

* << Fim da inclusão

        wa_cols-invisible     = '1'.

      ENDIF.

      MODIFY tc_oper-cols FROM wa_cols.

    ENDLOOP.

  ENDIF.

ENDMODULE.

MODULE status_0103 OUTPUT.

  IF v_exibe IS INITIAL.

    LOOP AT SCREEN.

      screen-input = '1'.

...

 

...

    MESSAGE e015 WITH text-e32 text-e33.

  ENDIF.

ENDMODULE.

MODULE status_0002 OUTPUT.

  SET PF-STATUS '0002'.

ENDMODULE.

MODULE status_0003 OUTPUT.

  SET PF-STATUS '0003'.

  SET TITLEBAR '0003'.

ENDMODULE.

* >> Início da inclusão:

module status_0007 output.

  set pf-status '0007'.

  set titlebar '0007'.

endmodule.

module status_0008 output.

  set pf-status '0008'.

  set titlebar '0008'.

endmodule.

* << Fim da inclusão

 

----------------------------------------------------------------------------------------------------

Modificações efetuadas em REPS /PWS/MZYCA011TOP

 

...

end of ty_zycet002,

begin of ty_zycet003,

  nrseq      type /pws/zycet003-nrseq,

  nrseqre    type /pws/zycet003-nrseqre,

end of ty_zycet003,

begin of ty_zycet008,

  nrseq      type /pws/zycet008-nrseq,

  vlme_f     type /pws/zycet008-vlme_f,

  waers      type /pws/zycet008-waers,

end of ty_zycet008,

* >> Início da inclusão:

begin of ty_zycet008_aux,

  nrseq      type /pws/zycet008-nrseq,

  codigo     type /pws/zycet008-codigo,

  vlme_f     type /pws/zycet008-vlme_f,

  waers      type /pws/zycet008-waers,

end of ty_zycet008_aux,

* << Fim da inclusão

begin of ty_zycet116,

  nrseqre    type /pws/zycet116-nrseqre,

  nrre       type /pws/zycet116-nrre,

  j_1bbranch type /pws/zycet116-j_1bbranch,

end of ty_zycet116,

begin of ty_ekko,

  ebeln type ekko-ebeln,

  bukrs type ekko-ebeln,

  lifnr type ekko-lifnr,

  waers type ekko-waers,

...

 

...

      v_embexp     type c,

      v_pedcomp    type c.

controls: ts_contrato   type tabstrip,

          tc_oper       type tableview using screen '0101',

          tc_enq        type tableview using screen '0102',

          tc_re         type tableview using screen '0103'.

data editor        type ref to cl_gui_textedit.

data editcontainer type ref to cl_gui_custom_container.

data: gos type ref to /pws/zygl_cl_gos.

selection-screen begin of screen 0004 as subscreen.

* >> Início da exclusão:

select-options  r_embimp for /pws/zycit001-nrseq

  no intervals no-extension.

* << Fim da exclusão

* >> Início da inclusão:

select-options  r_embimp for /pws/zycit001-nrseq.

* << Fim da inclusão

selection-screen skip 1.

selection-screen end of screen 0004.

selection-screen begin of screen 0005 as subscreen.

* >> Início da exclusão:

select-options  r_embexp for /pws/zycet001-nrseq

  no intervals no-extension.

* << Fim da exclusão

* >> Início da inclusão:

select-options  r_embexp for /pws/zycet001-nrseq.

* << Fim da inclusão

selection-screen end of screen 0005.

selection-screen begin of screen 0006 as subscreen.

select-options:

  r_pcompr for ekpo-ebeln no intervals no-extension,

  r_item   for ekpo-ebelp.

selection-screen end of screen 0006.

at selection-screen output.

  case sy-dynnr.

    when '0004' or '0005' or '0006'.

      perform set_screen_origem.

...

 

 

----------------------------------------------------------------------------------------------------

Modificações efetuadas em REPS /PWS/MZYCA012F01

 

...

                e_objname  = v_objname

           tables

                t_zycat041 = itab_zycat041.

      read table itab_zycat041 into wa_zycat041

        with key nbs = /pws/zycat031-nbs.

      if sy-subrc eq 0.

        v_nbs = wa_zycat041-descricao.

      endif.

    endif.

  endif.

* >> Início da inclusão: FORM SELECIONA_DADOS_MODIF

  move-corresponding /pws/zycat030 to wa_zycat030.

  if wa_zycat030-origem is initial.

    wa_zycat030-origem = /pws/zycat031-nrseq_origem.

  endif.

* << Fim da inclusão

  refresh: itab_zycat039_r, itab_zycat039_c,

           itab_zycat039_f, itab_zycat039_o,

           itab_zycat039_fe.

  loop at itab_zycat039 into wa_zycat039.

    if not wa_zycat039-remessa is initial.

      append wa_zycat039 to itab_zycat039_r.

    elseif not wa_zycat039-fat_comis is initial.

      append wa_zycat039 to itab_zycat039_c.

    elseif not wa_zycat039-fat_imp is initial.

      append wa_zycat039 to itab_zycat039_f.

    elseif not wa_zycat039-fatura is initial.

      append wa_zycat039 to itab_zycat039_o.

    elseif not wa_zycat039-fat_exp is initial.

      append wa_zycat039 to itab_zycat039_fe.

    endif.

  endloop.

  itab_zycat039_ant[] = itab_zycat039[].

  clear v_okcode.

  v_screen = sy-dynnr.

  clear: v_okcode, v_dynnr.

* >> Início da exclusão: FORM SELECIONA_DADOS_MODIF

  if not /pws/zycat030-origem is initial

* << Fim da exclusão

* >> Início da inclusão: FORM SELECIONA_DADOS_MODIF

  if not wa_zycat030-origem is initial

* << Fim da inclusão

     and itab_zycat039[] is initial.

    if /pws/zycat030-tp_origem = 'FI' or

       /pws/zycat030-tp_origem = 'SI' or

       /pws/zycat030-tp_origem = 'EI'.

* >> Início da exclusão: FORM SELECIONA_DADOS_MODIF

      wa_zycat039f-fat_imp = /pws/zycat030-origem.

* << Fim da exclusão

* >> Início da inclusão: FORM SELECIONA_DADOS_MODIF

      wa_zycat039f-fat_imp = wa_zycat030-origem.

* << Fim da inclusão

      perform atualiza_itab tables  itab_zycat039_f

                            using   wa_zycat039f

                                    tc_fatimp.

    elseif /pws/zycat030-tp_origem = 'FE' or

           /pws/zycat030-tp_origem = 'SE' or

           /pws/zycat030-tp_origem = 'EE'.

* >> Início da exclusão: FORM SELECIONA_DADOS_MODIF

      wa_zycat039fe-fat_exp = /pws/zycat030-origem.

* << Fim da exclusão

* >> Início da inclusão: FORM SELECIONA_DADOS_MODIF

      wa_zycat039fe-fat_exp = wa_zycat030-origem.

* << Fim da inclusão

      wa_zycat039fe-moeda   = /pws/zycat030-waers.

      wa_zycat039fe-valor   = /pws/zycat030-valor.

      perform atualiza_itab tables  itab_zycat039_fe

                            using   wa_zycat039fe

                                    tc_fatexp.

    endif.

    perform calcula_saldo.

  endif.

  if /pws/zycat030-tp_origem = 'PC'.

    perform busca_doc_pedido using /pws/zycat030-origem

...

 

...

        wa_zycbt017-waers to p_wa_zycat039-moeda,

        wa_zycbt017-kunag to p_bukext.

  loop at itab_zycbt006 into wa_zycbt006.

    v_vlpago = v_vlpago + wa_zycbt006-vlme.

  endloop.

  if v_vlpago < v_vlavinc.

    message i015 with text-i13 text-i09.

    clear: p_pago, /pws/zycat030-origem.

    exit.

  endif.

* >> Início da exclusão: FORM VALIDA_EXPORTACAO

  if /pws/zycat030-origem is initial.

* << Fim da exclusão

* >> Início da inclusão: FORM VALIDA_EXPORTACAO

  if wa_zycat030-origem is initial.

* << Fim da inclusão

    p_wa_zycat039-valor = v_vlpago.

  endif.

  if p_wa_zycat039-num_nf is initial.

    select nfnum

      up to 1 rows

      from /pws/zycet002

      into p_wa_zycat039-num_nf

      where nrseq = p_wa_zycat039-fat_exp.

    endselect.

    if p_wa_zycat039-num_nf is initial or

...

 

 

----------------------------------------------------------------------------------------------------

Modificações efetuadas em REPS /PWS/MZYCA012TOP

 

...

DATA: wa_zycat039      TYPE /pws/zycat039,

      wa_zycat039_ant  TYPE /pws/zycat039,

      wa_zycat039c     TYPE /pws/zycat039,

      wa_zycat039r     TYPE /pws/zycat039,

      wa_zycat039f     TYPE /pws/zycat039,

      wa_zycat039o     TYPE /pws/zycat039,

      wa_zycat039fe    TYPE /pws/zycat039,

      wa_cols          TYPE cxtab_column,

      wa_tdynpread     TYPE dynpread,

      wa_result        TYPE ddshretval,

* >> Início da exclusão:

      wa_fcode         TYPE ty_fcode.

* << Fim da exclusão

* >> Início da inclusão:

      wa_fcode         type ty_fcode,

      wa_zycat030      type /pws/zycat030.

* << Fim da inclusão

DATA: v_okcode     TYPE sy-ucomm,

      v_exibe      TYPE c,

      v_screen     TYPE sy-dynnr,

      v_dynnr      TYPE sy-dynnr,

      v_nbs        TYPE /pws/zycat041-descricao,

      v_operacao   TYPE /pws/zycat039-operacao,

      v_mark       TYPE c,

      v_lines      TYPE i,

      v_path       TYPE rlgrap-filename,

      v_funcionalidade TYPE /pws/zyglt390-programa

...

 

 

----------------------------------------------------------------------------------------------------

Modificações efetuadas em REPT /PWS/SAPMZYCA011

 

------------------------------------------------------------------------

Modificado símbolo de texto:

 

Idioma: ES

 

Símbolo: I02

 

Texto: (39 caracteres)

"La información no registrada se perderá"

 

Comprimento máximo: 39

 

------------------------------------------------------------------------

Incluído símbolo de texto:

 

Idioma: EN

 

Símbolo: I30

 

Texto: (8 caracteres)

"Shipping"

 

Comprimento máximo: 8

 

------------------------------------------------------------------------

Incluído símbolo de texto:

 

Idioma: PT

 

Símbolo: I30

 

Texto: (8 caracteres)

"Embarque"

 

Comprimento máximo: 8

 

------------------------------------------------------------------------

Incluído símbolo de texto:

 

Idioma: ES

 

Símbolo: I30

 

Texto: (8 caracteres)

"Embarque"

 

Comprimento máximo: 8

 

------------------------------------------------------------------------

Incluído símbolo de texto:

 

Idioma: EN

 

Símbolo: I31

 

Texto: (26 caracteres)

"is not related to service."

 

Comprimento máximo: 26

 

------------------------------------------------------------------------

Incluído símbolo de texto:

 

Idioma: PT

 

Símbolo: I31

 

Texto: (26 caracteres)

"não é referente a serviço."

 

Comprimento máximo: 26

 

------------------------------------------------------------------------

Incluído símbolo de texto:

 

Idioma: ES

 

Símbolo: I31

 

Texto: (26 caracteres)

"no es referente a servicio"

 

Comprimento máximo: 26

 

------------------------------------------------------------------------

Incluído símbolo de texto:

 

Idioma: EN

 

Símbolo: I32

 

Texto: (35 caracteres)

"longer used for type of association"

 

Comprimento máximo: 36

 

------------------------------------------------------------------------

Incluído símbolo de texto:

 

Idioma: PT

 

Símbolo: I32

 

Texto: (36 caracteres)

"já utilizado para tipo de associação"

 

Comprimento máximo: 36

 

------------------------------------------------------------------------

Incluído símbolo de texto:

 

Idioma: ES

 

Símbolo: I32

 

Texto: (36 caracteres)

"ya utilizado para tipo de asociación"

 

Comprimento máximo: 36

 

------------------------------------------------------------------------

Incluído símbolo de texto:

 

Idioma: EN

 

Símbolo: I33

 

Texto: (20 caracteres)

"Currency, Country or"

 

Comprimento máximo: 21

 

------------------------------------------------------------------------

Incluído símbolo de texto:

 

Idioma: PT

 

Símbolo: I33

 

Texto: (21 caracteres)

"Possui Moeda, País ou"

 

Comprimento máximo: 21

 

------------------------------------------------------------------------

Incluído símbolo de texto:

 

Idioma: ES

 

Símbolo: I33

 

Texto: (20 caracteres)

"Posee Moneda, País o"

 

Comprimento máximo: 21

 

------------------------------------------------------------------------

Incluído símbolo de texto:

 

Idioma: EN

 

Símbolo: I34

 

Texto: (31 caracteres)

"Supplier / Customer different.!"

 

Comprimento máximo: 33

 

------------------------------------------------------------------------

Incluído símbolo de texto:

 

Idioma: PT

 

Símbolo: I34

 

Texto: (33 caracteres)

"Fornecedor / Cliente diferentes.!"

 

Comprimento máximo: 33

 

------------------------------------------------------------------------

Incluído símbolo de texto:

 

Idioma: ES

 

Símbolo: I34

 

Texto: (32 caracteres)

"Proveedor / Cliente diferentes.!"

 

Comprimento máximo: 33