javasap-commerce-cloudhybris-data-hubflexible-search

Flexible Search Issue SAP Hybris


I have a problem with a Flexible Query. This is my query:

Select
{pp.productCode} as 'Code',
{p.descriptionCics} as 'Desc CISC',
{bs.uid} as 'Store',
{evo.code} as 'Status', 
{p.department} as 'Department', 
{pca.name} as 'Category',
{p.grm} as 'GRM',
{p.buyerCode} as 'Code Buyer',
{p.buyerids} as 'Buyer', 
{ps.planogramCode} as 'Code Planogram',
{pca.categoryCode} as 'Category Planogram',
{s.puvmBlock} as 'Blocked',
(CASE WHEN ({p.productDetailTypeList} is not null )THEN 'YES' else 
'NO' END) as 'IMAGE'
from 
{ 
Product as p
JOIN PlanogramProducts as pp on {p.code} = {pp.productCode}
JOIN StockLevel as s on {pp.productCode} = {s.productCode}
JOIN EnumerationValue as evo on {p.status} = {evo.pk}
JOIN PlanogramCategory as pc on {pp.planogramCode} = 
 {pc.planogramCode}
JOIN PlamnogramCategoryAnag as pca on {pc.categoryCode}= 
{pca.categoryCode}
JOIN BaseStore as bs JOIN PlanogramStore as ps on {bs.storeRef} = 
{ps.storeRef} AND {bs.bramchOffice} = {ps.branchOffice}
}
WHERE 1=1

and this my error when I execute it:

enter image description here

Can someone help me? Thanks a lot.


Solution

  • Your statement contains errors. You join basestore with planogramStore. But neither planogram store, nor basestore is joined with any other part of your query. You need to join basestore or planogramstore with one of the other tables.

    Now you have 2 detached parts in your from statement, which is why you are getting errors

    Product as p
    JOIN PlanogramProducts as pp on {p.code} = {pp.productCode}
    JOIN StockLevel as s on {pp.productCode} = {s.productCode}
    JOIN EnumerationValue as evo on {p.status} = {evo.pk}
    JOIN PlanogramCategory as pc on {pp.planogramCode} = 
     {pc.planogramCode}
    JOIN PlamnogramCategoryAnag as pca on {pc.categoryCode}= 
    {pca.categoryCode}
    

    and

    JOIN BaseStore as bs JOIN PlanogramStore as ps on {bs.storeRef} = 
    {ps.storeRef} AND {bs.bramchOffice} = {ps.branchOffice}
    

    you need to have a join between these 2 parts to get the correct data