CE PLUS - Nota 009941

Módulo: CÂMBIO EXPORTAÇÃO

Funcionalidade: Liquidação de Fatura

Data/Hora da Publicação: 12/03/2010 00:00:00

Data/Hora Última Alteração: 18/02/2011 17:05:36

Descrição da Nota: LIQUIDAÇÃO PARCIAL E DEPOIS RESTANTE DO SALDO-CONTABILIZAÇÃO E ATUALIZAC

Sintoma

Ao efetuar uma liquidação parcial de uma fatura e depois liquidar o total dela, o programa esta se

perdendo na atualização da tabela e nas contabilizações. Erro também devido vincular em um ano,

liquidar parcial neste mesmo ano e liquidar o restando em outro ano.

 

 

Solução

Se a fatura que esta sendo liquidada já ter sido liquidada parcialmente com o mesmo contrato,

abandonar a retirada dos desmembramentos e efetuar os mesmos, como já fazia, para que consiga

controlar os contábeis e saldos corretamente.

 

Versões Tratadas

8.0


Pré-Requisitos

Produto:

Nota

Descrição

DA-VINCULAÇÃO/LIQUIDAÇÃO-OTIMIZAÇÃO-BUSCA TAXAS/TIPO DOCTO. POR CONTRATO

LIQUIDAÇÃO DE FATURAS

LIQUIDAÇÃO - CAMPO BUDAT NAS TABELAS INTERNAS BSAS E BSAD.

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

Informações Complementares

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

Nota Número 09941 Data: 12/03/2010 Hora: 10:05:42

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

 

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

Nota Número              : 09941

Categoria                : Erro de Programa

Prioridade               : Média

Versão PW.CE             : 8.0

Pacote                   : 00002

Agrupamento              : 00012

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

Referência às notas relacionadas:

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

 

03193  - 00001 - 6.0    - 00026  - LIQUIDAÇÃO - CAMPO BUDAT NAS TABELAS INTERNAS BSAS E BSAD.

05666  - 00002 - 7.0    - 00004  - LIQUIDAÇÃO DE FATURAS

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

08536  - 00004 - 7.0    - 00009  - DA-VINCULAÇÃO/LIQUIDAÇÃO-OTIMIZAÇÃO-BUSCA TAXAS/TIPO DOCTO. POR C

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

LIQUIDAÇÃO PARCIAL E DEPOIS RESTANTE DO SALDO-CONTABILIZAÇÃO E ATUALIZAC

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

Palavras Chave:

LIQUIDAÇÃO PARCIAL E DEPOIS RESTANTE DO SALDO-CONTABILIZAÇÃO E ATUALIZAC

VINCULAÇÃO E LIQUIDAÇÃO EM ANO CONTÁBIL DIFERENTE

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

Objetos da nota:

REPS /PWS/MZYCB004F01

REPS /PWS/MZYCB004F02

 

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

Modificações efetuadas em REPS /PWS/MZYCB004F01

 

...

    delete itab_bsad where kunnr = space

                        or kunnr = '          '.

    loop at itab_bsad.

      v_tabix = sy-tabix.

      loop at itab_zycbt006_aux4 where bukrs      = itab_bsad-bukrs

                                   and dtpagto    = itab_bsad-augdt

                                   and belnr      = itab_bsad-augbl

                                   and gjahr      = itab_bsad-gjahr

                                   and belnr      = itab_bsad-belnr.

        delete itab_bsad index v_tabix.

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

        exit.

* << Fim da inclusão

      endloop.

    endloop.

    if not itab_zycbt006_aux4[] is initial.

      select bukrs hkont augdt augbl gjahr belnr bschl

             gsber wrbtr sgtxt zuonr budat

             into table itab_bsas

             from bsas

             for all entries in itab_zycbt006_aux4

             where bukrs eq itab_zycbt006_aux4-bukrs

               and augdt eq itab_zycbt006_aux4-dtpagto

...

 

...

      if itab_bsas-bschl ne '40' and itab_bsas-bschl ne '50'.

        delete itab_bsas index v_tabix.

        continue.

      endif.

      loop at itab_zycbt006_aux4 where bukrs      = itab_bsas-bukrs

                                   and dtpagto    = itab_bsas-augdt

                                   and belnr      = itab_bsas-augbl

                                   and gjahr      = itab_bsas-gjahr

                                   and belnr      = itab_bsas-belnr.

        delete itab_bsas index v_tabix.

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

        exit.

* << Fim da inclusão

      endloop.

    endloop.

  endif.

  loop at itab_zycbt006 where

                           ( v_status eq 'A' or ( v_status eq 'E' and

                                                  status  eq 'C' ) )

                           and v_armda eq 'X'.

    read table itab_zycbt005_ant

         with key nrinvoic = itab_zycbt006-nrinvoic

                  gsberf   = itab_zycbt006-gsberf

...

 

...

    delete itab_bsad where kunnr = space

                        or kunnr = '          '.

    loop at itab_bsad.

      v_tabix = sy-tabix.

      loop at itab_zycbt006_aux4 where bukrs = itab_bsad-bukrs

                                   and dtpagto    = itab_bsad-augdt

                                   and gjahr      = itab_bsad-gjahr

                                   and belnr      = itab_bsad-augbl

                                   and belnr      = itab_bsad-belnr.

        delete itab_bsad index v_tabix.

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

        exit.

* << Fim da inclusão

      endloop.

    endloop.

    if not itab_zycbt006_aux4[] is initial.

      select bukrs hkont augdt augbl gjahr belnr bschl

             gsber wrbtr sgtxt zuonr budat

             into table itab_bsas

             from bsas

             for all entries in itab_zycbt006_aux4

             where bukrs eq itab_zycbt006_aux4-bukrs

               and augdt eq itab_zycbt006_aux4-dtpagto

...

 

...

      if itab_bsas-bschl ne '40' and itab_bsas-bschl ne '50'.

        delete itab_bsas index v_tabix.

        continue.

      endif.

      loop at itab_zycbt006_aux4 where bukrs      = itab_bsas-bukrs

                                   and dtpagto    = itab_bsas-augdt

                                   and gjahr      = itab_bsas-gjahr

                                   and belnr      = itab_bsas-augbl

                                   and belnr      = itab_bsas-belnr.

        delete itab_bsas index v_tabix.

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

        exit.

* << Fim da inclusão

      endloop.

    endloop.

  endif.

  loop at itab_zycbt006 where

                          ( v_status eq 'A' or

                            ( v_status eq 'E' and status  eq 'C' ) )

                          and v_performance eq 'X'.

    read table itab_zycbt005_ant

         with key nrinvoic = itab_zycbt006-nrinvoic

                  gsberf   = itab_zycbt006-gsberf

...

 

 

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

Modificações efetuadas em REPS /PWS/MZYCB004F02

 

...

  endif.

  perform executa_exit.

  perform verifica_prorrogacao.

  if itab_zycbe033-wrbtr gt 0.

    v_belnr = itab_zycbe033-belnr.

    itab_zycbe033-belnr = v_belnr.

    append itab_zycbe033.

    v_desmembramento = 'X'.

  endif.

  clear: v_tot_cliente, /pws/zycbt084.

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

  select * from /pws/zycbt006

                  into /pws/zycbt006

                  up to 1 rows

                  where nrseqc   = /pws/zycbe001-nrseqc

                    and nrinvoic = itab_zycbt006-nrinvoic

                    and nrparcf  = itab_zycbt006-nrparcf

                    and gsberf   = itab_zycbt006-gsberf.

  endselect.

  if sy-subrc ne 0.

* << Fim da inclusão

  if v_wrbtr = itab_zycbe033-wrbtr

    and /pws/zycbe001-tpcontr(1) ne 'P'

    and /pws/zycbe001-tpcontr(1) ne 'S'.

    v_tot_cliente = 'X'.

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

    endif.

* << Fim da inclusão

  endif.

  v_tpcontabil = 'D_CLI'.

  perform busca_dados_bi using itab_zycbe033-bukrs

...

 

...

              itab_zycbt006-nrparcf

         into v_cpochv.

  itab_zycbe033-cpochv = v_cpochv.

  perform verify_null_field using itab_zycbt006-dtpagto

                                  'DTPAGTO'

                                  text-003.

  itab_zycbe033-budat = itab_zycbt006-dtpagto.

  itab_zycbe033-bldat = itab_zycbt006-dtpagto.

  itab_zycbe033-d_valut = itab_zycbe033-budat.

  read table itab_zycbt030 with key nrinvoic = itab_zycbt006-nrinvoic

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

                                    nrparcf  = itab_zycbt006-nrparcf.

  itab_zycbe033-c_zuonr = itab_zycbt030-vbeln.

* << Fim da exclusão

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

                                    nrparcf  = itab_zycbt006-nrparcf

                                    gsberf   = itab_zycbt006-gsberf.

* << Fim da inclusão

  read table itab_zycbt017 with key nrinvoic = itab_zycbt006-nrinvoic

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

                                    gsberf   = itab_zycbt006-gsberf.

* << Fim da exclusão

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

                                    gsberf   = itab_zycbt006-gsberf

                                    nrparcf   = itab_zycbt006-nrparcf.

* << Fim da inclusão

  loop at itab_zyglt321.

    case itab_zyglt321-cpor3.

...

 

...

        endif.

      when 'ZUONR'.

        if itab_zyglt321-cpocb = 'NRCONTR'.

          itab_zycbe033-d_zuonr = /pws/zycbe001-nrcontr.

        elseif itab_zyglt321-cpocb = 'NRSEQ'.

          itab_zycbe033-d_zuonr = /pws/zycbe001-nrseqc.

        elseif itab_zyglt321-cpocb is initial and

               not itab_zyglt321-descr is initial.

          itab_zycbe033-d_zuonr = itab_zyglt321-descr.

        endif.

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

        itab_zycbe033-c_zuonr = itab_zycbe033-d_zuonr.

* << Fim da inclusão

      when 'ZTERM'.

        if itab_zyglt321-cpocb = 'ZTERM'.

          itab_zycbe033-zterm = itab_zycbt017-zterm.

        endif.

    endcase.

  endloop.

  itab_zycbe033-bktxt  = wa_zycbt007-bktxt.

  perform verify_null_field

    using /pws/zycbt001-bukrs 'BUKRS' text-004.

  itab_zycbe033-bukrs = /pws/zycbt001-bukrs.

...

 

...

    perform (itab_zyglt100-formulario)

            in program (itab_zyglt100-programa).

  endif.

  append itab_zycbe033.

  v_desmembramento = 'X'.

  clear v_vinc_tot.

  v_tpcontabil = 'D_CON'.

  perform busca_dados_bi using itab_zycbe033-bukrs

                               v_tpcontabil.

  clear v_tot_contrato.

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

  select * from /pws/zycbt006

                  into /pws/zycbt006

                  up to 1 rows

                  where nrseqc   = /pws/zycbe001-nrseqc

                    and nrinvoic = itab_zycbt006-nrinvoic

                    and nrparcf  = itab_zycbt006-nrparcf

                    and gsberf   = itab_zycbt006-gsberf.

  endselect.

  if sy-subrc ne 0.

* << Fim da inclusão

  if itab_zycbt005-slpagar is initial and

     not itab_zycbt005-vlvinc < /pws/zycbe001-vlme

     and /pws/zycbe001-tpcontr(1) ne 'P'

     and /pws/zycbe001-tpcontr(1) ne 'S'.

    v_tot_contrato = 'X'.

  endif.

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

  endif.

* << Fim da inclusão

  if v_tot_contrato is initial.

...

 

...

      else.

        itab_zycbe033-d_newko = itab_zyglt316-konts.

      endif.

      perform verify_null_field using itab_zycbe033-d_newko

                                    'SAKNR'

                                    text-010.

    endif.

    itab_zycbe033-koart = 'S'.

  endif.

  itab_zycbe033-belnr   = itab_zycbt006-belnr_d.

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

  if     itab_zycbt005-slpagar    is initial and

* << Fim da exclusão

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

  read table itab_contabil with key nrinvoic = itab_zycbt030-nrinvoic

                                    nrparcf  = itab_zycbt030-nrparcf

                                    gsberf   = /pws/zycbe001-gsber

                                    msg      = text-180.

  if  sy-subrc ne 0 or

      ( itab_zycbt005-slpagar    is initial and

* << Fim da inclusão

     not itab_zycbt005-tpcontr(1) ca 'CEPS'

    and not ( /pws/zycbe001-tpcontr(1)  eq 'D' and

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

              /pws/zycbt089-f_cont_vinc eq 'F' ).

* << Fim da exclusão

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

              /pws/zycbt089-f_cont_vinc eq 'F' ) ).

* << Fim da inclusão

    itab_zycbe033-dtdocto = itab_zycbt005-dtbelnr.

  else.

...

 

...

    itab_partidas-cpochv  = itab_zycbe033-cpochv.

    itab_partidas-belnr   = itab_zycbt030-belnr_d.

    itab_partidas-agkon   = itab_zycbe033-agkon.

    itab_partidas-agkoa   = itab_zycbe033-agkoa.

    itab_partidas-agums   = space.

    itab_partidas-bukrs   = itab_zycbt006-bukrs.

    itab_partidas-shkzg   = 'H'.

    itab_partidas-v_sinal = '+'.

    if itab_zycbt030-belnr_d eq itab_zycbt030-belnr   or

       itab_zycbt030-belnr_d eq itab_zycbt030-belnr6.

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

      v_gjahr = itab_zycbt030-budat(4).

* << Fim da exclusão

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

      perform determina_ano using itab_zycbt030-budat

                                  itab_zycbe033-bukrs

                            changing v_gjahr.

* << Fim da inclusão

      itab_partidas-dtdocto = itab_zycbt030-budat.

      clear itab_partidas-d_zuonr.

    elseif itab_zycbt030-belnr_d eq itab_zycbt030-belnr_t.

      itab_partidas-dtdocto = itab_zycbt030-budat_t.

      clear itab_partidas-d_zuonr.

    else.

      if not /pws/zycbt074-dtcont is initial.

        itab_partidas-dtdocto = /pws/zycbt074-dtcont.

      else.

        itab_partidas-dtdocto = itab_zycbt006-dtpagto.

...

 

...

    itab_partidas-agkon   = itab_zycbe033-d_newko.

    itab_partidas-agkoa   = itab_zycbe033-koart.

    if /pws/zycbe001-tpcontr(1) = 'D' and

       /pws/zycbt089-f_cont_vinc = 'F'.

      itab_partidas-agums   = itab_zycbe033-agums.

    else.

      itab_partidas-agums   = space.

    endif.

    itab_partidas-bukrs   = itab_zycbe033-bukrs.

    itab_partidas-shkzg   = 'S'.

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

    v_gjahr = itab_zycbt006-dtpagto(4).

* << Fim da exclusão

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

    perform determina_ano using itab_zycbe033-dtdocto

                                itab_zycbe033-bukrs

                          changing v_gjahr.

* << Fim da inclusão

    loop at itab_zycbt209 where nrinvoic = itab_zycbt006-nrinvoic

                          and   gsberf   = itab_zycbt006-gsberf

                          and   nrparcf  = itab_zycbt006-nrparcf

                          and   baixa    = 'X'.

      if itab_zycbt209-hkont eq itab_zycbe033-d_newko.

        v_contas_iguais = 'X'.

        exit.

      else.

        clear v_contas_iguais.

        exit.

      endif.

    endloop.

    clear v_year.

    call function '/PWS/ZYGL_OBTEM_ANO_CONTABIL'

         exporting

              v_bukrs                = itab_zycbt005-bukrs

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

              v_date                 = itab_zycbt006-dtpagto

* << Fim da exclusão

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

               v_date                 = itab_zycbe033-dtdocto

* << Fim da inclusão

         importing

              v_year                 = v_year

         exceptions

              variante_de_exercicio  = 1

              data_nao_encontrada    = 2

              empresa_nao_encontrada = 3

              period_in_not_valid    = 4

              period_not_assigned    = 5

              version_undefined      = 6

              others                 = 7.

...

 

...

      delete itab_bsas where hkont = space

                          or hkont = '          '.

      loop at itab_bsas.

        v_tabix = sy-tabix.

        loop at itab_zycbt006_aux4 where bukrs      = itab_bsas-bukrs

                                     and dtpagto    = itab_bsas-augdt

                                     and belnr      = itab_bsas-augbl

                                     and gjahr      = itab_bsas-gjahr

                                     and belnr      = itab_bsas-belnr.

          delete itab_bsas index v_tabix.

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

          exit.

* << Fim da inclusão

        endloop.

      endloop.

      select bukrs kunnr umskz augdt augbl gjahr belnr

             wrbtr

             budat

            from bsad

            into table itab_bsad

            for all entries in itab_zycbt006_aux4

            where bukrs eq itab_zycbt006_aux4-bukrs      and

                  augdt eq itab_zycbt006_aux4-dtpagto    and

...

 

...

      delete itab_bsad where kunnr = space

                          or kunnr = '          '.

      loop at itab_bsad.

        v_tabix = sy-tabix.

        loop at itab_zycbt006_aux4 where bukrs      = itab_bsad-bukrs

                                     and dtpagto    = itab_bsad-augdt

                                     and belnr      = itab_bsad-augbl

                                     and gjahr      = itab_bsad-gjahr

                                     and belnr      = itab_bsad-belnr.

          delete itab_bsad index v_tabix.

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

          exit.

* << Fim da inclusão

        endloop.

      endloop.

    endif.

    if not /pws/zycbe001-desc_receb is initial.

      perform seleciona_desconto.

    endif.

  endif.

  loop at itab_zycbt006 where ( v_status eq 'A' or

                                v_status eq 'E' )

                           and status    eq 'C'.

...

 

...

    delete itab_bsad where kunnr = space

                        or kunnr = '          '.

    loop at itab_bsad.

      v_tabix = sy-tabix.

      loop at itab_zycbt006_aux4 where bukrs      = itab_bsad-bukrs

                                   and dtpagto    = itab_bsad-augdt

                                   and belnr      = itab_bsad-augbl

                                   and gjahr      = itab_bsad-gjahr

                                   and belnr      = itab_bsad-belnr.

        delete itab_bsad index v_tabix.

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

        exit.

* << Fim da inclusão

      endloop.

    endloop.

    if not itab_zycbt006_aux4[] is initial.

      select bukrs hkont augdt augbl gjahr belnr bschl

             gsber wrbtr sgtxt zuonr budat

             into table itab_bsas

             from bsas

             for all entries in itab_zycbt006_aux4

             where bukrs eq itab_zycbt006_aux4-bukrs

               and augdt eq itab_zycbt006_aux4-dtpagto

...

 

...

      if itab_bsas-bschl ne '40' and itab_bsas-bschl ne '50'.

        delete itab_bsas index v_tabix.

        continue.

      endif.

      loop at itab_zycbt006_aux4 where bukrs      = itab_bsas-bukrs

                                   and dtpagto    = itab_bsas-augdt

                                   and belnr      = itab_bsas-augbl

                                   and gjahr      = itab_bsas-gjahr

                                   and belnr      = itab_bsas-belnr.

        delete itab_bsas index v_tabix.

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

        exit.

* << Fim da inclusão

      endloop.

    endloop.

  endif.

  loop at itab_zycbt006 where v_status eq 'A'

                           or ( v_status eq 'E' and status  eq 'C' ).

    if itab_zycbt006-v_armda eq 'X'.

      exit.

    endif.

    if itab_zycbt006-v_performance eq 'X'.

      exit.

...

 

...

    exit.

  endif.

  v_tpcontabil = 'D_CLI'.

  perform busca_dados_bi using itab_zycbe033-bukrs

                               v_tpcontabil.

  clear v_vinc_tot.

  if itab_zycbt030-vlsltrans = itab_zycbe033-wrbtr

    and /pws/zycbe001-tpcontr(1) ne 'P'

    and /pws/zycbe001-tpcontr(1) ne 'S'.

    v_vinc_tot = 'X'.

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

  endif.

  clear v_tot_cliente.

  select * from /pws/zycbt006

                  into /pws/zycbt006

                  up to 1 rows

                  where nrseqc   = /pws/zycbe001-nrseqc

                    and nrinvoic = itab_zycbt006-nrinvoic

                    and nrparcf  = itab_zycbt006-nrparcf

                    and gsberf   = itab_zycbt006-gsberf.

  endselect.

  if sy-subrc ne 0.

    v_tot_cliente = v_vinc_tot.

* << Fim da inclusão

  endif.

  clear /pws/zycbt084.

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

  if v_vinc_tot is initial.

* << Fim da exclusão

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

  if v_tot_cliente is initial.

* << Fim da inclusão

    loop at itab_zycbt034.

      message i016 with itab_zycbt034-descricao.

    endloop.

  endif.

  if itab_zycbt034 is initial.

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

    if v_vinc_tot is initial.

* << Fim da exclusão

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

    if v_tot_cliente is initial.

* << Fim da inclusão

      call function '/PWS/ZYCB_TRANSACAO_F_30_P'

           exporting

                v_modo          = v_modo_bi

                v_vinc_tot      = 'X'

           tables

                t_dados         = itab_zycbe033

                t_campo         = itab_zycbt034

                t_zycbt032      = itab_zycbt032

                t_zycbt036      = itab_zycbt036

                t_doctos        = itab_doctos

...

 

...

                  itab_zycbt006-nrinvoic itab_zycbt006-gsberf

                  itab_zycbt006-nrparcf

                  itab_zycbt006-dtvincul itab_zycbt006-dtvencto

                  itab_zycbt006-dtpagto  itab_zycbt030-vbeln

                  itab_zycbt030-belnr    into v_cpochv.

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

                                        tabela = '/PWS/ZYCBT006'

                                        cpochv = v_cpochv

                                        tpmsg  = 'S'.

      if sy-subrc = 0

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

         or not v_vinc_tot is initial.

* << Fim da exclusão

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

          or not v_tot_cliente is initial.

* << Fim da inclusão

        if not itab_zycbt032-belnr is initial.

          itab_zycbt030-belnr_d = itab_zycbt032-belnr.

          itab_zycbt030-budat  = v_dtpagto.

          modify itab_zycbt030.

          itab_contabil-nrinvoic = itab_zycbt030-nrinvoic.

          itab_contabil-vbeln    = itab_zycbt030-vbeln.

          itab_contabil-gsberf   = itab_zycbt030-gsberf.

          itab_contabil-nrparcf  = itab_zycbt030-nrparcf.

          itab_contabil-docto    = itab_zycbt032-belnr.

          itab_contabil-dtdocto  = v_dtpagto.

...

 

...

        /pws/zycbt084-nrparcf  = itab_zycbt006-nrparcf.

        /pws/zycbt084-gsberf   = itab_zycbt006-gsberf.

        /pws/zycbt084-dtvincul = itab_zycbt006-dtvincul.

        /pws/zycbt084-dtvencto = itab_zycbt006-dtvencto.

        /pws/zycbt084-dtpagto  = itab_zycbt006-dtpagto.

        /pws/zycbt084-dtpagext = itab_zycbt006-dtpagext.

        /pws/zycbt084-vbeln    = itab_zycbt030-vbeln.

        /pws/zycbt084-belnr    = itab_zycbt032-belnr.

        /pws/zycbt084-liq_and  = space.

        /pws/zycbt084-tdesmemb = 'K'.

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

        if not v_vinc_tot is initial.

* << Fim da exclusão

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

        if not v_tot_cliente is initial.

* << Fim da inclusão

          /pws/zycbt084-cont_desmemb = 'X'.

        endif.

        modify /pws/zycbt084 from /pws/zycbt084.

      else.

        v_subrc = 4.

        loop at itab_zycbt032 where tcode  = 'F-30'

                                and tabela = 'ZYCBT006'

                                and cpochv = v_cpochv.

          itab_erro-vbeln = itab_zycbt030-vbeln.

          itab_erro-msg   = itab_zycbt032-msg.

...

 

...

  endif.

  sy-subrc = v_subrc.

  perform clear_date_batch.

endform.

form abre_docto_ace_2

                                 changing v_subrc.

  perform clear_date_batch.

  clear v_vinc_tot.

  perform fill_date6_f30_ace.

  clear v_tot_contrato.

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

  select * from /pws/zycbt006

                  into /pws/zycbt006

                  up to 1 rows

                  where nrseqc   = /pws/zycbe001-nrseqc

                    and nrinvoic = itab_zycbt006-nrinvoic

                    and nrparcf  = itab_zycbt006-nrparcf

                    and gsberf   = itab_zycbt006-gsberf.

  endselect.

  if sy-subrc ne 0.

* << Fim da inclusão

  if itab_zycbt005-slpagar is initial and

     not itab_zycbt005-vlvinc < /pws/zycbe001-vlme

     and /pws/zycbe001-tpcontr(1) ne 'P'

     and /pws/zycbe001-tpcontr(1) ne 'S'.

    v_tot_contrato = 'X'.

  endif.

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

  endif.

* << Fim da inclusão

  v_tpcontabil = 'D_CON'.

...

 

...

  if sy-subrc eq 0

     and not itab_zyglt100-zexit_ativa is initial.

    perform (itab_zyglt100-formulario)

            in program (itab_zyglt100-programa).

  endif.

  clear v_vinc_tot.

  if itab_zycbe033-wrbtr = itab_zycbt209-saldo

    and /pws/zycbe001-tpcontr(1) ne 'P'

    and /pws/zycbe001-tpcontr(1) ne 'S'.

    v_vinc_tot = 'X'.

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

  endif.

  clear v_tot_cliente.

  select * from /pws/zycbt006

                  into /pws/zycbt006

                  up to 1 rows

                  where nrseqc   = /pws/zycbe001-nrseqc

                    and nrinvoic = itab_zycbt006-nrinvoic

                    and nrparcf  = itab_zycbt006-nrparcf

                    and gsberf   = itab_zycbt006-gsberf.

  endselect.

  if sy-subrc ne 0.

    v_tot_cliente = v_vinc_tot.

* << Fim da inclusão

  endif.

  append itab_zycbe033.

  v_tpcontabil = 'D_LIA'.

  perform busca_dados_bi using itab_zycbe033-bukrs

                               v_tpcontabil.

  clear /pws/zycbt084.

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

  if v_vinc_tot is initial.

* << Fim da exclusão

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

  if v_tot_cliente is initial.

* << Fim da inclusão

    loop at itab_zycbt034.

      message i016 with itab_zycbt034-descricao.

    endloop.

  endif.

  if itab_zycbt034 is initial.

    read table itab_zyglt100 with key zexit = 'LIQ027'.

    if sy-subrc eq 0 and not itab_zyglt100-zexit_ativa is initial.

      perform (itab_zyglt100-formulario)

              in program (itab_zyglt100-programa).

    else.

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

      if v_vinc_tot is initial.

* << Fim da exclusão

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

      if v_tot_cliente is initial.

* << Fim da inclusão

        call function '/PWS/ZYCB_TRANSACAO_F_30_P'

             exporting

                  v_modo          = v_modo_bi

                  v_vinc_tot      = v_vinc_tot

                  v_liq_and       = 'X'

             tables

                  t_dados         = itab_zycbe033

                  t_campo         = itab_zycbt034

                  t_zycbt032      = itab_zycbt032

                  t_zycbt036      = itab_zycbt036

...

 

...

      else.

        clear sy-subrc.

      endif.

    endif.

    if sy-subrc = 0.

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

                                        tabela = 'ZYCBT006'

                                        cpochv = itab_zycbe033-cpochv

                                        tpmsg  = 'S'.

      if sy-subrc eq 0

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

         or not v_vinc_tot is initial.

* << Fim da exclusão

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

         or not v_tot_cliente is initial.

* << Fim da inclusão

        if itab_zycbt032-belnr is initial.

          itab_zycbt032-belnr   = itab_zycbe033-belnr.

          itab_zycbt209-belnr_d = itab_zycbe033-belnr.

          itab_zycbt209-budat_d = itab_zycbe033-dtdocto.

        else.

          itab_zycbt209-belnr_d = itab_zycbt032-belnr.

          itab_zycbt209-budat_d = itab_zycbt006-dtpagto.

          itab_contabil-nrinvoic = itab_zycbt209-nrinvoic.

          itab_contabil-vbeln    = itab_zycbt209-belnr.

          itab_contabil-nrparcf  = itab_zycbt209-nrparcf.

...

 

...

        /pws/zycbt084-gsberf   = itab_zycbt006-gsberf.

        /pws/zycbt084-dtvincul = itab_zycbt006-dtvincul.

        /pws/zycbt084-dtvencto = itab_zycbt006-dtvencto.

        /pws/zycbt084-dtpagto  = itab_zycbt006-dtpagto.

        /pws/zycbt084-dtpagext = itab_zycbt006-dtpagext.

        /pws/zycbt084-belnr    = itab_zycbt032-belnr.

        /pws/zycbt084-vbeln    = itab_zycbt209-belnr.

        /pws/zycbt084-liq_and  = 'X'.

        /pws/zycbt084-tdesmemb = 'H'.

        /pws/zycbt084-result_saldo = itab_recurso_aux-vl_total_saldo.

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

        if not v_vinc_tot is initial.

* << Fim da exclusão

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

        if not v_tot_cliente is initial.

* << Fim da inclusão

          /pws/zycbt084-cont_desmemb = 'X'.

        endif.

        modify /pws/zycbt084 from /pws/zycbt084.

        v_subrc = 0.

      else.

        loop at itab_zycbt032 where tcode  = 'F-30'

                                and tabela = 'ZYCBT006'

                                and cpochv = v_cpochv.

          itab_erro-vbeln = itab_zycbt209-belnr.

          itab_erro-msg   = itab_zycbt032-msg.

...

 

...

    perform local_negocio.

    perform verifica_pais_filial using itab_zycbt006-bukrs

                                       wa_t001w-j_1bbranch.

    itab_zycbe033-brnch = wa_t001w-j_1bbranch.

  endif.

  append itab_zycbe033.

  v_tpcontabil = 'D_CON'.

  perform busca_dados_bi using itab_zycbe033-bukrs

                               v_tpcontabil.

  clear v_tot_contrato.

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

  select * from /pws/zycbt006

                  into /pws/zycbt006

                  up to 1 rows

                  where nrseqc   = /pws/zycbe001-nrseqc

                    and nrinvoic = itab_zycbt006-nrinvoic

                    and nrparcf  = itab_zycbt006-nrparcf

                    and gsberf   = itab_zycbt006-gsberf.

  endselect.

  if sy-subrc ne 0.

* << Fim da inclusão

  if itab_zycbt005-slpagar is initial and

     not itab_zycbt005-vlme_p < /pws/zycbe001-vlme

     and /pws/zycbe001-tpcontr(1) ne 'P'

     and /pws/zycbe001-tpcontr(1) ne 'S'.

    v_tot_contrato = 'X'.

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

    endif.

* << Fim da inclusão

  endif.

  if v_tot_contrato is initial.

...

 

...

      delete itab_bsas where hkont = space

                          or hkont = '          '.

      loop at itab_bsas.

        v_tabix = sy-tabix.

        loop at itab_zycbt006_aux4 where bukrs      = itab_bsas-bukrs

                                     and dtpagto    = itab_bsas-augdt

                                     and belnr      = itab_bsas-augbl

                                     and gjahr      = itab_bsas-gjahr

                                     and belnr      = itab_bsas-belnr.

          delete itab_bsas index v_tabix.

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

          exit.

* << Fim da inclusão

        endloop.

      endloop.

      if not itab_zycbt006_aux4[] is initial.

        select bukrs kunnr umskz augdt augbl gjahr belnr

               wrbtr

               budat

              from bsad

              into table itab_bsad

              for all entries in itab_zycbt006_aux4

              where bukrs eq itab_zycbt006_aux4-bukrs      and

...

 

...

      delete itab_bsad where kunnr = space

                          or kunnr = '          '.

      loop at itab_bsad.

        v_tabix = sy-tabix.

        loop at itab_zycbt006_aux4 where bukrs      = itab_bsad-bukrs

                                     and dtpagto    = itab_bsad-augdt

                                     and belnr      = itab_bsad-augbl

                                     and gjahr      = itab_bsad-gjahr

                                     and belnr      = itab_bsad-belnr.

          delete itab_bsad index v_tabix.

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

          exit.

* << Fim da inclusão

        endloop.

      endloop.

    endif.

  endif.

  loop at itab_zycbt006 where

                           ( v_status eq 'A' or

                             ( v_status eq 'E' and status  eq 'C' ) )

                          and v_performance eq 'X'.

    read table itab_zycbt005_ant

               with key nrinvoic = itab_zycbt006-nrinvoic

...