Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Native SQL failing to fetch data from external database.

Former Member
0 Kudos

The Native SQL used for fetching data from external database is not working. The select statement is neither giving any dump nor fetching anything. It is executing for very long time giving time out dump when run in foreground. We have other reports where the same SQL is working fine with same fields fetched from the view used in DB link. Only for one such report we are facing this issue.

We have checked the view from the external database end and it seems to be fine.

Please help to solve this issue with your valuable inputs.

14 REPLIES 14

Former Member
0 Kudos

can you provide the statement you are using for fetching and the database you are using

0 Kudos

Hi Prakash,

This is the statement i am using.

EXEC SQL.      

select hr_id, lastname, firstname, smtp_extern, unique_id,
              prop_addr1, prop_addr3, hr_db_name
              from peda_gddb into :gs_gddb
               where hr_db_pers_id = :lf_pernr
ENDEXEC.

Former Member
0 Kudos

is it a cluster table

0 Kudos

YOU DINT MENTIONED WHICH DATABASE YOU ARE USING. IS THE DATABASE IS OF YOU SAP SYSTEM OR OUT SIDE SAP. IF ITS OUT SIDE HOW YOU HAVE PROVIDED THE CREDENTIALS

0 Kudos

Hi Prakash,

peda_gddb is a view created in a DB link to connect our SAP system to one non sap external database.

We are trying to fetch data using this DBlink.

0 Kudos

have you tested the connections between the database and sap. Are you able to get  data from other tables

0 Kudos

if connection is ok try your staments like this. this will give whether its going in infinite loop due to wrong config of view or due to indexing problem of tables in other database.

types: begin of ty_lfa1,

          lifnr type lfa1-lifnr,

          name1 type lfa1-name1,

         end of ty_lfa1.

data: wa_lfa1 type ty_lfa1.

EXEC SQL PERFORMING loop_output.

  SELECT LIFNR, NAME1

  INTO  :WA_LFA1

  FROM  LFA1;

ENDEXEC.

form loop_output.

  write: / wa_lfa1-lifnr.

endform.

0 Kudos

Prakash,

Please, don't use UPPERCASE when you writing.

Warm regards,

Raphael Pacheco.

0 Kudos

Hi Raphael,

            Thanks for your suggestions. I started activities from few days only. I have written Caps only in code.

0 Kudos

Oks

raphael_almeida
Active Contributor
0 Kudos

Hi Nithin,

This is a third party table right?

I suggest the utilization of classes CL_SQL* instead EXEC_SQL.

For examples, please open in SE38 the program ADBC_DEMO.

Warm regards,

Raphael Pacheco.

0 Kudos

Hi Pacheco,

Thanks for your inputs,

But this EXEC_SQL was working fine all this while and it was implemented in 2007.

And also surprisingly the same query is working fine in UAT and development systems and these two are also using the same DB_link as production to the external system.

0 Kudos

Great!

I put an example he used when I used the EXEC_SQL, I believe this will help you.


Warm regards,


Raphael Pacheco.

0 Kudos

Hi Raphael,

Actually i tried ST05 for tracing the SQL. I found that the FETCH statement is missing and ROLLBACK WORK ON CONNECTION is taking very long time.

Please help me in identifying the root cause here.