Error creating a New Employee @PRIMAVERA

-2

I'm doing an import of new employees and when doing,   BSO.RecursosHumanos.Funcionarios.Actualiza(Func) , I get the following error:

RunningtheProfilerInoticedaprobleminthequerytoexecute:

TheLigadoTimesheetscolumngetsanextraspacewhichmakesitimpossiblefortheemployeetobecreatedbytheengines.

Ihavealreadyupdatedmyversionandtrieditinotherversions.

Ifthisisthecaseforanemployeeupgraderatherthancreatinganewoneitworks.

Followthequeryintext:

INSERTINTOFuncionarios(Codigo,Nome,Localidade,CodPostal1,CodPostal2,Naturalidade,Distrito,Nacionalidade,Telefone,Extensao,EstadoCivil,Sexo,DataNascimento,DataAdmissao,DataFimContrato,Categoria,CategoriaEscalao,Profissao,Qualificacao,DataQualif,Habilitacao,TipoContrato,MotivoSaida,DataDemissao,DataPromocao,MotivoPromocao,HorasSemana,CodEstabelecimento,CodBanco,Situacao,SituacaoQP,NumBI,LocalEmBi,DataEmBi,CartaConducao,Vencimento,DataUltAumento,MotivoAumento,Notas,NumContr,ContribuinteNaoResidente,CodRepFinancas,DomicilioFiscal,CodIRS,TotalDependentes,TotalDepDeficientes,ConjugeDef,IRSFixo,NomeConjuge,CodSegSocial,NumBeneficiario,CodSindicato,NumSindicato,CodSeguro,TipoProcessamento,MesSubsFerias,DataValidadeCarta,DataValidadeBI,TurnosTaxa,TurnosDia,SubsAlim1,SubsAlim2,ValorSubsAlim,ValorSubsEsp,DiasSubsNatal,DiasSubsFerias,HoraEntradaM,HoraSaidaM,HoraEntradaT,HoraSaidaT,Foto,DataInspMedica,DescricaoInspMedica,CodBancoEmpr,Morada,Email,Periodo,CodDepartamento,Instrumento,VencimentoMensal,DiuturnidadeMensal,Diuturnidades,NumHorasSemInstrumentos,PertenceOrgaosSoc,Isento,DataProximaDiuturnidade,SituacaoFaceLei2098,Telemovel,LimiteContribuicoesSegSocial,CGA,NumCGA,NomeCGA,RegTmpPercAcresCGA,NumDiuturnidadesCGA,NivelRemCGA,RegTmpSituacaoCGA,RegTmpNumHorasCGA,TipoPessoal,DataAvisoPrevio,PeriodoExp,Contrato,CodSituacaoQP,NomeAbreviado,Altura,GrupoSanguineo,OutrasDadosFisicos,DoencasHereditarias,DeficienciasCronicas,DeficienciasFisicas,Cirurgias,NomeDistrito,NomeConcelho,Concelho,Freguesia,NomeFreguesia,CargoPrincipal,RegimeTrab,DataIniProfissao,DataHabilitacao,Pais,IDGDOC,Moeda,TipoMoeda,VencimentoLiquidoEstimado,VencimentoDiario,TipoCalculoVencimento,NumPassaporte,LocalEmPassaporte,DataEmPassaporte,DataValidadePassaporte,NumIE,LocalEmIE,DataEmIE,DataValidadeIE,TipoRendimento,CartaoResidente,LocalEmCR,DataEmissaoCR,DataValidadeCR,CustoPadrao,UtilizadoCCOP,RecursoCCOP,PercVencParaSubsFerias,PercVencParaSubsNatal,MotivoAdmissao,PercIncapacidade,PrimeiroNome,PrimeiroApelido,SegundoApelido,MesSubsNatal,FormaPagSN,FormaPagSF,ProcDiasAnterioresSN,ProcDiasAnterioresSF,LigadoTimesheets,AplicabilidadeIRCT,CodAlimDiasProc,CodAlimValorFixo,CodAlimEspecie,TabIRPS,ModContratoCom,DataComunicacao,UtilizadorComunicacao)VALUES('2914','MariaCidáliaBritoMarques','SãoJoãodaTalha','2695-670','SãoJoãodaTalha',NULL,'Lisboa','PT',NULL,NULL,'4','1','9/23/1970','10/22/2014',NULL,'0.003',NULL,NULL,'EnsinoSecundário(12ºanoouequivalente)',NULL,'315','1',NULL,NULL,NULL,NULL,40,'001',NULL,'001',NULL,'9655718',NULL,NULL,NULL,590,NULL,'000',NULL,'204635012',NULL,NULL,'0','1',1,0,0,0,NULL,'001','11333074629',NULL,NULL,NULL,2,6,NULL,NULL,0,NULL,1,0,5.3,0,0,0,0,0,0,0,NULL,NULL,NULL,NULL,'RuaAndradeCorvo,18,1º',NULL,'P01',NULL,'001',590,0,0,1,0,0,NULL,NULL,'965110329',0,NULL,NULL,NULL,0,0,NULL,NULL,0,'001',NULL,0,'001',3,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Loures',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Portugal',NULL,'EUR',0,0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'A',NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,11,'001','001',0,0,0,'2','R11',NULL,NULL,NULL,NULL,NULL,NULL)

TheversionofSQLManagementStudiois17,andPRIMAVERAisrealease1509.1007.Asforexception,thereisnocontentinthemessage.

Icontinuedsearchingandmadeanew,simplerfunctiontocreateanEmployeethistimedirectlyintheeditorVBAofSPRING:

PublicSubTesteCriaNovoFunc()DimnewfuncAsNewRhpBEFuncionarioWithnewfunc.Funcionario="987654"
        .Nome = "erro liga timesheets"
        .NomeAbreviado = ""
        .TipoRendimento = "A"
        .DataAdmissao = DateTime.Now
        .Situacao = "001"
        .Instrumento = "001"
        .Estabelecimento = "000"
        .FormaPagSF = "001"
        .FormaPagSN = "001"
    End With

    BSO.RecursosHumanos.Funcionarios.Actualiza newfunc

End Sub

And the result was Run-time error '3000' .

    
asked by anonymous 17.07.2018 / 13:26

3 answers

3

The query problem in question is filling fields with related tables. When creating new employees you should enter the codes and not the descriptions of the related tables.

For example:

The district field must be filled in with the district identifier "01" located in the "Districts" table, not the district name "Lisbon".

You can get the information of the district codes by executing the following query:

SELECT * FROM Distritos
    
17.07.2018 / 18:10
2

There are several problems: field Distrito , this field is a coding (table Distritos ) and not a description, field Qualificacao idem (table Categorias ), etc. Just run Query on SQL Server and check what error it gives. In the next, it's best to put the code used, so we can help you better.

    
17.07.2018 / 17:17
-1

Based on your code placed now, I would say that you should have the error handling to have the type of errors you are giving. Doing the error handling, with your example in a Demo company, gives the error 3000: "Error when validating the information entered. The Establishment for the Employee does not exist. "

Public Sub TesteCriaNovoFunc()
    On Error GoTo Fim

    Dim newfunc As RhpBEFuncionario

    Set newfunc = New RhpBEFuncionario

    With newfunc
        .Funcionario = "987654"
        .Nome = "erro liga timesheets"
        .NomeAbreviado = ""
        .TipoRendimento = "A"
        .DataAdmissao = DateTime.Now
        .Situacao = "001"
        .Instrumento = "001"
        .Estabelecimento = "000"
        .FormaPagSF = "001"
        .FormaPagSN = "001"
    End With

    BSO.RecursosHumanos.Funcionarios.Actualiza newfunc

    Set newfunc = Nothing

    Exit Sub

Fim:  
    MsgBox Err.Number & ": " & Err.Description
End Sub
    
18.07.2018 / 10:51