Genexus 16: create an SDT by procedure

0

I have 2 sdt

and then this proc that creates it where in that proc there is a variable & catalog that is a collection of ElementoCatalogo

For each order RelMarCod RelModCod ModeloCod
    where relmarcod = 27
    where relmodcod = 367
    &RelMarCod = RelMarCod
    &RelModCod = RelModCod 
    &ModeloCod = ModeloCod
    Do 'AveriguoGrupo'
       &PreciodeLista = udp(PObtLPPrecio,1,&RelMarCod,&RelModCod)
       &Strpreciolista = str(&PreciodeLista,13,2)
       &Strpreciolista = &Strpreciolista.Trim()        
       &ElementoCatalogo = new ElementoCatalogo() 
       &ElementoCatalogo.CodMarca = &RelMarCod
       &ElementoCatalogo.CodModelo = &RelModCod
       &ElementoCatalogo.DescMarca = Trim(&AutMarDesc) 
       &ElementoCatalogo.DescModelo = Trim(&AutModDesc) 
       &ElementoCatalogo.PrecioVenta = &PreciodeLista
       &ElementoCatalogo.Grupo = &AutGruNom.Trim()
       &ElementoCatalogo.UsadoNuevo = 'N'
       Do 'Colores'
       &Catalogo.Add(&ElementoCatalogo.clone())
endfor  

Sub 'Colores'
     For each order RelMarCod RelModCod ModeloCod AutColCod
         Where RelMarCod = &RelMarCod
         Where RelModCod = &RelModCod
         Where ModeloCod = &ModeloCod
           &CatalogoColores.CodigoModelo = &RelModCod
           &CatalogoColores.CodColor = AutColCod
           &CatalogoColores.DescColor = AutColDes.Trim()
           &ElementoCatalogo.Colores.Add(&CatalogoColores.Clone())
     endfor     
endsub  

Sub 'AveriguoGrupo'
    &AutGruNom = ''
    For each Order AutMarCod
        Where AutMarCod = &RelMarCod
        &AutGruNom = AutGruNom
    endfor      
endsub

The problem that I have is the following one after doing the add of the & catalog the execution is cut and it gives me this error:

Server error in the application '/ AutosWebGX15'. Object reference not set to an instance of an object. Description: Unhandled exception when executing the current Web request. Check the stack trace for more information about the error and where it originated in the code.

Exception details: System.NullReferenceException : Object reference not set as an instance of an object.

Source code error:

An unhandled exception was generated during the execution of the current Web request. Information about the origin and location of the exception can be identified using the following stack exception.

Tracking the stack:

[NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.]
   GeneXus.Programs.awscatalogo_sdt.executePrivate() +1242
   GeneXus.Programs.awscatalogo_sdt.webExecute() +312
   GeneXus.Http.GXHttpHandler.webExecuteEx(HttpContext httpContext) +40
   GeneXus.Http.GXHttpHandler.ProcessRequest(HttpContext httpContext) +668

[Exception: GXApplication exception]
   GeneXus.Http.GXHttpHandler.ProcessRequest(HttpContext httpContext) +793
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +188
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +71
    
asked by Sergio RzSoft 05.10.2018 в 19:44
source

0 answers