Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to execute query from Qlikview load script in order to fetch data from SAP

Dear Community Users,

I have been given a SAP query from SAP team, and the objective is to run the SAP query from Qlikview load script and fetch the data.

Below is the query, when i run this query in Qlikview with connection information. am getting Script Error.

SELECT distinct b.objectvalue as ebeln

FROM CDPOS b, CDHDR a

WHERE b.objectclas    = ‘EINKBELEG’

AND  b.tabname = ‘EKES’

And   b.objectvalue = a.objectvalue

AND  b.changenr = a.changenr

AND  a.objectclas = ‘EINKBELEG’

AND  a.udate    >= &LastRunDate  ;

Appreciate your Help.

Thanks

Balamuralidharan T

4 Replies
petter
Partner - Champion III
Partner - Champion III

What does you connect statement say during script run? Do you get a successful connection? Is it the SELECT statement that really cause the "Script Error"?

You quotes in the SQL above seems off. They are a back-tick as start and forward-tick as end ... which seems odd. I don't know much about SAP but I am pretty sure that single qutoes; straight/vertical like this '  is what you need to use:

SELECT distinct b.objectvalue as ebeln

FROM CDPOS b, CDHDR a

WHERE b.objectclas    = 'EINKBELEG'

AND  b.tabname = 'EKES'

And   b.objectvalue = a.objectvalue

AND  b.changenr = a.changenr

AND  a.objectclas = 'EINKBELEG'

AND  a.udate    >= &LastRunDate  ;

aarkay29
Specialist
Specialist

Try this:

LOAD OBJECTVALUE AS EBELN

;

SQL SUBSELECT OBEJECTVALUE FROM CDPOS

WHERE

     OBJECTCLAS='EINKBELEG' AND TABNAME='EKES' AND OBJECTVALUE CHANGENR  IN ( SELECT OBJECTVALUE CHANGENR FROM CDHDR WHERE UDATE >= '$(LastRunDate)' );


Make sure that LastRunDate is in YYYYMMDD format and also I believe that OBJECTID is the name for field OBJECTVALUE in SAP TABLE CDPOS and CDHDR.

Anonymous
Not applicable
Author

Hi Aar Kay, Thanks for your reply. I did execute the query which you recommended but still am getting the script error.

Yes, am able to connect the SAP.

Please find below the snapshot of Error message,

Error Message.JPG

Thanks

Balamuralidharan T

aarkay29
Specialist
Specialist

Can you please post your script