CE PLUS - Nota 011270

Módulo: CÂMBIO EXPORTAÇÃO

Funcionalidade: Liquidação de Fatura

Data/Hora da Publicação: 24/06/2011 00:00:00

Data/Hora Última Alteração: 24/06/2011 09:50:26

Descrição da Nota: LIQUIDAÇÃO ARBITRAGEM - VALORES MANTIDOS NO EXTERIOR

Sintoma

Em alguns clientes a conta de VME não estava permitindo lançamentos em BRL na contabilização do

estorno da liquidação com arbitragem envolvendo VME

 

 

Solução

Foi feito um desenvolvimento para prever o lançamento do VME na própria conta do ACE e em seguida

é feito um novo lançamento de clearing tranferindo o valor para a conta de VME na moeda da fatura

 

Versões Tratadas

8.0


Pré-Requisitos

Produto:

Nota

Descrição

LIQUIDAÇÃO - AJUSTE PARA PONTO DE EXIT LIQ001

VINCULAÇÃO/LIQUIDAÇÃO ARBITRAGEM-MOEDA SEM CASAS DECIMAIS, CENTAVOS

LIQUIDAÇÃO DE CÂMBIO PRONTO COM ARBITRAGEM - AO ESTORNAR NADA OCORRE

DA-LIQUIDAÇÃO E VINCULAÇÃO LIQ. AUTOMÁT - NORMAL/ARBITRAGEM/PERFORMANCE

Informações Complementares

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

Nota Número 11270 Data: 24/06/2011 Hora: 09:44:03

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

 

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

Nota Número              : 11270

Categoria                : Melhoria

Prioridade               : Alta

Versão PW.CE             : 8.0

Pacote                   : 00008

Agrupamento              : 00074

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

Referência às notas relacionadas:

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

 

00551  - 00001 - 6.0    - 00022 - LIQUIDAÇÃO DE CÂMBIO PRONTO COM ARBITRAGEM - AO ESTORNAR NADA OCOR

04450  - 00002 - 7.0    - 00002 - LIQUIDAÇÃO - AJUSTE PARA PONTO DE EXIT LIQ001

07760  - 00003 - 7.0    - 00007 - DA-LIQUIDAÇÃO E VINCULAÇÃO LIQ. AUTOMÁT - NORMAL/ARBITRAGEM/PERFOR

10889  - 00004 - 8.0    - 00006 - VINCULAÇÃO/LIQUIDAÇÃO ARBITRAGEM-MOEDA SEM CASAS DECIMAIS, CENTAVO

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

Texto Rápido:

LIQUIDAÇÃO ARBITRAGEM - VALORES MANTIDOS NO EXTERIOR

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

Palavras Chave:

LIQUIDAÇÃO ARBITRAGEM - VALORES MANTIDOS NO EXTERIOR

 

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

Objetos da nota:

REPS /PWS/MZYCB004F01

REPS /PWS/MZYCB004F03

REPS /PWS/MZYCB004TOP

REPS /PWS/MZYCB004X01

REPT /PWS/SAPMZYCB004

 

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

Modificações efetuadas em REPS /PWS/MZYCB004F01

 

...

    if sy-subrc = 0.

      read table itab_zycbt226 into wa_zycbt226 with key

                                    nrinvoic = itab_zycbt006-nrinvoic

                                     nrparcf  = itab_zycbt006-nrparcf

                                      gsberf   = itab_zycbt006-gsberf.

      clear itab_partidas.

      itab_partidas-wrbtr   =  v_reais_f2.

      clear: v_codaux, v_codaux2, v_newko, v_conti.

      v_codaux  = wa_zycbt226-bco_me.

      v_codaux2 = wa_zycbt226-waers.

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

      while v_conti < 2.

        perform busca_conta_contabil

          using 'D'

               itab_zycbt006-bukrs

               'FBK'

               v_codaux

               v_codaux2

               space

          changing v_newko.

        if v_newko is initial.

          shift v_codaux left deleting leading '0'.

          add 1 to v_conti.

        else.

          add 2 to v_conti.

        endif.

      endwhile.

      perform verify_null_field using v_newko

* << Fim da exclusão

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

      perform verify_null_field using v_saknr_ace

* << Fim da inclusão

                                     'SAKNR'

                                      text-010.

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

      itab_partidas-d_newko = v_newko.

* << Fim da exclusão

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

      itab_partidas-d_newko = v_saknr_ace.

* << Fim da inclusão

      itab_partidas-agkoa   = 'S'.

      itab_partidas-newbs   = '40'.

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

      itab_partidas-d_zuonr = itab_zycbe033-d_zuonr.

* << Fim da exclusão

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

      concatenate wa_zycbt226-nrseq 'VME'

        into itab_partidas-d_zuonr.

* << Fim da inclusão

      itab_partidas-d_gsber = itab_zycbe033-d_gsber.

      itab_partidas-d_sgtxt = itab_zycbe033-d_sgtxt.

      itab_partidas-brnch   = itab_zycbe033-brnch.

      itab_partidas-cpochv = itab_zycbe033-cpochv.

      itab_partidas-tabela = itab_zycbe033-tabela.

      itab_partidas-tcode  = itab_zycbe033-tcode.

      itab_partidas-brnch  = itab_zycbe033-brnch.

      append itab_partidas.

    endif.

    itab_zycbe033-wrbtr  = abs( v_reais_c ).

...

 

...

          v_subrc = 4.

        endif.

      else.

        loop at itab_zycbt034.

          message i016 with itab_zycbt034-descricao.

        endloop.

        v_subrc = 4.

      endif.

    else.

      v_subrc = 4.

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

    endif.

    if v_subrc ne 0.

      exit.

* << Fim da inclusão

    endif.

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

    perform clearing_vme using v_saknr_ace.

* << Fim da inclusão

    if v_subrc ne 0.

      exit.

    endif.

    perform clear_date_batch.

    if not itab_zycbt005_ant-belnr is initial.

      itab_zycbt036-tcode   = 'F-30'.

...

 

...

        itab_zycbt006-belnr_d = itab_zycbt005_ant-belnr_d.

        perform anula_desm_ace.

        if sy-subrc eq 0.

          clear itab_zycbt005_ant-belnr_d.

          modify itab_zycbt005_ant transporting belnr_d

                   where nrinvoic = itab_zycbt006-nrinvoic and

                         gsberf   = itab_zycbt006-gsberf   and

                         nrparcf  = itab_zycbt006-nrparcf.

        endif.

      endif.

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

      perform estorna_vme.

* << Fim da inclusão

      itab_zycbt006-belnr_d = v_belnr.

      perform estorna_liq.

      if itab_zycbt006-v_status = 'I' and

         itab_zycbt006-status   = 'E'.

        itab_zycbt006-v_status = 'A'.

      endif.

      itab_zycbt006-status  = 'C'.

      itab_zycbt006-dtpagto = v_budat.

      modify itab_zycbt006.

    endloop.

...

 

 

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

Modificações efetuadas em REPS /PWS/MZYCB004F03

 

...

        AND tcurr =  p_waers_c

      AND gdatu >= sy-datum.                              "#EC PORTABLE

  ENDIF.

  IF p_defator = 0.

    p_defator = 1.

  ENDIF.

  IF p_parafator = 0.

    p_parafator = 1.

  ENDIF.

ENDFORM.

* >> Início da inclusão:

form clearing_vme using p_saknr_ace.

  data:

    v_codaux    like /pws/zyglt316-codaux1,

    v_codaux2   like /pws/zyglt316-codaux2,

    v_newko     like /pws/zycbe033-d_newko.

  data: wa_zycbt011 type /pws/zycbt011.

  data: wa_zycbt226 type line of t_zycbt226.

  clear itab_zycbt084.

  read table itab_zycbt084 with key

                                  nrseqc   = itab_zycbt006-nrseqc

                                  nrinvoic = itab_zycbt006-nrinvoic

                                  nrparc   = itab_zycbt006-nrparc

                                  nrparcf  = itab_zycbt006-nrparcf

                                  tpdesp   = itab_zycbt006-tpdesp

                                  gsberf   = itab_zycbt006-gsberf

                                  dtincl   = itab_zycbt006-dtincl

                                  dtvincul = itab_zycbt006-dtvincul

                                  dtpagext = itab_zycbt006-dtpagext

                                  dtpagto  = itab_zycbt006-dtpagto

                                  dtvencto = itab_zycbt006-dtvencto

                                  liq_and  = space

                                  tdesmemb = 'V'.

  check sy-subrc = 0.

  perform clear_date_batch.

  clear: itab_doctos, itab_zyglt321.

  refresh: itab_doctos, itab_zyglt321.

  clear: v_codaux, v_codaux2, v_newko, v_conti, v_monat, v_ano.

  read table itab_zycbt226 into wa_zycbt226 with key

                                nrinvoic = itab_zycbt006-nrinvoic

                                 nrparcf  = itab_zycbt006-nrparcf

                                  gsberf   = itab_zycbt006-gsberf.

  v_codaux  = wa_zycbt226-bco_me.

  v_codaux2 = wa_zycbt226-waers.

  while v_conti < 2.

    perform busca_conta_contabil

      using 'D'

           itab_zycbt006-bukrs

           'FBK'

           v_codaux

           v_codaux2

           space

      changing v_newko.

    if v_newko is initial.

      shift v_codaux left deleting leading '0'.

      add 1 to v_conti.

    else.

      add 2 to v_conti.

    endif.

  endwhile.

  perform determina_periodo using itab_zycbt006-dtpagto

                                  itab_zycbt006-bukrs

                         changing v_monat.

  perform determina_ano using itab_zycbt006-dtpagto

                              itab_zycbt006-bukrs

                     changing v_ano.

  perform data_estorno using     v_monat

                                 itab_zycbt006-bukrs

                                 v_ano

                                 itab_zycbt006-dtpagto

                                 v_newko

                        changing itab_zycbe033-budat.

  select single *

    from /pws/zycbt011

    into wa_zycbt011

    where codeven = '029'

      and codmod  = 'E'

      and bukrs   = itab_zycbt006-bukrs.

  itab_zycbe033-tcode  = 'F-30'.

  concatenate itab_zycbt006-nrinvoic itab_zycbt006-nrparcf

         into v_cpochv.

  itab_zycbe033-cpochv = v_cpochv.

  itab_zycbe033-tabela = 'ZYCBT006'.

  if wa_zycbt007-fdtdoc = 'D'.

    itab_zycbe033-bldat = sy-datum.

    itab_zycbe033-d_valut = sy-datum.

    itab_zycbe033-c_valut = sy-datum.

  else.

    itab_zycbe033-bldat = itab_zycbe033-budat.

    itab_zycbe033-d_valut = itab_zycbe033-budat.

    itab_zycbe033-c_valut = itab_zycbe033-budat.

  endif.

  perform verify_null_field using wa_zycbt011-blart

                                  'BLART'

                                  text-006.

  itab_zycbe033-blart  = wa_zycbt011-blart.

  if not wa_zycbt011-agums is initial.

    itab_zycbe033-agums = wa_zycbt011-agums.

  endif.

  perform campos_contab_vme.

  if itab_zycbe033-d_sgtxt is initial.

    itab_zycbe033-d_sgtxt = wa_zycbt011-txtdesc.

    itab_zycbe033-c_sgtxt = wa_zycbt011-txtdesc.

    itab_zycbe033-augtx   = wa_zycbt011-txtdesc.

  endif.

  itab_zycbe033-bktxt  = wa_zycbt007-bktxt.

  perform verify_null_field using itab_zycbt006-bukrs

                                  'BUKRS'

                                  text-004.

  itab_zycbe033-bukrs   = itab_zycbt006-bukrs.

  itab_zycbe033-waers   = itab_zycbt006-waers.

  itab_zycbe033-d_gsber = itab_zycbt006-gsberf.

  itab_zycbe033-brnch   = wa_zycbt226-j_1bbranch.

  itab_zycbe033-werks   = wa_zycbt226-werks.

  select single kursf

    from bkpf

    into itab_zycbe033-kursf

    where bukrs = itab_zycbt006-bukrs

      and belnr = itab_zycbt084-belnr

      and gjahr = v_ano.

  itab_zycbe033-d_newko  = v_newko.

  itab_zycbe033-agkoa    = 'S'.

  itab_zycbe033-newbs    = '40'.

  itab_zycbe033-belnr    = itab_zycbt006-belnr_d.

  itab_zycbe033-dtdocto  = itab_zycbe033-budat.

  itab_zycbe033-d_newko1 = p_saknr_ace.

  itab_zycbe033-flag_nc  = 'X'.

  append itab_zycbe033.

  itab_zycbt036-tcode   = 'F-30'.

  itab_zycbt036-cpochv  = v_cpochv.

  itab_zycbt036-tabela  = 'ZYCBT006'.

  itab_zycbt036-residuo = itab_zycbt084-result_saldo.

  append itab_zycbt036.

  itab_doctos-tcode   = 'F-30'.

  itab_doctos-cpochv  = v_cpochv.

  itab_doctos-tabela  = 'ZYCBT006'.

  itab_doctos-dtdocto = itab_zycbe033-budat.

  itab_doctos-belnr   = itab_zycbt006-belnr_d.

  concatenate wa_zycbt226-nrseq 'VME'

    into itab_doctos-zuonr.

  append itab_doctos.

  if itab_zycbt034 is initial.

    call function '/PWS/ZYCB_TRANSACAO_F_30_P'

         exporting

              v_modo          = v_modo_bi

              v_vinc_tot      = 'X'

              v_panormais     = 'X'

              v_filt_atrib    = 'X'

         tables

              t_dados         = itab_zycbe033

              t_campo         = itab_zycbt034

              t_zycbt032      = itab_zycbt032

              t_zycbt036      = itab_zycbt036

              t_doctos        = itab_doctos

         exceptions

              campo_em_branco = 1

              periodo_fechado = 2

              others          = 3.

    if sy-subrc = 0.

      read table itab_zycbt032 with key tcode  = 'F-30'

                                        tabela = 'ZYCBT006'

                                        cpochv = v_cpochv

                                        tpmsg  = 'S'.

      if sy-subrc = 0

        and not itab_zycbt032-belnr is initial.

        wa_zycbt226-belnr_f30  = itab_zycbt032-belnr.

        modify itab_zycbt226 from wa_zycbt226

          transporting belnr_f30

          where nrseq    = wa_zycbt226-nrseq

            and nrinvoic = wa_zycbt226-nrinvoic

            and nrparcf  = wa_zycbt226-nrparcf

            and gsberf   = wa_zycbt226-gsberf.

        itab_contabil-nrinvoic = itab_zycbt006-nrinvoic.

        itab_contabil-nrparcf  = itab_zycbt006-nrparcf.

        itab_contabil-vbeln    = itab_zycbt030-vbeln.

        itab_contabil-gsberf   = itab_zycbt006-gsberf.

        itab_contabil-docto    = itab_zycbt032-belnr.

        itab_contabil-msg      = text-470.

        itab_contabil-dtdocto  = itab_zycbe033-budat.

        itab_contabil-bukrs    = itab_zycbe033-bukrs.

        append itab_contabil.

      else.

        loop at itab_zycbt032 where tcode  = 'F-30'

                                and tabela = 'ZYCBT006'

                                and cpochv = v_cpochv.

          itab_erro-vbeln = itab_zycbt006-nrinvoic.

          itab_erro-msg   = itab_zycbt032-msg.

          append itab_erro.

        endloop.

        v_subrc = 4.

      endif.

    else.

      loop at itab_zycbt034.

        message i016 with itab_zycbt034-descricao.

      endloop.

      v_subrc = 4.

    endif.

  else.

    loop at itab_zycbt034.

      message i016 with itab_zycbt034-descricao.

    endloop.

    v_subrc = 4.

  endif.

  sy-subrc = v_subrc.

endform.

form campos_contab_vme.

  constants:

    c_chave_oper(3) type c value 'TRE',

    c_codeven(5)    type c value '029',

    c_sgtxt(05)       type c value 'SGTXT',

    c_xblnr(05)       type c value 'XBLNR',

    c_zuonr(05)       type c value 'ZUONR',

    c_zfbdt(05)       type c value 'ZFBDT',

    c_valut(05)       type c value 'VALUT',

    c_nrinvoic(08)    type c value 'NRINVOIC',

    c_nremb(05)       type c value 'NREMB',

    c_nrseq(05)       type c value 'NRSEQ',

    c_ref(06)         type c value 'REF_OP',

    c_obs(03)         type c value 'OBS',

    c_dtincl(06)      type c value 'DTINCL',

    c_dtlancto(08)    type c value 'DTLANCTO',

    c_dtlimite(08)    type c value 'DTLIMITE',

    c_dtbl(4)         type c value 'DTBL',

    c_dtinvoic(10)    type c value 'DTINVOIC',

    c_nrinvoic_ms(11) type c value 'NRINVOIC+MS',

    c_nrseq_ms(08)    type c value 'NRSEQ+MS',

    c_nremb_ms(08)    type c value 'NREMB+MS',

    c_ref_ms(09)      type c value 'REF_OP+MS',

    c_zterm(05)       type c value 'ZTERM'.

  data: v_hora(8) type c.

  read table itab_zycbt017 with key

    nrinvoic = wa_zycbt226-nrinvoic

    nrparcf  = wa_zycbt226-nrparcf

    gsberf   = wa_zycbt226-gsberf.

  select *

    from /pws/zyglt321

    into table itab_zyglt321

    where ktosl = c_chave_oper

      and codeven = c_codeven.

  loop at itab_zyglt321.

    case itab_zyglt321-cpor3.

      when c_sgtxt.

        case itab_zyglt321-cpocb.

          when c_nrinvoic.

            itab_zycbe033-c_sgtxt = wa_zycbt226-nrinvoic.

            itab_zycbe033-d_sgtxt = wa_zycbt226-nrinvoic.

            itab_zycbe033-augtx   = wa_zycbt226-nrinvoic.

          when c_nremb.

            itab_zycbe033-c_sgtxt = itab_zycbt017-nremb.

            itab_zycbe033-d_sgtxt = itab_zycbt017-nremb.

            itab_zycbe033-augtx   = itab_zycbt017-nremb.

          when c_nrseq.

            itab_zycbe033-c_sgtxt = wa_zycbt226-nrseq.

            itab_zycbe033-d_sgtxt = wa_zycbt226-nrseq.

            itab_zycbe033-augtx   = wa_zycbt226-nrseq.

          when c_ref.

            itab_zycbe033-c_sgtxt = wa_zycbt226-ref_op.

            itab_zycbe033-d_sgtxt = wa_zycbt226-ref_op.

            itab_zycbe033-augtx   = wa_zycbt226-ref_op.

          when c_obs.

            itab_zycbe033-c_sgtxt = wa_zycbt226-obs.

            itab_zycbe033-d_sgtxt = wa_zycbt226-obs.

            itab_zycbe033-augtx   = wa_zycbt226-obs.

          when others.

            itab_zycbe033-c_sgtxt = itab_zyglt321-descr.

            itab_zycbe033-d_sgtxt = itab_zyglt321-descr.

            itab_zycbe033-augtx   = itab_zyglt321-descr.

        endcase.

      when c_xblnr.

        v_hora = sy-uzeit.

        concatenate v_hora+2(2) ':' v_hora+4(2)

          into v_hora.

        case itab_zyglt321-cpocb.

          when c_nrinvoic_ms.

            concatenate wa_zycbt226-nrinvoic v_hora

              into itab_zycbe033-xblnr

              separated by space.

          when c_nremb_ms.

            concatenate itab_zycbt017-nremb v_hora

              into itab_zycbe033-xblnr

              separated by space.

          when c_nrseq_ms.

            concatenate wa_zycbt226-nrseq v_hora

              into itab_zycbe033-xblnr

              separated by space.

          when c_ref_ms.

            concatenate wa_zycbt226-ref_op v_hora

              into itab_zycbe033-xblnr

              separated by space.

          when c_nrinvoic.

            itab_zycbe033-xblnr = wa_zycbt226-nrinvoic.

          when c_nremb.

            itab_zycbe033-xblnr = itab_zycbt017-nremb.

          when c_nrseq.

            itab_zycbe033-xblnr = wa_zycbt226-nrseq.

          when c_ref.

            itab_zycbe033-xblnr = wa_zycbt226-ref_op.

          when others.

            itab_zycbe033-xblnr = itab_zyglt321-descr.

        endcase.

      when c_zfbdt.

        case itab_zyglt321-cpocb.

          when c_dtincl.

            itab_zycbe033-zfbdt = wa_zycbt226-dtincl.

          when c_dtlancto.

            itab_zycbe033-zfbdt = wa_zycbt226-dtlancto.

          when c_dtlimite.

            itab_zycbe033-zfbdt = wa_zycbt226-dtlimite.

          when c_dtbl.

            itab_zycbe033-zfbdt = itab_zycbt017-dtbl.

          when c_dtinvoic.

            itab_zycbe033-zfbdt = itab_zycbt017-dtinvoic.

        endcase.

        if itab_zyglt321-cpocb ne c_dtlancto.

          itab_zycbe033-zterm = itab_zycbt017-zterm.

        endif.

      when c_zuonr.

        case itab_zyglt321-cpocb.

          when c_nrinvoic.

            itab_zycbe033-d_zuonr = wa_zycbt226-nrinvoic.

          when c_nremb.

            itab_zycbe033-d_zuonr = itab_zycbt017-nremb.

          when c_nrseq.

            itab_zycbe033-d_zuonr = wa_zycbt226-nrseq.

          when c_ref.

            itab_zycbe033-d_zuonr = wa_zycbt226-ref_op.

          when others.

            itab_zycbe033-d_zuonr = itab_zyglt321-descr.

        endcase.

      when c_valut.

        case itab_zyglt321-cpocb.

          when c_dtincl.

            itab_zycbe033-c_valut = wa_zycbt226-dtincl.

            itab_zycbe033-d_valut = wa_zycbt226-dtincl.

          when c_dtlimite.

            itab_zycbe033-c_valut = wa_zycbt226-dtlimite.

            itab_zycbe033-d_valut = wa_zycbt226-dtlimite.

          when c_dtbl.

            itab_zycbe033-c_valut = itab_zycbt017-dtbl.

            itab_zycbe033-d_valut = itab_zycbt017-dtbl.

          when c_dtinvoic.

            itab_zycbe033-c_valut = itab_zycbt017-dtinvoic.

            itab_zycbe033-d_valut = itab_zycbt017-dtinvoic.

          when c_dtlancto.

            itab_zycbe033-c_valut = wa_zycbt226-dtlancto.

            itab_zycbe033-d_valut = wa_zycbt226-dtlancto.

        endcase.

      when c_zterm.

        if itab_zyglt321-cpocb = c_zterm.

          itab_zycbe033-zterm = itab_zycbt017-zterm.

        endif.

    endcase.

  endloop.

endform.

form estorna_vme.

  data:

    v_codaux    like /pws/zyglt316-codaux1,

    v_codaux2   like /pws/zyglt316-codaux2,

    v_newko     like /pws/zycbe033-d_newko.

  data: wa_zycbt226 type line of t_zycbt226.

  clear itab_zycbt084.

  read table itab_zycbt084 with key

                                  nrseqc   = itab_zycbt006-nrseqc

                                  nrinvoic = itab_zycbt006-nrinvoic

                                  nrparc   = itab_zycbt006-nrparc

                                  nrparcf  = itab_zycbt006-nrparcf

                                  tpdesp   = itab_zycbt006-tpdesp

                                  gsberf   = itab_zycbt006-gsberf

                                  dtincl   = itab_zycbt006-dtincl

                                  dtvincul = itab_zycbt006-dtvincul

                                  dtpagext = itab_zycbt006-dtpagext

                                  dtpagto  = itab_zycbt006-dtpagto

                                  dtvencto = itab_zycbt006-dtvencto

                                  liq_and  = space

                                  tdesmemb = 'V'.

  check sy-subrc = 0.

  perform clear_date_batch.

  clear: v_codaux, v_codaux2, v_newko, v_conti, v_monat, v_ano.

  read table itab_zycbt226 into wa_zycbt226 with key

                                nrinvoic = itab_zycbt006-nrinvoic

                                nrparcf  = itab_zycbt006-nrparcf

                                gsberf   = itab_zycbt006-gsberf.

  check not wa_zycbt226-belnr_f30 is initial.

  v_codaux  = wa_zycbt226-bco_me.

  v_codaux2 = wa_zycbt226-waers.

  while v_conti < 2.

    perform busca_conta_contabil

      using 'D'

           itab_zycbt006-bukrs

           'FBK'

           v_codaux

           v_codaux2

           space

      changing v_newko.

    if v_newko is initial.

      shift v_codaux left deleting leading '0'.

      add 1 to v_conti.

    else.

      add 2 to v_conti.

    endif.

  endwhile.

  perform determina_periodo using itab_zycbt006-dtpagto

                                  itab_zycbt006-bukrs

                         changing v_monat.

  perform determina_ano using itab_zycbt006-dtpagto

                              itab_zycbt006-bukrs

                     changing v_ano.

  perform data_estorno using     v_monat

                                 itab_zycbt006-bukrs

                                 v_ano

                                 itab_zycbt006-dtpagto

                                 v_newko

                        changing itab_zycbe033-budat.

  itab_zycbe033-d_newko = v_newko.

  itab_zycbe033-mandt  = sy-mandt.

  itab_zycbe033-tcode  = 'FBRA'.

  itab_zycbe033-tabela = 'ZYCBT006'.

  concatenate itab_zycbt006-nrseqc

              itab_zycbt006-nrinvoic

              itab_zycbt006-dtpagto

              itab_zycbt006-nrparcf

              into v_cpochv.

  itab_zycbe033-cpochv = v_cpochv.

  itab_zycbe033-belnr  = wa_zycbt226-belnr_f30.

  itab_zycbe033-bukrs  = itab_zycbt006-bukrs.

  itab_zycbe033-bldat  = itab_zycbe033-budat.

  call function 'FI_PERIOD_CHECK'

       exporting

            i_bukrs          = itab_zycbe033-bukrs

            i_gjahr          = v_ano

            i_koart          = '+'

            i_monat          = v_monat

       exceptions

            error_period     = 1

            error_period_acc = 2

            others           = 3.

  if sy-subrc = 0.

    itab_zycbe033-stgrd = '01'.

  else.

    itab_zycbe033-stgrd = '02'.

    itab_zycbe033-budat  = sy-datum.

  endif.

  append itab_zycbe033.

  perform unlock_razao using itab_zycbe033-d_newko

                             itab_zycbe033-bukrs.

  call function '/PWS/ZYCB_TRANSACAO_FBRA'

       exporting

            v_modo          = v_modo_bi

       tables

            t_dados         = itab_zycbe033

            t_campo         = itab_zycbt034

            t_zycbt032      = itab_zycbt032

       exceptions

            campo_em_branco = 1

            others          = 2.

  if sy-subrc = 0.

    read table itab_zycbt032 with key tcode  = 'FBRA'

                                      tabela = 'ZYCBT006'

                                      cpochv = v_cpochv

                                      tpmsg  = 'S'.

    if sy-subrc eq 0.

      itab_zycbe033-tcode = 'FB08'.

      modify itab_zycbe033 index 1 transporting tcode.

      itab_contabil-nrinvoic = itab_zycbt006-nrinvoic.

      itab_contabil-nrparcf  = itab_zycbt006-nrparcf.

      clear itab_contabil-vbeln.

      itab_contabil-gsberf   = itab_zycbt006-gsberf.

      itab_contabil-docto    = itab_zycbt032-belnr.

      itab_contabil-msg      = text-472.

      itab_contabil-dtdocto  = itab_zycbt006-dtpagto.

      itab_contabil-bukrs    = itab_zycbt006-bukrs.

      append itab_contabil.

      call function '/PWS/ZYCB_TRANSACAO_FB08'

           exporting

                v_modo          = v_modo_bi

           tables

                t_dados         = itab_zycbe033

                t_campo         = itab_zycbt034

                t_zycbt032      = itab_zycbt032

           exceptions

                campo_em_branco = 1

                others          = 2.

      if sy-subrc = 0.

        read table itab_zycbt032 with key tcode  = 'FB08'

                                          tabela = 'ZYCBT006'

                                          cpochv = v_cpochv

                                          tpmsg  = 'S'.

        if sy-subrc eq 0.

          clear wa_zycbt226-belnr_f30.

          modify itab_zycbt226 from wa_zycbt226

            transporting belnr_f30

            where nrseq    = wa_zycbt226-nrseq

              and nrinvoic = wa_zycbt226-nrinvoic

              and nrparcf  = wa_zycbt226-nrparcf

              and gsberf   = wa_zycbt226-gsberf.

          itab_contabil-nrinvoic = itab_zycbt006-nrinvoic.

          itab_contabil-nrparcf  = itab_zycbt006-nrparcf.

          clear itab_contabil-vbeln.

          itab_contabil-gsberf   = itab_zycbt006-gsberf.

          itab_contabil-docto    = itab_zycbt032-belnr.

          itab_contabil-msg      = text-471.

          itab_contabil-dtdocto  = itab_zycbt006-dtpagto.

          itab_contabil-bukrs    = itab_zycbt006-bukrs.

          append itab_contabil.

        else.

          loop at itab_zycbt032 where tcode  = 'FB08'

                                  and tabela = 'ZYCBT006'

                                  and cpochv = v_cpochv.

            itab_erro-vbeln = itab_zycbt006-belnr_d.

            itab_erro-msg   = itab_zycbt032-msg.

            append itab_erro.

          endloop.

        endif.

      else.

        loop at itab_zycbt034.

          itab_erro-vbeln = itab_zycbt006-belnr_d.

          itab_erro-msg   = itab_zycbt034-descricao.

          append itab_erro.

        endloop.

      endif.

    else.

      loop at itab_zycbt032 where tcode  = 'FBRA'

                              and tabela = 'ZYCBT006'

                              and cpochv = v_cpochv.

        itab_erro-vbeln = itab_zycbt006-belnr_d.

        itab_erro-msg   = itab_zycbt032-msg.

        append itab_erro.

      endloop.

    endif.

  else.

    loop at itab_zycbt034.

      itab_erro-vbeln = itab_zycbt006-belnr_d.

      itab_erro-msg   = itab_zycbt034-descricao.

      append itab_erro.

    endloop.

  endif.

endform.

* << Fim da inclusão

 

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

Modificações efetuadas em REPS /PWS/MZYCB004TOP

 

 

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

Modificações efetuadas em REPS /PWS/MZYCB004X01

 

...

  /pws/zycbt005,

  /pws/zycbe006,

  /pws/zycbt006,

  /pws/zyglt321,

  /pws/zycbt226,

  /pws/zycbt231.

data: begin of common part c.

types: begin of t_s_ordem.

        include structure /pws/zycbt226.

types:

* >> Início da inclusão:

       belnr_f30  type /pws/zycbt006-belnr5,

* << Fim da inclusão

       end of t_s_ordem,

       t_zycbt226 type standard table of t_s_ordem

        with non-unique default key.

types: begin of t_s_liqand.

        include structure /pws/zycbt225.

types: end of t_s_liqand,

       t_zycbt225 type sorted table of t_s_liqand

         with non-unique default key.

data: itab_zycbt226 type t_zycbt226,

      itab_zycbt225 type t_zycbt225,

...

 

 

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

Modificações efetuadas em REPT /PWS/SAPMZYCB004

 

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

Incluído símbolo de texto:

 

Idioma: PT

 

Símbolo: 470

 

Texto: (15 caracteres)

"Clearing do VME"

 

Comprimento máximo: 15

 

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

Incluído símbolo de texto:

 

Idioma: PT

 

Símbolo: 471

 

Texto: (23 caracteres)

"Estorno Clearing do VME"

 

Comprimento máximo: 23

 

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

Incluído símbolo de texto:

 

Idioma: PT

 

Símbolo: 472

 

Texto: (26 caracteres)

"Comp. Clearing VME anulada"

 

Comprimento máximo: 26