Application Development and Automation 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: 
Read only

Native SQL failing to fetch data from external database.

Former Member
0 Likes
2,040

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.

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

14 REPLIES 14
Read only

Former Member
0 Likes
1,969

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

Read only

0 Likes
1,969

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.

Read only

Former Member
0 Likes
1,969

is it a cluster table

Read only

0 Likes
1,969

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

Read only

0 Likes
1,969

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.

Read only

0 Likes
1,969

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

Read only

0 Likes
1,969

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.

Read only

0 Likes
1,969

Prakash,

Please, don't use UPPERCASE when you writing.

Warm regards,

Raphael Pacheco.

Read only

0 Likes
1,969

Hi Raphael,

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

Read only

0 Likes
1,969

Oks

Read only

raphael_almeida
Active Contributor
0 Likes
1,969

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.

Read only

0 Likes
1,969

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.

Read only

0 Likes
1,969

Great!

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


Warm regards,


Raphael Pacheco.

Read only

0 Likes
1,969

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.