Need to display a field from Salestable to report

static void Job25(Args _args)
{
    SalesTable stab;
    ProdTable prod;
    ProdJournalRoute pjr;
    ;
    while select * from stab exists join * from prod join * from pjr where pjr.ProdId==prod.ProdId && prod.InventRefId==stab.SalesId
    {
        info(strfmt("%1 %2",stab.SearchName,stab.SalesId));
    }

}

When I run this job I get the outputs from sales table having searchname record… but the same isn’t showing in report…

Try this, (this will help you debug in detail and know where the exact issue is?)
SalesTable::find(prodJournalRoute_1.ProdTable().InventRefId).SearchName;

display str getsearchname()
{
    SalesTable stab;
    ProdTable prod;
    ;
    select SearchName from stab where stab.PurchOrderFormNum ==  ProdTable::find(prodjournalroute_1.ProdId).CustomerRequisition;
    return stab.SearchName;
}

Done like this, Kranthi.

Thanks for your help…

It seems that you don’t have a proper relation between the production order and sales order. That’s why earlier select statement was failed.