[RESOLVIDO] Formula Programa - EDI - Não retorna nada

Discussão em 'EMS , HCM e Totvs 11' iniciado por rodolfo.rcs, Setembro 9, 2016.

Status do Tópico:
Não esta aberto para novas mensagens.
  1. rodolfo.rcs

    rodolfo.rcs Membro Participativo

    Alguém poderia ajudar a tirar uma dúvida. De acordo com a documentação do datasul, caso haja necessidade de pegar um valor que não esteja no mapa EDI deverá criar um programa para exercer tal função.

    Já tentei várias formas até agora nada. Alguém já fez algo parecido. Segue Fonte Teste.


    def temp-table tt_param_program_formul no-undo
    field tta_cdn_segment_edi as Integer format '>>>>>9' initial 0 label 'Segmento' column-label 'Segmento'
    field tta_cdn_element_edi as Integer format '>>>>>9' initial 0 label 'Elemento' column-label 'Elemento'
    field tta_des_label_utiliz_formul_edi as character format 'x (10)' label 'Label Utiliz Formula' column-label 'Label Utiliz Formula'
    field ttv_des_contdo as character format 'x(47)' label 'Conteudo' column-label 'Conteudo'
    index tt_param_program_formul_id is primary
    tta_cdn_segment_edi ascending
    tta_cdn_element_edi ascending.

    def Input param p_cdn_mapa_edi as INTEGER format '>>>>>9' no-undo.
    def Input param p_cdn_segment_edi as Integer format '>>>>>9' no-undo.
    def Input param p_cdn_element_edi as Integer format '>>>>>9' no-undo.

    def Input param TABLE for tt_param_program_formul.

    RETURN 'teste'.
  2. bootstrapmaster

    bootstrapmaster Moderator Moderador Equipe de Suporte

    Eu achei esse exemplo, dá uma estudada.

    Código:
    /**
    * PROGRAMA
    *   prgfin/edf/esedf001.p
    *
    * FINALIDADE
    *   Formula para controlar protesto na remessa de cobran‡a para o Bradesco
    *
    * VERSOES
    *   5.05.00.001, 25/07/2006, Alexandre Reis, Datasul Paranaense
    *     Criacao
    *
    *   5.05.00.002, 13/08/2007,GustavoFdS(DTPR)
    *     Altera‡Æo da logica para ser usada pelo banco HSBC
    **/
    def var c-versao-prg as char initial " 5.05.00.002":U no-undo.
    
    {include/i_dbinst.i}
    {include/i_dbtype.i}
    
    
    /******************************* Private-Data *******************************/
    assign this-procedure:private-data = "HLP=0":U.
    /*************************************  *************************************/
    
    /********************* Temporary Table Definition Begin *********************/
    
    def temp-table tt_param_program_formul no-undo
        field tta_cdn_segment_edi              as Integer format ">>>>>9" initial 0 label "Segmento" column-label "Segmento"
        field tta_cdn_element_edi              as Integer format ">>>>>9" initial 0 label "Elemento" column-label "Elemento"
        field tta_des_label_utiliz_formul_edi  as character format "x(10)" label "Label Utiliz Formula" column-label "Label Utiliz Formula"
        field ttv_des_contdo                   as character format "x(100)" label "Conteudo" column-label "Conteudo"
        index tt_param_program_formul_id       is primary
              tta_cdn_segment_edi              ascending
              tta_cdn_element_edi              ascending
        .
    
    
    
    /********************** Temporary Table Definition End **********************/
    
    /************************ Parameter Definition Begin ************************/
    
    def Input param p_cdn_mapa_edi
        as Integer
        format ">>>>>9"
        no-undo.
    def Input param p_cdn_segment_edi
        as Integer
        format ">>>>>9"
        no-undo.
    def Input param p_cdn_element_edi
        as Integer
        format ">>>>>9"
        no-undo.
    def Input param table
        for tt_param_program_formul.
    
    /************************* Parameter Definition End *************************/
    
    /************************* Variable Definition Begin ************************/
    
    def new global shared var v_cod_aplicat_dtsul_corren
        as character
        format "x(3)":U
        no-undo.
    def new global shared var v_cod_ccusto_corren
        as character
        format "x(11)":U
        label "Centro Custo"
        column-label "Centro Custo"
        no-undo.
    def new global shared var v_cod_dwb_user
        as character
        format "x(21)":U
        label "Usu rio"
        column-label "Usu rio"
        no-undo.
    def new global shared var v_cod_empres_usuar
        as character
        format "x(3)":U
        label "Empresa"
        column-label "Empresa"
        no-undo.
    def new global shared var v_cod_estab_usuar
        as character
        format "x(3)":U
        label "Estabelecimento"
        column-label "Estab"
        no-undo.
    def new global shared var v_cod_funcao_negoc_empres
        as character
        format "x(50)":U
        no-undo.
    def new global shared var v_cod_grp_usuar_lst
        as character
        format "x(3)":U
        label "Grupo Usu rios"
        column-label "Grupo"
        no-undo.
    def new global shared var v_cod_idiom_usuar
        as character
        format "x(8)":U
        label "Idioma"
        column-label "Idioma"
        no-undo.
    def new global shared var v_cod_modul_dtsul_corren
        as character
        format "x(3)":U
        label "M¢dulo Corrente"
        column-label "M¢dulo Corrente"
        no-undo.
    def new global shared var v_cod_modul_dtsul_empres
        as character
        format "x(100)":U
        no-undo.
    def new global shared var v_cod_pais_empres_usuar
        as character
        format "x(3)":U
        label "Pa¡s Empresa Usu rio"
        column-label "Pa¡s"
        no-undo.
    def new global shared var v_cod_plano_ccusto_corren
        as character
        format "x(8)":U
        label "Plano CCusto"
        column-label "Plano CCusto"
        no-undo.
    def new global shared var v_cod_unid_negoc_usuar
        as character
        format "x(3)":U
        view-as combo-box
        list-items ""
        inner-lines 5
        bgcolor 15 font 2
        label "Unidade Neg¢cio"
        column-label "Unid Neg¢cio"
        no-undo.
    def new global shared var v_cod_usuar_corren
        as character
        format "x(12)":U
        label "Usu rio Corrente"
        column-label "Usu rio Corrente"
        no-undo.
    def new global shared var v_cod_usuar_corren_criptog
        as character
        format "x(16)":U
        no-undo.
    def new global shared var v_num_ped_exec_corren
        as integer
        format ">>>>9":U
        no-undo.
    
    /************************** Variable Definition End *************************/
    
    
    /****************************** Main Code Begin *****************************/
    
    
    /* Begin_Include: i_version_extract */
    def new global shared var v_cod_arq
        as char 
        format 'x(60)'
        no-undo.
    def new global shared var v_cod_tip_prog
        as character
        format 'x(8)'
        no-undo.
    
    def stream s-arq.
    
    define variable cEstabel as char no-undo.
    
    if  v_cod_arq <> '' and v_cod_arq <> ?
    then do:
        run pi_version_extract ('esedf003', 'prgint/edf/esedf003.p', '5.05.00.002', 'pro').
    end /* if */.
    /* End_Include: i_version_extract */
    
    /* ****************************************************************************************
    **
    ** Para utilizacao deste programa sera necessario retirar o comentario da logica abaixo.
    **
    ******************************************************************************************/
    
    /* Verifica se o registro ‚ de remessa */
    /*
    find tt_param_program_formul
        where tt_param_program_formul.tta_des_label_utiliz_formul_edi
       begins "Instr_Ocor"
          and tt_param_program_formul.ttv_des_contdo begins "01" no-error.
    
    if not avail tt_param_program_formul then return '00'.
    */
    
    find first tt_param_program_formul
        where tt_param_program_formul.tta_des_label_utiliz_formul_edi
       begins "Cd_Tit_Emp" no-error.
    
    if not avail tt_param_program_formul then return '00'.
    
    assign cEstabel = entry(1,tt_param_program_formul.ttv_des_contdo,";").
    
    for first movto_tit_acr no-lock
        where movto_tit_acr.cod_estab = cEstabel
          and movto_tit_acr.num_id_movto_tit_acr
            = int(entry(2,tt_param_program_formul.ttv_des_contdo,";")),
        first esp_param_coml no-lock
        where esp_param_coml.cod_estabel = cEstabel,
        first tit_acr no-lock
            of movto_tit_acr:
           
    
        /* CD3 */
        if tit_acr.cod_ser_docto = esp_param_coml.serie_docto then
            return "00".
    
        /* CD1 */
        case p_cdn_element_edi:
            when 2390 then /* Instrucao 1 */
                return "77".
           
            when 2391 then /* Instrucao 2 */
                return "05".
           
        end.
    end.
    
    return '00'.
    
    
    /******************************* Main Code End ******************************/
    
    /************************* Internal Procedure Begin *************************/
    
    /*****************************************************************************
    ** Procedure Interna.....: pi_version_extract
    ** Descricao.............: pi_version_extract
    ** Criado por............: jaison
    ** Criado em.............: 31/07/1998 09:33:22
    ** Alterado por..........: bre19127
    ** Alterado em...........: 16/09/2002 08:55:44
    *****************************************************************************/
    PROCEDURE pi_version_extract:
    
        /************************ Parameter Definition Begin ************************/
    
        def Input param p_cod_program
            as character
            format "x(08)"
            no-undo.
        def Input param p_cod_program_ext
            as character
            format "x(8)"
            no-undo.
        def Input param p_cod_version
            as character
            format "x(8)"
            no-undo.
        def Input param p_cod_program_type
            as character
            format "x(8)"
            no-undo.
    
    
        /************************* Parameter Definition End *************************/
    
        if  can-do(v_cod_tip_prog, p_cod_program_type)
        then do:
            if p_cod_program_type = 'dic' then
               assign p_cod_program_ext = replace(p_cod_program_ext, 'database/', '').
    
            output stream s-arq to value(v_cod_arq) append.
    
            put stream s-arq unformatted
                p_cod_program            at 1
                p_cod_program_ext        at 43
                p_cod_version            at 69
                today                    at 84
                string(time, 'HH:MM:SS') at 94 skip.
    
            if  p_cod_program_type = 'pro' then do:
                &if '{&emsbas_version}' > '1.00' &then
                find emsbas.prog_dtsul
                    where emsbas.prog_dtsul.cod_prog_dtsul = p_cod_program
                    no-lock no-error.
                if  avail emsbas.prog_dtsul
                then do:
                    &if '{&emsbas_version}' > '5.00' &then
                        if  emsbas.prog_dtsul.nom_prog_dpc <> '' then
                            put stream s-arq 'DPC : ' at 5 emsbas.prog_dtsul.nom_prog_dpc  at 15 skip.
                    &endif
                    if  emsbas.prog_dtsul.nom_prog_appc <> '' then
                        put stream s-arq 'APPC: ' at 5 emsbas.prog_dtsul.nom_prog_appc at 15 skip.
                    if  emsbas.prog_dtsul.nom_prog_upc <> '' then
                        put stream s-arq 'UPC : ' at 5 emsbas.prog_dtsul.nom_prog_upc  at 15 skip.
                end /* if */.
                &endif
            end.
    
            if  p_cod_program_type = 'dic' then do:
                &if '{&emsbas_version}' > '1.00' &then
                find emsbas.tab_dic_dtsul
                    where emsbas.tab_dic_dtsul.cod_tab_dic_dtsul = p_cod_program
                    no-lock no-error.
                if  avail emsbas.tab_dic_dtsul
                then do:
                    &if '{&emsbas_version}' > '5.00' &then
                        if  emsbas.tab_dic_dtsul.nom_prog_dpc_gat_delete <> '' then
                            put stream s-arq 'DPC-DELETE : ' at 5 emsbas.tab_dic_dtsul.nom_prog_dpc_gat_delete  at 25 skip.
                    &endif
                    if  emsbas.tab_dic_dtsul.nom_prog_appc_gat_delete <> '' then
                        put stream s-arq 'APPC-DELETE: ' at 5 emsbas.tab_dic_dtsul.nom_prog_appc_gat_delete at 25 skip.
                    if  emsbas.tab_dic_dtsul.nom_prog_upc_gat_delete <> '' then
                        put stream s-arq 'UPC-DELETE : ' at 5 emsbas.tab_dic_dtsul.nom_prog_upc_gat_delete  at 25 skip.
                    &if '{&emsbas_version}' > '5.00' &then
                        if  emsbas.tab_dic_dtsul.nom_prog_dpc_gat_write <> '' then
                            put stream s-arq 'DPC-WRITE : ' at 5 emsbas.tab_dic_dtsul.nom_prog_dpc_gat_write  at 25 skip.
                    &endif
                    if  emsbas.tab_dic_dtsul.nom_prog_appc_gat_write <> '' then
                        put stream s-arq 'APPC-WRITE: ' at 5 emsbas.tab_dic_dtsul.nom_prog_appc_gat_write at 25 skip.
                    if  emsbas.tab_dic_dtsul.nom_prog_upc_gat_write <> '' then
                        put stream s-arq 'UPC-WRITE : ' at 5 emsbas.tab_dic_dtsul.nom_prog_upc_gat_write  at 25 skip.
                end /* if */.
                &endif
            end.
    
            output stream s-arq close.
        end /* if */.
    
    END PROCEDURE. /* pi_version_extract */
    
    
    /************************** Internal Procedure End **************************/
    
    /************************* External Procedure Begin *************************/
    
    
    
    /************************** External Procedure End **************************/
    
    /*************************************  *************************************/
    /*****************************************************************************
    **  Procedure Interna: pi_messages
    **  Descricao........: Mostra Mensagem com Ajuda
    *****************************************************************************/
    PROCEDURE pi_messages:
    
        def input param c_action    as char    no-undo.
        def input param i_msg       as integer no-undo.
        def input param c_param     as char    no-undo.
    
        def var c_prg_msg           as char    no-undo.
    
        assign c_prg_msg = "messages/":U
                         + string(trunc(i_msg / 1000,0),"99":U)
                         + "/msg":U
                         + string(i_msg, "99999":U).
    
        if search(c_prg_msg + ".r":U) = ? and search(c_prg_msg + ".p":U) = ? then do:
            message "Mensagem nr. " i_msg "!!!":U skip
                    "Programa Mensagem" c_prg_msg "nÆo encontrado."
                    view-as alert-box error.
            return error.
        end.
    
        run value(c_prg_msg + ".p":U) (input c_action, input c_param).
        return return-value.
    END PROCEDURE.  /* pi_messages */
    /*************************  End of fnc_prg_formul_02 ************************/
    
  3. rodolfo.rcs

    rodolfo.rcs Membro Participativo

    Richard, ajustei para apenas retornar o valor no arquivo mas mesmo assim continua sem trazer valor.:(
    Cadastro da fórmula e programa.
    upload_2016-9-9_16-18-53.png
    /**
    * PROGRAMA
    * prgfin/edf/esedf001.p
    *
    * FINALIDADE
    * Formula para controlar protesto na remessa de cobran‡a para o Bradesco
    *
    * VERSOES
    * 5.05.00.001, 25/07/2006, Alexandre Reis, Datasul Paranaense
    * Criacao
    *
    * 5.05.00.002, 13/08/2007,GustavoFdS(DTPR)
    * Altera‡Æo da logica para ser usada pelo banco HSBC
    **/
    def var c-versao-prg as char initial " 5.05.00.002":U no-undo.

    {include/i_dbinst.i}
    {include/i_dbtype.i}


    /******************************* Private-Data *******************************/
    assign this-procedure:private-data = "HLP=0":U.
    /************************************* *************************************/

    /********************* Temporary Table Definition Begin *********************/

    def temp-table tt_param_program_formul no-undo
    field tta_cdn_segment_edi as Integer format ">>>>>9" initial 0 label "Segmento" column-label "Segmento"
    field tta_cdn_element_edi as Integer format ">>>>>9" initial 0 label "Elemento" column-label "Elemento"
    field tta_des_label_utiliz_formul_edi as character format "x(10)" label "Label Utiliz Formula" column-label "Label Utiliz Formula"
    field ttv_des_contdo as character format "x(100)" label "Conteudo" column-label "Conteudo"
    index tt_param_program_formul_id is primary
    tta_cdn_segment_edi ascending
    tta_cdn_element_edi ascending
    .



    /********************** Temporary Table Definition End **********************/

    /************************ Parameter Definition Begin ************************/

    def Input param p_cdn_mapa_edi
    as Integer
    format ">>>>>9"
    no-undo.
    def Input param p_cdn_segment_edi
    as Integer
    format ">>>>>9"
    no-undo.
    def Input param p_cdn_element_edi
    as Integer
    format ">>>>>9"
    no-undo.
    def Input param table
    for tt_param_program_formul.

    /************************* Parameter Definition End *************************/

    /************************* Variable Definition Begin ************************/

    def new global shared var v_cod_aplicat_dtsul_corren
    as character
    format "x(3)":U
    no-undo.
    def new global shared var v_cod_ccusto_corren
    as character
    format "x(11)":U
    label "Centro Custo"
    column-label "Centro Custo"
    no-undo.
    def new global shared var v_cod_dwb_user
    as character
    format "x(21)":U
    label "Usu rio"
    column-label "Usu rio"
    no-undo.
    def new global shared var v_cod_empres_usuar
    as character
    format "x(3)":U
    label "Empresa"
    column-label "Empresa"
    no-undo.
    def new global shared var v_cod_estab_usuar
    as character
    format "x(3)":U
    label "Estabelecimento"
    column-label "Estab"
    no-undo.
    def new global shared var v_cod_funcao_negoc_empres
    as character
    format "x(50)":U
    no-undo.
    def new global shared var v_cod_grp_usuar_lst
    as character
    format "x(3)":U
    label "Grupo Usu rios"
    column-label "Grupo"
    no-undo.
    def new global shared var v_cod_idiom_usuar
    as character
    format "x(8)":U
    label "Idioma"
    column-label "Idioma"
    no-undo.
    def new global shared var v_cod_modul_dtsul_corren
    as character
    format "x(3)":U
    label "M¢dulo Corrente"
    column-label "M¢dulo Corrente"
    no-undo.
    def new global shared var v_cod_modul_dtsul_empres
    as character
    format "x(100)":U
    no-undo.
    def new global shared var v_cod_pais_empres_usuar
    as character
    format "x(3)":U
    label "Pa¡s Empresa Usu rio"
    column-label "Pa¡s"
    no-undo.
    def new global shared var v_cod_plano_ccusto_corren
    as character
    format "x(8)":U
    label "Plano CCusto"
    column-label "Plano CCusto"
    no-undo.
    def new global shared var v_cod_unid_negoc_usuar
    as character
    format "x(3)":U
    view-as combo-box
    list-items ""
    inner-lines 5
    bgcolor 15 font 2
    label "Unidade Neg¢cio"
    column-label "Unid Neg¢cio"
    no-undo.
    def new global shared var v_cod_usuar_corren
    as character
    format "x(12)":U
    label "Usu rio Corrente"
    column-label "Usu rio Corrente"
    no-undo.
    def new global shared var v_cod_usuar_corren_criptog
    as character
    format "x(16)":U
    no-undo.
    def new global shared var v_num_ped_exec_corren
    as integer
    format ">>>>9":U
    no-undo.

    /************************** Variable Definition End *************************/


    /****************************** Main Code Begin *****************************/


    /* Begin_Include: i_version_extract */
    def new global shared var v_cod_arq
    as char
    format 'x(60)'
    no-undo.
    def new global shared var v_cod_tip_prog
    as character
    format 'x(8)'
    no-undo.

    def stream s-arq.

    define variable cEstabel as char no-undo.

    if v_cod_arq <> '' and v_cod_arq <> ?
    then do:
    run pi_version_extract ('esedf003', 'prgint/edf/esedf003.p', '5.05.00.002', 'pro').
    end /* if */.
    /* End_Include: i_version_extract */

    /* ****************************************************************************************
    **
    ** Para utilizacao deste programa sera necessario retirar o comentario da logica abaixo.
    **
    ******************************************************************************************/

    /* Verifica se o registro ‚ de remessa */
    /*
    find tt_param_program_formul
    where tt_param_program_formul.tta_des_label_utiliz_formul_edi
    begins "Instr_Ocor"
    and tt_param_program_formul.ttv_des_contdo begins "01" no-error.

    if not avail tt_param_program_formul then return '00'.
    */

    find first tt_param_program_formul
    where tt_param_program_formul.tta_des_label_utiliz_formul_edi
    begins "Cd_Tit_Emp" no-error.

    if not avail tt_param_program_formul then return '00'.

    assign cEstabel = entry(1,tt_param_program_formul.ttv_des_contdo,";").
    /*
    for first movto_tit_acr no-lock
    where movto_tit_acr.cod_estab = cEstabel
    and movto_tit_acr.num_id_movto_tit_acr
    = int(entry(2,tt_param_program_formul.ttv_des_contdo,";")),
    first esp_param_coml no-lock
    where esp_param_coml.cod_estabel = cEstabel,
    first tit_acr no-lock
    of movto_tit_acr:


    /* CD3 */
    if tit_acr.cod_ser_docto = esp_param_coml.serie_docto then
    return "00".

    /* CD1 */
    case p_cdn_element_edi:
    when 2390 then /* Instrucao 1 */
    return "77".

    when 2391 then /* Instrucao 2 */
    return "05".

    end.
    end.
    */
    return '00'.


    /******************************* Main Code End ******************************/

    /************************* Internal Procedure Begin *************************/

    /*****************************************************************************
    ** Procedure Interna.....: pi_version_extract
    ** Descricao.............: pi_version_extract
    ** Criado por............: jaison
    ** Criado em.............: 31/07/1998 09:33:22
    ** Alterado por..........: bre19127
    ** Alterado em...........: 16/09/2002 08:55:44
    *****************************************************************************/
    PROCEDURE pi_version_extract:

    /************************ Parameter Definition Begin ************************/

    def Input param p_cod_program
    as character
    format "x(08)"
    no-undo.
    def Input param p_cod_program_ext
    as character
    format "x(8)"
    no-undo.
    def Input param p_cod_version
    as character
    format "x(8)"
    no-undo.
    def Input param p_cod_program_type
    as character
    format "x(8)"
    no-undo.


    /************************* Parameter Definition End *************************/

    if can-do(v_cod_tip_prog, p_cod_program_type)
    then do:
    if p_cod_program_type = 'dic' then
    assign p_cod_program_ext = replace(p_cod_program_ext, 'database/', '').

    output stream s-arq to value(v_cod_arq) append.

    put stream s-arq unformatted
    p_cod_program at 1
    p_cod_program_ext at 43
    p_cod_version at 69
    today at 84
    string(time, 'HH:MM:SS') at 94 skip.

    if p_cod_program_type = 'pro' then do:
    &if '{&emsbas_version}' > '1.00' &then
    find emsbas.prog_dtsul
    where emsbas.prog_dtsul.cod_prog_dtsul = p_cod_program
    no-lock no-error.
    if avail emsbas.prog_dtsul
    then do:
    &if '{&emsbas_version}' > '5.00' &then
    if emsbas.prog_dtsul.nom_prog_dpc <> '' then
    put stream s-arq 'DPC : ' at 5 emsbas.prog_dtsul.nom_prog_dpc at 15 skip.
    &endif
    if emsbas.prog_dtsul.nom_prog_appc <> '' then
    put stream s-arq 'APPC: ' at 5 emsbas.prog_dtsul.nom_prog_appc at 15 skip.
    if emsbas.prog_dtsul.nom_prog_upc <> '' then
    put stream s-arq 'UPC : ' at 5 emsbas.prog_dtsul.nom_prog_upc at 15 skip.
    end /* if */.
    &endif
    end.

    if p_cod_program_type = 'dic' then do:
    &if '{&emsbas_version}' > '1.00' &then
    find emsbas.tab_dic_dtsul
    where emsbas.tab_dic_dtsul.cod_tab_dic_dtsul = p_cod_program
    no-lock no-error.
    if avail emsbas.tab_dic_dtsul
    then do:
    &if '{&emsbas_version}' > '5.00' &then
    if emsbas.tab_dic_dtsul.nom_prog_dpc_gat_delete <> '' then
    put stream s-arq 'DPC-DELETE : ' at 5 emsbas.tab_dic_dtsul.nom_prog_dpc_gat_delete at 25 skip.
    &endif
    if emsbas.tab_dic_dtsul.nom_prog_appc_gat_delete <> '' then
    put stream s-arq 'APPC-DELETE: ' at 5 emsbas.tab_dic_dtsul.nom_prog_appc_gat_delete at 25 skip.
    if emsbas.tab_dic_dtsul.nom_prog_upc_gat_delete <> '' then
    put stream s-arq 'UPC-DELETE : ' at 5 emsbas.tab_dic_dtsul.nom_prog_upc_gat_delete at 25 skip.
    &if '{&emsbas_version}' > '5.00' &then
    if emsbas.tab_dic_dtsul.nom_prog_dpc_gat_write <> '' then
    put stream s-arq 'DPC-WRITE : ' at 5 emsbas.tab_dic_dtsul.nom_prog_dpc_gat_write at 25 skip.
    &endif
    if emsbas.tab_dic_dtsul.nom_prog_appc_gat_write <> '' then
    put stream s-arq 'APPC-WRITE: ' at 5 emsbas.tab_dic_dtsul.nom_prog_appc_gat_write at 25 skip.
    if emsbas.tab_dic_dtsul.nom_prog_upc_gat_write <> '' then
    put stream s-arq 'UPC-WRITE : ' at 5 emsbas.tab_dic_dtsul.nom_prog_upc_gat_write at 25 skip.
    end /* if */.
    &endif
    end.

    output stream s-arq close.
    end /* if */.

    END PROCEDURE. /* pi_version_extract */


    /************************** Internal Procedure End **************************/

    /************************* External Procedure Begin *************************/



    /************************** External Procedure End **************************/

    /************************************* *************************************/
    /*****************************************************************************
    ** Procedure Interna: pi_messages
    ** Descricao........: Mostra Mensagem com Ajuda
    *****************************************************************************/
    PROCEDURE pi_messages:

    def input param c_action as char no-undo.
    def input param i_msg as integer no-undo.
    def input param c_param as char no-undo.

    def var c_prg_msg as char no-undo.

    assign c_prg_msg = "messages/":U
    + string(trunc(i_msg / 1000,0),"99":U)
    + "/msg":U
    + string(i_msg, "99999":U).

    if search(c_prg_msg + ".r":U) = ? and search(c_prg_msg + ".p":U) = ? then do:
    message "Mensagem nr. " i_msg "!!!":U skip
    "Programa Mensagem" c_prg_msg "nÆo encontrado."
    view-as alert-box error.
    return error.
    end.

    run value(c_prg_msg + ".p":U) (input c_action, input c_param).
    return return-value.
    END PROCEDURE. /* pi_messages */
    /************************* End of fnc_prg_formul_02 ************************/
  4. rodolfo.rcs

    rodolfo.rcs Membro Participativo

    Vlw Richar, mas continua não trazendo nada segue cadastro programa EDI e fonte alterado.
    [​IMG]
    Código:
    /**
    * PROGRAMA
    *   prgfin/edf/esedf001.p
    *
    * FINALIDADE
    *   Formula para controlar protesto na remessa de cobran»a para o Bradesco
    *
    * VERSOES
    *   5.05.00.001, 25/07/2006, Alexandre Reis, Datasul Paranaense
    *     Criacao
    *
    *   5.05.00.002, 13/08/2007,GustavoFdS(DTPR)
    *     Altera»’o da logica para ser usada pelo banco HSBC
    **/
    def var c-versao-prg as char initial " 5.05.00.002":U no-undo.
    
    {include/i_dbinst.i}
    {include/i_dbtype.i}
    
    
    /******************************* Private-Data *******************************/
    assign this-procedure:private-data = "HLP=0":U.
    /*************************************  *************************************/
    
    /********************* Temporary Table Definition Begin *********************/
    
    def temp-table tt_param_program_formul no-undo
        field tta_cdn_segment_edi              as Integer format ">>>>>9" initial 0 label "Segmento" column-label "Segmento"
        field tta_cdn_element_edi              as Integer format ">>>>>9" initial 0 label "Elemento" column-label "Elemento"
        field tta_des_label_utiliz_formul_edi  as character format "x(10)" label "Label Utiliz Formula" column-label "Label Utiliz Formula"
        field ttv_des_contdo                   as character format "x(100)" label "Conteudo" column-label "Conteudo"
        index tt_param_program_formul_id       is primary
              tta_cdn_segment_edi              ascending
              tta_cdn_element_edi              ascending
        .
    
    
    
    /********************** Temporary Table Definition End **********************/
    
    /************************ Parameter Definition Begin ************************/
    
    def Input param p_cdn_mapa_edi
        as Integer
        format ">>>>>9"
        no-undo.
    def Input param p_cdn_segment_edi
        as Integer
        format ">>>>>9"
        no-undo.
    def Input param p_cdn_element_edi
        as Integer
        format ">>>>>9"
        no-undo.
    def Input param table
        for tt_param_program_formul.
    
    /************************* Parameter Definition End *************************/
    
    /************************* Variable Definition Begin ************************/
    
    def new global shared var v_cod_aplicat_dtsul_corren
        as character
        format "x(3)":U
        no-undo.
    def new global shared var v_cod_ccusto_corren
        as character
        format "x(11)":U
        label "Centro Custo"
        column-label "Centro Custo"
        no-undo.
    def new global shared var v_cod_dwb_user
        as character
        format "x(21)":U
        label "Usu rio"
        column-label "Usu rio"
        no-undo.
    def new global shared var v_cod_empres_usuar
        as character
        format "x(3)":U
        label "Empresa"
        column-label "Empresa"
        no-undo.
    def new global shared var v_cod_estab_usuar
        as character
        format "x(3)":U
        label "Estabelecimento"
        column-label "Estab"
        no-undo.
    def new global shared var v_cod_funcao_negoc_empres
        as character
        format "x(50)":U
        no-undo.
    def new global shared var v_cod_grp_usuar_lst
        as character
        format "x(3)":U
        label "Grupo Usu rios"
        column-label "Grupo"
        no-undo.
    def new global shared var v_cod_idiom_usuar
        as character
        format "x(8)":U
        label "Idioma"
        column-label "Idioma"
        no-undo.
    def new global shared var v_cod_modul_dtsul_corren
        as character
        format "x(3)":U
        label "M½dulo Corrente"
        column-label "M½dulo Corrente"
        no-undo.
    def new global shared var v_cod_modul_dtsul_empres
        as character
        format "x(100)":U
        no-undo.
    def new global shared var v_cod_pais_empres_usuar
        as character
        format "x(3)":U
        label "Pas Empresa Usu rio"
        column-label "Pas"
        no-undo.
    def new global shared var v_cod_plano_ccusto_corren
        as character
        format "x(8)":U
        label "Plano CCusto"
        column-label "Plano CCusto"
        no-undo.
    def new global shared var v_cod_unid_negoc_usuar
        as character
        format "x(3)":U
        view-as combo-box
        list-items ""
        inner-lines 5
        bgcolor 15 font 2
        label "Unidade Neg½cio"
        column-label "Unid Neg½cio"
        no-undo.
    def new global shared var v_cod_usuar_corren
        as character
        format "x(12)":U
        label "Usu rio Corrente"
        column-label "Usu rio Corrente"
        no-undo.
    def new global shared var v_cod_usuar_corren_criptog
        as character
        format "x(16)":U
        no-undo.
    def new global shared var v_num_ped_exec_corren
        as integer
        format ">>>>9":U
        no-undo.
    
    /************************** Variable Definition End *************************/
    
    
    /****************************** Main Code Begin *****************************/
    
    
    /* Begin_Include: i_version_extract */
    def new global shared var v_cod_arq
        as char
        format 'x(60)'
        no-undo.
    def new global shared var v_cod_tip_prog
        as character
        format 'x(8)'
        no-undo.
    
    def stream s-arq.
    
    define variable cEstabel as char no-undo.
    
    if  v_cod_arq <> '' and v_cod_arq <> ?
    then do:
        run pi_version_extract ('esedf003', 'prgint/edf/esedf003.p', '5.05.00.002', 'pro').
    end /* if */.
    /* End_Include: i_version_extract */
    
    /* ****************************************************************************************
    **
    ** Para utilizacao deste programa sera necessario retirar o comentario da logica abaixo.
    **
    ******************************************************************************************/
    
    /* Verifica se o registro ² de remessa */
    /*
    find tt_param_program_formul
        where tt_param_program_formul.tta_des_label_utiliz_formul_edi
       begins "Instr_Ocor"
          and tt_param_program_formul.ttv_des_contdo begins "01" no-error.
    
    if not avail tt_param_program_formul then return '00'.
    */
    
    find first tt_param_program_formul
         where tt_param_program_formul.tta_des_label_utiliz_formul_edi
         begins "Cd_Tit_Emp" no-error.
    
    if not avail tt_param_program_formul then return '00'.
    
    assign cEstabel = entry(1,tt_param_program_formul.ttv_des_contdo,";").
    /*
    for first movto_tit_acr no-lock
        where movto_tit_acr.cod_estab = cEstabel
          and movto_tit_acr.num_id_movto_tit_acr
            = int(entry(2,tt_param_program_formul.ttv_des_contdo,";")),
        first esp_param_coml no-lock
        where esp_param_coml.cod_estabel = cEstabel,
        first tit_acr no-lock
            of movto_tit_acr:
         
    
        /* CD3 */
        if tit_acr.cod_ser_docto = esp_param_coml.serie_docto then
            return "00".
    
        /* CD1 */
        case p_cdn_element_edi:
            when 2390 then /* Instrucao 1 */
                return "77".
         
            when 2391 then /* Instrucao 2 */
                return "05".
         
        end.
    end.
    */
    return '00'.
    
    
    /******************************* Main Code End ******************************/
    
    /************************* Internal Procedure Begin *************************/
    
    /*****************************************************************************
    ** Procedure Interna.....: pi_version_extract
    ** Descricao.............: pi_version_extract
    ** Criado por............: jaison
    ** Criado em.............: 31/07/1998 09:33:22
    ** Alterado por..........: bre19127
    ** Alterado em...........: 16/09/2002 08:55:44
    *****************************************************************************/
    PROCEDURE pi_version_extract:
    
        /************************ Parameter Definition Begin ************************/
    
        def Input param p_cod_program
            as character
            format "x(08)"
            no-undo.
        def Input param p_cod_program_ext
            as character
            format "x(8)"
            no-undo.
        def Input param p_cod_version
            as character
            format "x(8)"
            no-undo.
        def Input param p_cod_program_type
            as character
            format "x(8)"
            no-undo.
    
    
        /************************* Parameter Definition End *************************/
    
        if  can-do(v_cod_tip_prog, p_cod_program_type)
        then do:
            if p_cod_program_type = 'dic' then
               assign p_cod_program_ext = replace(p_cod_program_ext, 'database/', '').
    
            output stream s-arq to value(v_cod_arq) append.
    
            put stream s-arq unformatted
                p_cod_program            at 1
                p_cod_program_ext        at 43
                p_cod_version            at 69
                today                    at 84
                string(time, 'HH:MM:SS') at 94 skip.
    
            if  p_cod_program_type = 'pro' then do:
                &if '{&emsbas_version}' > '1.00' &then
                find emsbas.prog_dtsul
                    where emsbas.prog_dtsul.cod_prog_dtsul = p_cod_program
                    no-lock no-error.
                if  avail emsbas.prog_dtsul
                then do:
                    &if '{&emsbas_version}' > '5.00' &then
                        if  emsbas.prog_dtsul.nom_prog_dpc <> '' then
                            put stream s-arq 'DPC : ' at 5 emsbas.prog_dtsul.nom_prog_dpc  at 15 skip.
                    &endif
                    if  emsbas.prog_dtsul.nom_prog_appc <> '' then
                        put stream s-arq 'APPC: ' at 5 emsbas.prog_dtsul.nom_prog_appc at 15 skip.
                    if  emsbas.prog_dtsul.nom_prog_upc <> '' then
                        put stream s-arq 'UPC : ' at 5 emsbas.prog_dtsul.nom_prog_upc  at 15 skip.
                end /* if */.
                &endif
            end.
    
            if  p_cod_program_type = 'dic' then do:
                &if '{&emsbas_version}' > '1.00' &then
                find emsbas.tab_dic_dtsul
                    where emsbas.tab_dic_dtsul.cod_tab_dic_dtsul = p_cod_program
                    no-lock no-error.
                if  avail emsbas.tab_dic_dtsul
                then do:
                    &if '{&emsbas_version}' > '5.00' &then
                        if  emsbas.tab_dic_dtsul.nom_prog_dpc_gat_delete <> '' then
                            put stream s-arq 'DPC-DELETE : ' at 5 emsbas.tab_dic_dtsul.nom_prog_dpc_gat_delete  at 25 skip.
                    &endif
                    if  emsbas.tab_dic_dtsul.nom_prog_appc_gat_delete <> '' then
                        put stream s-arq 'APPC-DELETE: ' at 5 emsbas.tab_dic_dtsul.nom_prog_appc_gat_delete at 25 skip.
                    if  emsbas.tab_dic_dtsul.nom_prog_upc_gat_delete <> '' then
                        put stream s-arq 'UPC-DELETE : ' at 5 emsbas.tab_dic_dtsul.nom_prog_upc_gat_delete  at 25 skip.
                    &if '{&emsbas_version}' > '5.00' &then
                        if  emsbas.tab_dic_dtsul.nom_prog_dpc_gat_write <> '' then
                            put stream s-arq 'DPC-WRITE : ' at 5 emsbas.tab_dic_dtsul.nom_prog_dpc_gat_write  at 25 skip.
                    &endif
                    if  emsbas.tab_dic_dtsul.nom_prog_appc_gat_write <> '' then
                        put stream s-arq 'APPC-WRITE: ' at 5 emsbas.tab_dic_dtsul.nom_prog_appc_gat_write at 25 skip.
                    if  emsbas.tab_dic_dtsul.nom_prog_upc_gat_write <> '' then
                        put stream s-arq 'UPC-WRITE : ' at 5 emsbas.tab_dic_dtsul.nom_prog_upc_gat_write  at 25 skip.
                end /* if */.
                &endif
            end.
    
            output stream s-arq close.
        end /* if */.
    
    END PROCEDURE. /* pi_version_extract */
    
    
    /************************** Internal Procedure End **************************/
    
    /************************* External Procedure Begin *************************/
    
    
    
    /************************** External Procedure End **************************/
    
    /*************************************  *************************************/
    /*****************************************************************************
    **  Procedure Interna: pi_messages
    **  Descricao........: Mostra Mensagem com Ajuda
    *****************************************************************************/
    PROCEDURE pi_messages:
    
        def input param c_action    as char    no-undo.
        def input param i_msg       as integer no-undo.
        def input param c_param     as char    no-undo.
    
        def var c_prg_msg           as char    no-undo.
    
        assign c_prg_msg = "messages/":U
                         + string(trunc(i_msg / 1000,0),"99":U)
                         + "/msg":U
                         + string(i_msg, "99999":U).
    
        if search(c_prg_msg + ".r":U) = ? and search(c_prg_msg + ".p":U) = ? then do:
            message "Mensagem nr. " i_msg "!!!":U skip
                    "Programa Mensagem" c_prg_msg "n’o encontrado."
                    view-as alert-box error.
            return error.
        end.
    
        run value(c_prg_msg + ".p":U) (input c_action, input c_param).
        return return-value.
    END PROCEDURE.  /* pi_messages */
    /*************************  End of fnc_prg_formul_02 ************************/
    
  5. bootstrapmaster

    bootstrapmaster Moderator Moderador Equipe de Suporte

    Pois é meu caro, faz tempo que não mexo com isso, peguei dos fontes que eu tinha dos clientes que eu atendia na epoca que eu era consultor datasul, não lembro como era no mapa pra cadastrar.
  6. rodolfo.rcs

    rodolfo.rcs Membro Participativo

    Vlw cara, vou continuar tentando aqui ^^ :)
Status do Tópico:
Não esta aberto para novas mensagens.

Compartilhe esta Página