Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
 laujerry
		
			laujerry
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi all, please advise what's wrong with the following script, thanks!
LET vYesterday=MakeDate(2013,10,12);
[VBAK]:
LOAD
VBELN,KUNNR,BSTNK,
VKGRP,VKORG,VTWEG,
SPART,AUDAT,VDATU,
AUART,WAERK,KNUMV,
FAKSK,ERNAM,VKBUR,
KTEXT,ERDAT,ERZET;
SQL Select
VBELN KUNNR BSTNK
VKGRP VKORG VTWEG
SPART AUDAT VDATU
AUART WAERK KNUMV
FAKSK ERNAM VKBUR
KTEXT ERDAT ERZET
from VBAK WHERE
Date(ERDAT,'dd/MM/yyyy')='$(vYesterday)';
/QTQVC/OPEN_STREAM failed after 00:00:00 Key = SQL_ERROR (ID:00 Type:E Number:001 Comma without preceding colon (after OPEN ?).)
 
					
				
		
 swuehl
		
			swuehl
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		The SQL WHERE clause is sent to the DB driver as is (after doing the dollar sign expansion only), and your driver probably doesn't know the QV Date() function.
Either use a function that is supported by the driver, or compare the field directly with a properly formatted variable.
 
					
				
		
Hello,
Do it like this :
let vYesterday = date(Today()-1,'YYYYMMDD'); // Dates in SAP are like this
trace >> $(vYesterday); //
...
from VBAK WHERE
ERDAT ='$(vYesterday)';
 
					
				
		
 laujerry
		
			laujerry
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		/QTQVC/OPEN_STREAM failed after 00:00:00 Key = SQL_ERROR (ID:00 Type:E Number:001 "'20131015'" is not a valid comparison operator.)
It still reports error 
 
					
				
		
 sudeepkm
		
			sudeepkm
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		you may also have to use date variable in your script like below:
$(#vYesterday) or '$(#vYesterday)'
A good article on Date fields by Henric at here: QlikView Date fields
