Click here to Skip to main content
15,074,181 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

This is more of a LINQ question rather than an ERPConnect one, I think.
Below is the code which fires a SAP built-in query (here named LPQuery) then filters and adds fields to the result along with data formatting. Code works fine up until the last join. If I activate the last join it ends up in very long running time (don't know whether it ever ends or not, and after a while consuming up memory, so I just stop the run)
1 more info: the last join e.g.:
join bb in earak
on knumv.KNUMV equals bb.KNUMV

uses a second table for joining 1st and 3rd while all other joins are between only 2 tables (=built-in query result fields and another table), maybe that is where I'm causing errors ? So how to correct the last join, to have gain the field

LPQuery = from res in sc.LIEFERPLAN(eladbiz1, ertszerv, partnerszerep, vevocsop)
          where ConversionUtils.SAPDate2NetDate(res.VBEP_WADAT) > dtFilter.Value
          select res;

 var prctr = from x in sc.MARCList where x.WERKS == "3801" || x.WERKS == "3802" && !x.MATNR.StartsWith("Q") && !x.MATNR.StartsWith("S") && !x.MATNR.StartsWith("T") select x;

var earak = from x in sc.KONVList where x.KSCHL == "ZPR0" && x.MANDT == "060" select x;

var vbak = from y in sc.VBAKList where y.VKORG == "0038" select y;

var vevonevek = from nevek in sc.KNA1List where nevek.MANDT == "060" select nevek;

var lieferplanfinal = (from tab1 in LPQuery
                       join yy in prctr
                       on tab1.VBAP_MATNR equals yy.MATNR
                       join zz in vevonevek
                       on tab1.VBAK_KUNNR equals zz.KUNNR
                       join aa in vbak
                       on tab1.VBAK_VBELN equals aa.VBELN into resquery
                       from knumv in resquery
                       join bb in earak
                       on knumv.KNUMV equals bb.KNUMV
 select new
     VBAK_KUNNR = tab1.VBAK_KUNNR.TrimStart(new char[] { '0' }),
     VBAK_VBELN = tab1.VBAK_VBELN.TrimStart(new char[] { '0' }),
     VBAP_MATNR = tab1.VBAP_MATNR.TrimStart(new char[] { '0' }),
     VBEP_WADAT = ConversionUtils.SAPDate2NetDate(tab1.VBEP_WADAT).ToShortDateString(),

Updated 22-Nov-12 22:30pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900