Histórico da Página
Documento de API
Produto: | Datasul |
Ocorrência: | Documentação de API |
| Nome Físico | prgfin/apb/apb768zd |
Objetivo
Efetuar o estorno de movimentos dos títulos do contas a pagar ou o cancelamento dos mesmos.
Funcionamento
A sintaxe para a chamada da API/BO é:
run prgfin/apb/apb768zd.py (input p_num_vers_integr_api,
input p_cod_modulo,
input p_cod_matriz_trad_org_ext,
input table tt_cancelamento_estorno_apb,
input table tt_estornar_agrupados,
output table tt_log_erros_atualiz,
output table tt_log_erros_estorn_cancel_apb,
output table tt_estorna_tit_imptos,
output p_log_confir_estorn_cancel).
Considerações:
Antes das definições das temp-tables é necessário incluir a definição da include abaixo.
/*-- Filtro RECID x ROWID Aplicado --*/
{include/i_fncrowid.i}
Os parâmetros de entrada são:
Parâmetro | Descrição |
p_num_vers_integr_api | Será utilizado para determinar se o programa que está chamando está íntegro com as definições correntes da API, utilizar o valor "1". |
| p_cod_modulo | Conterá o módulo, será utilizado para verificar se o módulo é “rep”. |
| p_cod_matriz_trad_org_ext | Conterá o código da matriz de tradução da organização externa que tem por finalidade relacionar os códigos externos aos códigos presentes no Datasul-EMS5, caso a matriz de tradução não tiver sido informada, o parâmetro estará em branco. |
| tt_cancelamento_estorno_apb | Conterá os dados dos Títulos ou Movimentos a serem estornos/cancelamentos. |
| tt_estornar_agrupados | Esta temp-table somente deverá ser criada no programa chamador e passada como parâmetro, a mesma é de uso interno e não poderá conter valor no momento da passagem como parâmetro. |
Os parâmetros de saída são:
Parâmetro | Descrição |
| tt_log_erros_atualiz |
| Conterá os dados dos erros ocorridos durante a execução do programa. |
| tt_log_erros_estorn_cancel_apb |
| Conterá os dados dos erros ocorridos durante a execução do programa. |
| tt_estorna_tit_imptos |
| Conterá os títulos que podem conter impostos vinculados ao fornecedor |
| . A mesma é de uso interno |
| . |
| p_log_ |
| confir_estorn_cancel |
| Variável do tipo |
| lógico, que receberá o valor do retorno do programa, porém está variável não deverá ser utilizada pelo programa que chama a api |
| após o retorno |
| . A mesma é de uso interno. |
Tabelas Temporárias
Tabela Temporária | Descrição | Entrada/Saída |
tt_cancelamento_estorno_apb |
Conterá as informações do título e informações gerais. | Entrada |
(*) A partir da 5.07A o estabelecimento passa a ter cinco dígitos.
(**) Liberado o número de documento com 16 posições e série com 5, a partir de maio/2011.
Atributo | Tipo | Formato | Descrição | Obrig. | Evol. |
ttv_ind_niv_operac_apb | character | X(10) | 1 = Movimento 2 = Titulo |
ttv_ind_tip_operac_apb | character | X(12) | 1 = Estorno 2 = Cancelamento |
tta_cod_estab | character | x(3) / x(5)* | Estabelecimento |
tta_num_id_tit_ap | integer | 1E+10 | Token Tit AP |
tta_num_id_movto_tit_ap | integer | 1E+10 | Token Movto Tit AP |
tta_cod_refer | character | x(10) | Referência |
tta_dat_transacao | date | 99/99/9999 | Data Transação |
tta_cod_histor_padr | character | x(8) | Histórico Padrão |
ttv_des_histor | character | x(40) | Contém |
ttv_ind_tip_estorn | character | X(10) | 1 = Parcial 2 = Total |
tta_cod_portador | character | x(5) | Portador |
ttv_cod_estab_reembol | character | x(8) | Estabelecimento Reembolso |
ttv_log_reaber_item | logical | Sim/Não | Reabre Item |
ttv_log_reembol | logical | Sim/Não | Reembolso |
ttv_log_estorn_impto_retid | logical | Sim/Não | Estorna Imposto |
tta_cod_estab_ext | character | x(8) | Estabelecimento Externo |
ttv_rec_tit_ap | recid\rowid | >>>>>>9 (recid) | Recid\Rowid Título |
. | |||
tta_cdn_fornecedor | Integer | >>>,>>>,>>9 | Fornecedor |
tta_cod_espec_docto | character | x(3) | Espécie Documento |
tta_cod_ser_docto | character | x(3)/x(5)** | Série Documento |
tta_cod_tit_ap | character | x(10)/x(16)** | Título |
tta_cod_parcela | character | x(02) | Parcela |
def temp-table tt_cancelamento_estorno_apb _1 no-undo
field ttv_ind_niv_operac_apb apb as character format "X(10)"
field ttv_ind_tip_operac_apb apb as character format "X(12)"
field tta_cod_estab estab as character format "x(5)" label "Estabelecimento" column-label "Estab"
field tta_num_id_tit_ap ap as integer format "9999999999" initial 0 label "Token Tit AP" column-label "Token Tit AP"
field tta_num_id_movto_tit_ap ap as integer format "9999999999" initial 0 label "Token Movto Tit AP" column-label "Id Tit AP"
field tta_cod_refer refer as character format "x(10)" label "Referência" column-label "Referência"
field tta_dat_transacao as as date format "99/99/9999" initial today label "Data Transa‡ãoTransação" column-label "Dat Transac"
field tta_cod_histor_padr padr as character format "x(8)" label "Histórico Padrão" column-label "Histórico Padrão"
field ttv_des_histor histor as character format "x(40)" label "Contém" column-label "Histórico"
field ttv_ind_tip_estorn estorn as character format "X(10)"
field tta_cod_portador portador as character format "x(5)" label "Portador" column-label "Portador"
field ttv_cod_estab_reembol reembol as character format "x(8)"
field ttv_log_reaber_item item as logical format "Sim/Não" initial yes
field ttv_log_reembol reembol as logical format "Sim/Não" initial yes
field ttv_log_estorn_impto_retid retid as logical format "Sim/Não" initial yes
field tta_cod_estab_ext ext as character format "x(8)" label "Estabelecimento Exte" column-label "Estabelecimento Ext"
field ttv_rec_tit_ap as _ap as &IF "{&ROWID_READY}" = "YES" &THEN rowid &ELSE recid format ">>>>>>9" initial ? &ENDIF
field tta_cdn_fornecedor fornecedor as Integer format ">>>,>>>,>>9" initial 0 label "Fornecedor" column-label "Fornecedor"
field tta_cod_espec_docto docto as character format "x(3)" label "Espécie Documento" column-label "Espécie"
field tta_cod_ser_docto docto as character format "x(35)" label "Série Documento" column-label "Série"
field tta_cod_tit_ap ap as character format "x(1016)" label "Título" column-label "Título"
field tta_cod_parcela parcela as character format "x(02)" label "Parcela" column-label "Parc"
.
Tabela Temporária | Descrição | Entrada/Saída |
tt_estornar_agrupados | Esta temp-table apenas deverá ser definida, não poderá receber valor, é de uso interno. | Entrada |
((*) A partir da 5.07A o estabelecimento passa a ter cinco dígitos.
(**) Liberado o número de documento com 16 posições e série com 5, a partir de maio/2011.
Atributo | Tipo | Formato | Descrição | Obrig. | Evol. |
ttv_num_seq | integer | >>>,>>9 | Seqüência |
tta_nom_abrev | character | x(15) | Nome Abreviado |
tta_cod_estab_pagto | character | x(3) / x(5)* | Estabelecimento Pagamento |
tta_cod_refer | character | x(10) | Referência |
tta_dat_pagto | date | 99/99/9999 | Data Pagamento |
tta_cod_estab | character | x(3) / x(5)* | Estabelecimento |
tta_cod_espec_docto | character | x(3) | Espécie Documento |
tta_cod_ser_docto | character | x(3)/x(5)** | Série Documento |
tta_cod_tit_ap | character | x(10)/x(16)** | Título |
tta_cod_parcela | character | x(02) | Parcela |
tta_val_movto_ap | decimal | ->>>,>>>,>>9.99 | Valor Movimento |
tta_ind_modo_pagto | character | X(10) | Modo Pagamento |
tta_cod_empresa | character | x(3) | Empresa |
ttv_rec_tit_ap | recid\rowid | >>>>>>9 (recid) | Recid\Rowid Título |
. |
ttv_num_seq_abrev | integer | >>>9 | Sequência |
tta_ind_trans_ap_abrev | character | X(04) | Transação Abreviada |
ttv_rec_compl_movto_pagto | recid\rowid | >>>>>>9 (recid) | Recid |
\Rowid. |
ttv_rec_movto_tit_ap | recid\rowid | >>>>>>9 (recid) | Recid |
\Rowid. |
ttv_rec_item_cheq_ap | recid\rowid | >>>>>>9 (recid) | Recid |
\Rowid. |
ttv_rec_item_bord_ap | recid\rowid | >>>>>>9 (recid) | Recid |
\Rowid. |
ttv_rec_item_lote_pagto | recid\rowid | >>>>>>9 (recid) | Recid |
\Rowid. |
def temp-table tt_estornar_agrupados no-undo
field ttv_num_seq seq as integer format ">>>,>>9" label "SequênciaSeqüência" column-label "Seq"
field tta_nom_abrev abrev as character format "x(15)" label "Nome Abreviado" column-label "Nome Abreviado"
field tta_cod_estab_pagto as pagto as character format "x(5)" label "Estab Pagto" column-label "Estab Pagto"
field tta_cod_refer refer as character format "x(10)" label "Referência" column-label "Referência"
field tta_dat_pagto pagto as date format "99/99/9999" initial today label "Data Pagamento" column-label "Data Pagto"
field tta_cod_estab estab as character format "x(5)" label "Estabelecimento" column-label "Estab"
field tta_cod_espec_docto docto as character format "x(3)" label "Espécie Documento" column-label "Espécie"
field tta_cod_ser_docto docto as character format "x(35)" label "Série Documento" column-label "Série"
field tta_cod_tit_ap as ap as character format "x(1016)" label "Título" column-label "Título"
field tta_cod_parcela parcela as character format "x(02)" label "Parcela" column-label "Parc"
field tta_val_movto_ap ap as decimal format "->>>,>>>,>>9.99" decimals 2 initial 0 label "Valor Valor Movimento" column-label "Valor Movto"
field tta_ind_modo_pagto pagto as character format "X(10)" label "Modo Modo Pagamento" column-label "Modo Pagto"
field tta_cod_empresa empresa as character format "x(3)" label "Empresa" column-label "Empresa"
field ttv_rec_tit_ap as ap as &IF "{&ROWID_READY}" = "YES" &THEN rowid &ELSE recid format ">>>>>>9" initial ? &ENDIF
field ttv_num_seq_abrev abrev as integer format ">>>9" label "Sq" column-label "Seq"
field tta_ind_trans_ap_abrev as abrev as character format "X(04)" label "Trans Abrev" column-label "Trans Abrev"
field ttv_rec_compl_movto_pagto as pagto as &IF "{&ROWID_READY}" = "YES" &THEN rowid &ELSE recid format ">>>>>>9" &ENDIF
field ttv_rec_movto_tit_ap as ap as &IF "{&ROWID_READY}" = "YES" &THEN rowid &ELSE recid format ">>>>>>9" &ENDIF
field ttv_rec_item_cheq_ap as ap as &IF "{&ROWID_READY}" = "YES" &THEN rowid &ELSE recid format ">>>>>>9" &ENDIF
field ttv_rec_item_bord_ap as ap as &IF "{&ROWID_READY}" = "YES" &THEN rowid &ELSE recid format ">>>>>>9" &ENDIF
field ttv_rec_item_lote_pagto as pagto as &IF "{&ROWID_READY}" = "YES" &THEN rowid &ELSE recid format ">>>>>>9" &ENDIF
index tt_ind_modo modo
tta_ind_modo_pagto ascending
.
pagto ascending
.
Tabela Temporária | Descrição | Entrada/Saída |
tt_log_erros |
Conterá as informações de erro que poderão ocorrer na execução do programa.
Saída
(*) A partir da 5.07A o estabelecimento passa a ter cinco dígitos.
Atributo | Tipo | Formato | Descrição | Obrig. | Evol. |
tta_cod_estab | character | x(3) / x(5)* | Estabelecimento |
|
|
tta_cod_refer | character | x(10) | Referência |
|
|
tta_num_seq_refer | integer | >>>9 | Sequência |
|
|
ttv_num_mensagem | integer | >>>>,>>9 | Número |
|
|
ttv_des_msg_erro | character | x(60) | Mensagem Erro |
|
|
ttv_des_msg_ajuda | character | x(40) | Mensagem Ajuda |
|
|
ttv_ind_tip_relacto | character | X(15) | Tipo Relacionamento |
|
|
ttv_num_relacto | integer | >>>>,>>9 | Relacionamento |
|
|
def temp-table tt_log_erros_atualiz no-undo
field tta_cod_estab as character format "x(5)" label "Estabelecimento" column-label "Estab"
field tta_cod_refer as character format "x(10)" label "Referência" column-label "Referência"
field tta_num_seq_refer as integer format ">>>9" initial 0 label "Sequência" column-label "Seq"
field ttv_num_mensagem as integer format ">>>>,>>9" label "Número" column-label "Número Mensagem"
field ttv_des_msg_erro as character format "x(60)" label "Mensagem Erro" column-label "Inconsistência"
field ttv_des_msg_ajuda as character format "x(40)" label "Mensagem Ajuda" column-label "Mensagem Ajuda"
field ttv_ind_tip_relacto as character format "X(15)" label "Tipo Relacionamento" column-label "Tipo Relac"
field ttv_num_relacto as integer format ">>>>,>>9" label "Relacionamento" column-label "Relacionamento"
.
Tabela Temporária
Descrição
Entrada/Saída
_atualiz | Conterá as informações de erro que poderão ocorrer na execução do programa. | Saída |
...
(*) A partir da 5.07A o estabelecimento passa a ter cinco dígitos.
Atributo | Tipo | Formato | Descrição | Obrig. | Evol. |
tta_cod_estab | character | x(3) / x(5)* | Estabelecimento | ||
tta_cod_ |
refer | character |
x(10) | Referência | |||
tta_ |
num_seq_refer | integer |
>>>9 |
Sequência |
ttv_num_mensagem |
integer | >>>>, |
>>9 |
Número |
ttv_des_ |
msg_ |
erro | character | x(60) | Mensagem Erro | ||
ttv_des_msg |
x(60)
Mensagem Erro
ttv_des_msg_erro
...
_ajuda | character | x(40) | Mensagem Ajuda | ||
ttv_ind_tip_relacto | character | X(15) | Tipo Relacionamento | ||
ttv_num_relacto | integer | >>>>,>>9 | Relacionamento |
def temp-table tt_log_erros_atualiz no-undo
field tta_cod_estab as estab as character format "x(5)" label "Estabelecimento" column-label "Estab"
field tta_cod_refer refer as character format "x(10)" label "Referência" column-label "Referência"
field tta_num_seq_refer refer as integer format ">>>9" initial 0 label "Sequência" column-label "Seq"
field ttv_num_mensagem mensagem as integer format ">>>>,>>9" label "Número" column-label "Número Mensagem"
field ttv_des_msg_erro erro as character format "x(60)" label "Mensagem Erro" column-label "Inconsistência"
field field ttv_des_msg_ajuda ajuda as character format "x(40)" label "Mensagem Ajuda" column-label "Mensagem Ajuda"
field ttv_ind_tip_relacto relacto as character format "X(15)" label "Tipo Relacionamento" column-label "Tipo Relac"
field ttv_num_relacto relacto as integer format ">>>>,>>9" label "Relacionamento" column-label "Relacionamento" .
.
Tabela Temporária | Descrição | Entrada/Saída |
tt_log_erros_estorn_cancel_apb | Conterá as informações de erro que poderão ocorrer na execução do programa. | Saída |
...
(*) A partir da 5.07A o estabelecimento passa a ter cinco dígitos.
Atributo | Tipo | Formato | Descrição | Obrig. | Evol. |
tta_cod_estab | character | x(3) / x(5)* | Estabelecimento |
Estabelecimento
tta_cod_refer | character | x(10) |
Referência |
tta_num_mensagem | integer | >>,>>>,>>9 |
Mensagem |
ttv_des_msg_erro | character | x(60) | Mensagem Erro |
Mensagem de Erro
...
| ttv_des_msg_ajuda | character | x(40) | Mensagem Ajuda |
def temp-table tt_log_erros_estorn_cancel_apb no-undo
field tta_cod_estab estab as character format "x(5)" label "Estabelecimento" column-label "Estab"
field tta_cod_refer refer as character format "x(10)" label "Referência" column-label "Referência"
field tta_num_mensagem mensagem as integer format ">>,>>>,>>9" initial 0 label "Mensagem" column-label "Mensagem"
field ttv_des_msg_erro erro as character format "x(60)" label "Mensagem Erro" column-label "Inconsistência"
field ttv_des_msg_ajuda ajuda as character format "x(40)" label "Mensagem Ajuda" column-label "Mensagem Ajuda"
.
Tabela Temporária | Descrição | Entrada/Saída |
tt_estorna_tit_imptos | Conterá as informações dos títulos que poderão Ter impostos vinculados ao fornecedor, ressaltando que a mesma é de uso interno, e não poderá conter valor, na passagem de parâmetro. | Saída |
(*) A partir da 5.07A o estabelecimento passa a ter cinco dígitos.
(**) Liberado o número de documento com 16 posições e série com 5, a partir de maio/2011.
Atributo | Tipo | Formato | Descrição | Obrig. | Evol. |
ttv_cod_refer_imp | character | x(10) | Referência |
ttv_cod_refer | character | x(10) | Referência |
ttv_cod_estab_imp | character | x(3) / x(5)* | Estabelecimento Imposto |
ttv_cdn_fornecedor_imp | Integer | >>>,>>>,>>9 | Fornecedor |
ttv_cod_espec_docto_imp | character | x(3) | Espécie Documento |
ttv_cod_ser_docto_imp | character | x(3)/x(5)** | Série Documento |
ttv_cod_tit_ap_imp | character | x(10)/x(16)** | Título |
ttv_cod_parcela_imp | character | x(02) | Parcela |
ttv_val_tit_ap_imp | decimal | ->>>,>>>,>>9.99 | Valor Título |
ttv_val_sdo_tit_ap_imp | decimal | ->>>,>>>,>>9.99 | Valor Saldo |
ttv_num_id_tit_ap_imp | integer | 9999999999 | Token Tit AP |
ttv_num_mensagem | integer | >>>>,>>9 | Número |
ttv_des_mensagem | character | x(50) | Mensagem |
ttv_des_ajuda | character | x(50) | Ajuda |
ttv_cod_estab_2 | character | x(3) / x(5)* | Estabelecimento |
ttv_cod_estab | character | x(3) / x(5)* | Estabelecimento |
ttv_cdn_fornecedor | Integer | >>>,>>>,>>9 | Fornecedor |
ttv_cod_espec_docto | character | x(3) | Espécie Documento |
ttv_cod_ser_docto | character | x(3)/x(5)** | Série Documento |
ttv_cod_tit_ap | character | x(10)/x(16)** | Título Ap |
ttv_cod_parcela | character | x(02) | Parcela |
ttv_val_tit_ap | decimal | ->>,>>>,>>>,>>9.99 | Valor Título |
ttv_val_sdo_tit_ap | decimal | ->>>,>>>,>>9.99 | Valor Saldo |
ttv_num_id_tit_ap | integer | 9999999999 | Token Tit AP |
ttv_ind_trans_ap_abrev | character | X(04) | Transação |
ttv_cod_refer_2 | character | x(10) | Referência |
ttv_num_order | integer | >>>>,>>9 | Ordem |
ttv_val_tot_comprtdo | decimal | ->>>,>>>,>>9.99 | Valor Total Comprometido |
def temp-table tt_estorna_tit_imptos no-undo
field ttv_cod_refer_imp as imp as character format "x(10)" label "Referência" column-label "Referência"
field ttv_cod_refer refer as character format "x(10)" label "Referência" column-label "Referência"
field ttv_cod_estab_imp as imp as character format "x(5)" label "Estabelec. Impto." column-label "Estab. Imp."
field ttv_cdn_fornecedor_imp imp as Integer format ">>>,>>>,>>9" label "Fornecedor" column-label "Fornecedor"
field ttv_cod_espec_docto_imp imp as character format "x(3)" label "Espécie Documento" column-label "Espécie"
field ttv_cod_ser_docto_imp imp as character format "x(35)" label "Série Documento" column-label "Série"
field ttv_cod_tit_ap_imp imp as character format "x(1016)" label "Título" column-label "Título"
field ttv_cod_parcela_imp imp as character format "x(02)" label "Parcela" column-label "Parc"
field ttv_val_tit_ap_imp imp as decimal format "->>>,>>>,>>9.99" decimals 2 label "Valor Título" column-label "Valor Título"
field ttv_val_sdo_tit_ap_imp imp as decimal format "->>>,>>>,>>9.99" decimals 2 label "Valor Saldo" column-label "Valor Saldo"
field ttv_num_id_tit_ap_imp imp as integer format "9999999999" label "Token Tit AP" column-label "Token Tit AP"
field ttv_num_mensagem mensagem as integer format ">>>>,>>9" label "Número" column-label "Número Mensagem"
field ttv_des_mensagem mensagem as character format "x(50)" label "Mensagem" column-label "Mensagem"
field ttv_des_ajuda ajuda as character format "x(50)" label "Ajuda" column-label "Ajuda"
field ttv_cod_estab_2 as 2 as character format "x(5)" label "Estabelecimento" column-label "Estab"
field ttv_cod_estab as estab as character format "x(5)" label "Estabelecimento" column-label "Estabelecimento"
field ttv_cdn_fornecedor fornecedor as Integer format ">>>,>>>,>>9" label "Fornecedor" column-label "Fornecedor"
field ttv_cod_espec_docto docto as character format "x(3)" label "Espécie Documento" column-label "Espécie"
field ttv_cod_ser_docto docto as character format "x(35)" label "Série Docto" column-label "Série"
field ttv_cod_tit_ap ap as character format "x(1016)" label "Título Ap" column-label "Título Ap"
field ttv_cod_parcela parcela as character format "x(02)" label "Parcela" column-label "Parc"
field ttv_val_tit_ap ap as decimal format "->>,>>>,>>>,>>9.99" decimals 2 label "Valor Título" column-label "Valor Título"
field ttv_val_sdo_tit_ap ap as decimal format "->>>,>>>,>>9.99" decimals 2 label "Valor Saldo" column-label "Valor Saldo"
field ttv_num_id_tit_ap ap as integer format "9999999999" label "Token Tit AP" column-label "Token Tit AP"
field ttv_ind_trans_ap_abrev abrev as character format "X(04)" label "Transa‡ãoTransação" column-label "Transa‡ãoTransação"
field ttv_cod_refer_2 2 as character format "x(10)" label "Referência" column-label "Referência"
field ttv_num_order order as integer format ">>>>,>>9" label "Ordem" column-label "Ordem"
field ttv_val_tot_comprtdo comprtdo as decimal format "->>>,>>>,>>9.99" decimals 2
index tt_idimpto idimpto
ttv_cod_estab_imp imp ascending
ttv_cdn_fornecedor_imp imp ascending
ttv_cod_espec_docto_imp imp ascending
ttv_cod_ser_docto_imp imp ascending
ttv_cod_tit_ap_imp ascending imp ascending
ttv_cod_parcela_imp imp ascending
index tt_idimpto_pgef pgef
ttv_cod_estab estab ascending
ttv_cod_refer refer ascending
index tt_idtit_refer refer
ttv_cod_estab_2 ascending 2 ascending
ttv_cdn_fornecedor fornecedor ascending
ttv_cod_espec_docto ascending docto ascending
ttv_cod_ser_docto docto ascending
ttv_cod_tit_ap ap ascending
ttv_cod_parcela parcela ascending
ttv_cod_refer_2 2 ascending
index tt_numsg numsg
ttv_num_mensagem mensagem ascending
index tt_order order
ttv_num_order ascending order ascending
.