We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

Re: [sap-abap] Get Data From Other Database In ABAP

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Reply from sats35 on Dec 18 at 12:17 AM
Dear Anil,
You can put this code in one of your performs or field validation
checks..

TRY.
EXEC SQL.
CONNECT TO :DBS
ENDEXEC.

IF sy-subrc <> 0.
RAISE EXCEPTION TYPE cx_sy_native_sql_error.
ENDIF.


" ZVEHICLE is the ABAP screen table name. GET_XXXX is procedure created
in Oracle DB to fetch data into ABAP

EXEC SQL.

EXECUTE PROCEDURE GET_XXXX(INOUT :ZVEHICLE-DRIVERLICENCE, OUT
:ZVEHICLE-VEHICLENO,
OUT
:ZVEHICLE-INLOADEMPTY,OUT :ZVEHICLE-DRIVERNAME,
OUT
:ZVEHICLE-ASSISTNAME,OUT :ZVEHICLE-NAME1,
OUT :ZVEHICLE-DRIVERPASS,
OUT :ZVEHICLE-ASSISTPASS)

ENDEXEC.


CATCH cx_sy_native_sql_error INTO db_excep.
CLEAR e_dbmsg.
CALL METHOD db_excep->if_message~get_text
RECEIVING
result = e_dbmsg.

CLEAR: e_dbmsg_long.
CALL METHOD db_excep->if_message~get_longtext
RECEIVING
result = e_dbmsg_long.

EXEC SQL.
disconnect :DBS
ENDEXEC.
ENDTRY.

In Module Pool Top, you have to declare
DATA: dbs TYPE dbcon-con_name VALUE 'SAPORCL', " this connnection has
to be created by your basis team
db_excep TYPE REF TO cx_sy_native_sql_error,
e_dbmsg TYPE string,
e_dbmsg_long TYPE string.

DATA : db_msg(200),

Hope this helps...

---------------Original Message---------------
From: Anil Dhasmana
Sent: Wednesday, December 17, 2014 11:59 PM
Subject: Get Data From Other Database In ABAP

Is there any way to connect to another database like MSSQL or another Oracle DB in ABAP. Right now we have oracle DB in place. Can we take a report from other DB also?

Regards,
Anil.

 
Reply to this email to post your response.
 
__.____._
Manage Settings | Unsubscribe | Create FAQ | Send Feedback
  
Copyright © 2014 Ziff Davis, LLC. and message author.
Ziff Davis, LLC. 28 E 28th Street New York, NY 10016
sats35  

achievements
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Have a technical question? Need to find IT solutions? Ask your peers in the Toolbox for IT community.

_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language