How to pull data from sql server ( Seperate server) & upload it into sap

Hi All,
I have a SQL Server database in System1,
data base name          DB1
Table name                 TB1
I want pull data from TB1 & upload the same into ztable in SAP.
How I can I achive this in ABAP.
Thanks in Advance
Appropriate points will be rewarded.
Arun kumar

Hi Arun,
You have to do the following:
1. Create an entry in Trxn DBCA for SQL Server in SAP, you are creating a database connection for the SQL server in SAP.
2. You use this connection, and write Native SQL stmnts...between EXECSQL...ENDEXEC to fetch the data..and then normal ABAP statements to put that data into your ztable.
Regards,
Raj
For eg:
TABLE DBCON Entry can be like this...depends on your External database..
CON_NAME                                  Raj                Logical name for connection
DBMS                                           MSS              Microsoft SQL Server
USER_NAME                                <User name>     For SQL Serve
PASSWORD                                 <password>            "    "
CON_ENV                  MSSQL_SERVER=<server> MSSQL_DBNAME=<database name>
DB_RECO                 Availability type for an open database connect  
FUNCTION z_houston_connect.
""Local interface:
EXEC SQL.
CONNECT TO 'RAJ' AS 'V'
ENDEXEC.
EXEC SQL.
SET CONNECTION 'V'
ENDEXEC.
*- Get the data from MS-SQL Server
EXEC SQL.
open C1 for
select
l.loc_id,
l.loc_name,
a.acc_id,
a.acc_name,
d.person
from ho_loc_mast as l
inner join snd_acc_mast as a on l.loc_id = a.loc_id
inner join snd_acc_addr as d on a.loc_id = d.loc_id and
a.acc_id = d.acc_id
where l.loc_id = '001'
ENDEXEC.
DO.
EXEC SQL.
FETCH NEXT C1 into :wa-c_locid, :wa-c_locname, :wa-c_acc_id, :wa-c_acc_name, :wa-c_person
ENDEXEC.
IF sy-subrc = 0.
PERFORM loop_output.
ELSE.
EXIT.
ENDIF.
ENDDO.
EXEC SQL.
CLOSE C1
ENDEXEC.
ENDFUNCTION.

Similar Messages

  • How to pull Data from SQL server in FDM

    Hi Experts
    How to pull the HFM data from One SQL server to Another SQL Server using integration scripts in FDQM?
    regards
    Dev

    Could you clarify why you want to do this?
    If you are trying to synchronize two databases (apps) to have a backup or something running in a development environment, I would suggest configuring replication between the two databases. It would be much more efficient to do this at the SQL Server level than through the FDM application, IMHO.
    Charles

  • How to select data from Sql server 2005 database tableinto oracle database table

    Hi,
    I have table text1 in sql server database and text2 in oracle database (11g). Now how to move data from SQL Server table into oracle table. So please help me how to do it.
    Thanks a lot in advance.
    rk
    OS: Windows 7 professional

    Hi,
    you can use export/import wizard and specify sql server as a source and oracle as destination.
    I hope this is helpful.
    Please Mark it as Answered if it answered your question
    OR mark it as Helpful if it help you to solve your problem
    Elmozamil Elamir Hamid
    MCSE Data Platform
    MCITP: SQL Server 2008 Administration/Development
    MCSA SQL Server 2012
    MCTS: SQL Server Administration/Development
    MyBlog

  • One report to pull data from SQL or DB2

    Hi Guys,
    First post here.  I have scoured the internet using our good friend google for answers and have come up empty.  I hope someone can help me here!
    Some Info: Crystal XI R2, Visual Studio 2005, Ms SQL Server 2005, DB2, VB.NET
    What I am trying to accomplish is using one report to pull data from either SQL 2005 or DB2.
    The problem I get is if the report is configured to pull data from SQL 2005, I cannot change it using the code below to pull data from DB2.  The SQL Report uses the Microsoft OLEDB Provider.  The DB2 report uses the IBM DB2 UDB for iSeries IBMDA400 OLEDB provider.  When I quickwatch the oCRTable logon information, it seems to retain the other database's info.
    Any ideas?
    My code:
        Private Sub LoadRpt(ByVal rpt As String)
            Try
                Dim strReport As String
                Dim crReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
                Dim rpt As CrystalDecisions.CrystalReports.Engine.ReportDocument
                Dim oCRTable As CrystalDecisions.CrystalReports.Engine.Table
                Dim oCRConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo()
                strRptNm = String.Format(".rpt", rpt )
                strReport = String.Format("\{1}", Server.MapPath("Reports"), rpt )
                crReportDocument.Load(rpr)
                '   check to make sure report is loaded; if not, then do nothing
                If crReportDocument.IsLoaded Then
                    oCRConnectionInfo.DatabaseName = ConfigurationManager.AppSettings.Item("DataBase")
                    oCRConnectionInfo.ServerName = ConfigurationManager.AppSettings.Item("Server")
                    oCRConnectionInfo.UserID = ConfigurationManager.AppSettings.Item("Profile")
                    oCRConnectionInfo.Password = ConfigurationManager.AppSettings.Item("Password")
                    For Each oCRTable In crReportDocument.Database.Tables
                        oCRTable.LogOnInfo.ConnectionInfo = oCRConnectionInfo
                        oCRTable.ApplyLogOnInfo(oCRTable.LogOnInfo)
                        oCRTable.Location = oCRTable.Location
                    Next
                    For Each rpt In crReportDocument.Subreports()
                        For Each oCRTable In rpt.Database.Tables
                            oCRTable.LogOnInfo.ConnectionInfo = oCRConnectionInfo
                            oCRTable.ApplyLogOnInfo(oCRTable.LogOnInfo)
                            oCRTable.Location = oCRTable.Location
                        Next
                    Next
                ... other code ...
                End If
            Catch ex As Exception
                ... other code ...
            End Try
        End Sub
    Edited by: Mace Windu on Feb 7, 2009 7:55 AM
    Edited by: Mace Windu on Feb 7, 2009 7:56 AM

    David,
    Your suggestion worked to near perfection.  The only problem was that if I configured the datasource locations of the report and sub reports in CR to use the SQL ODBC, the .net program would successfully log in using the DB2 info but had a problem reading the data.  If I configured the datasource locations of the report and subreports in CR to use the DB2 ODBC, everything worked!  Thanks for the advice. 
    The force is strong with you.
    Mace

  • How to pull data from oracle GL to planning

    Hi all
    Can one suggest me how to pull data from oracle GL in to hyperion planning(we are using hyperion planning 9.3 with limited licence for analytic services). i guess we can use HAL ..any thing else
    any help is appreciable
    regards
    M.V

    Hi
    I appreciate for your response. Yep you are exactly right it is data only, but I do have a problem these people have their licence of limited version of Essbase.
    Let me give you the information of their licence agreement.
    The licence for the hyperion planning- sytem9 programs includes a limited use license for both the hyperion Essbase- system 9 and hyperion Financial reporting - system 9 programs. Such limited use license means that the hyperion Essbase- system 9 and Hyperion financial reporting -system 9 programs may only be used to access data from the Hyperion planning -system 9 program.
    Specifically, the hyperion essbase- system 9 program cannot be used to create Essbase cubes that do not contain data used by the Hyperion planning- system 9 program and the Aggregate storage option component of the Hyperion Essbase - system 9 program may not be used.
    1) what it(licence agreement) really means - can you install Essbase, if not how can you create dimensions dynamically using planning.
    2) Is it possible without Essbase as far as I know its not possible
    3) are we going to face any issues with this licence.
    4) Is it possibe to pull data with planning
    I appreciate if any one resolve this issue
    regards
    M.V

  • How to import data from SQL server to Oracle?

    Dear Sir/Madam,
    I want to move database data from SQL Server to Oracle, but don't how to do it, will you please help me do it?

    Oracle Migration Workbench is your best bet:
    http://www.oracle.com/technology/tech/migration/workbench/index.html
    Cheers, OTN

  • How to Pull data from sap r/3 tables to oracle tables

    how to fetch data from sap r/3 tables & data pulled to oracle table .
    GIVE THE APPROPRITE ANSWER FOR THIS.
    THANKS IN ADVANCE.
    If it is useful for me , i am giving point.
    regards ,
    Navita
    Edited by: NAVITA YADAV on Mar 7, 2008 2:07 PM
    Edited by: NAVITA YADAV on Mar 7, 2008 2:08 PM

    You need to perform some native SQL to fetch data. Before doing this connection must be exists b/w your R/3 and Oracle server.
    Basis team will help you to have connection.
    Check the connection name in the table DBCON.
    Check the below code to handle native SQL.
      SELECT SINGLE  DBMS
               FROM  DBCON
               INTO  DBTYPE
               WHERE CON_NAME = DBS.
      IF DBTYPE = 'ORA'.
        TRY.
          EXEC SQL.
            CONNECT TO :dbs
          ENDEXEC.
    ERROR Handling for Native SQL *************
          IF SY-SUBRC <> 0.
            MESSAGE `Docusphere connection failed.` TYPE 'I'.
            EXIT.
          ENDIF.
      EXEC SQL PERFORMING loop_output.
        OPEN C1 FOR
        SELECT  UK1, UK7, uk6, uk9, uk22, uk23, uk25    "field names of Oracle table
        FROM IIS_DOCS_AP10D
        WHERE ( UK2 = 'ZFIINVOICE' OR UK2 = 'ZFIPAYREQ' )    AND
        UK19 = 'E'                                           AND
        UK20 IS NULL
      ENDEXEC.
          DO.
            CLEAR W_OUTPUT.
            EXEC SQL.
              FETCH NEXT C1 into :wa1-arc_doc_id, :wa1-bukrs, :wa1-belnr, :wa1-gjahr, :wa1-wi_id, :wa1-ARCH_METHOD, :wa1-barcd.
            ENDEXEC.
    enddo.
    Reward points if helpful.................

  • Oracle B2B 11g question about pulling data from remote TP sftp server

    Hi,
    We would like replace our custom b2b solution with oracle b2b, but without resulting much changes in remote TP side. To do that the following issues are to be resolved.
    1) in the existing custom b2b, host tp is pulling data from remote TP location. How does oracle b2b pull data from remote location using sftp(AS1 1.1)? Oracle document says that by using global listening channel, we can make oracle b2b listen to the sftp server? Is that correct? Is there any sample about how to configure and test it.
    2) For outbound file we would like to preserve the file name. If you use sftp for sending the file out, is it possible to preserve the filename?
    3) Some incoming files which are datafiles , does not have any identification pattern. Is there any other way to identify the document type? For example from which location we are pulling the file can tell us the document type.

    1) in the existing custom b2b, host tp is pulling data from remote TP location. How does oracle b2b pull data from remote location using sftp(AS1 1.1)? Oracle document says that by using global listening channel, we can make oracle b2b listen to the sftp server? Is that correct? Is there any sample about how to configure and test it. I am not sure what do you mean by AS1 1.1 but yes, SFTP is supported in Oracle B2B and if you want to poll a SFTP location, then you need to create a listening channel in Oracle B2B. For creating a listening channel, please refer -
    http://download.oracle.com/docs/cd/E14571_01/integration.1111/e10229/bb_listen_chan.htm#BAJJICJJ
    2) For outbound file we would like to preserve the file name. If you use sftp for sending the file out, is it possible to preserve the filename?Yes, it is possible. There is a setting "Preserve Filename" in transport protocol parameter of a SFTP channel which should be enabled for this purpose.
    3) Some incoming files which are datafiles , does not have any identification pattern. Is there any other way to identify the document type? For example from which location we are pulling the file can tell us the document type. In case of FTP/FILE/SFTP, file name can be used to pass document type and revision information to Oracle B2B. Please refer "Filename format" setting on the above mentioned link.
    I figured it out from another thread about how to pull the file. I configured the listening channel so that it reads from a remote server using sftpo protocol. And I have given the filename format as %FROM_PARTY%.dat. I am putting a file like TESTBC.dat. TESTBC is the name of the remote TP. B2B is reading the file but, recognizes the document tupe, but says that FromTP null. What is the solution?
    Make sure that TP name is same as what you are giving in filename (cross-check for spelling). You may also try with default naming convention (do not mention anything in Filename format in listening channel configuration) - %FROM_PARTY%_%TIMESTAMP%.dat
    for eg -
    Acme_12345.dat
    Regards,
    Anuj

  • How to insert Data from a function on server A into a table on Server B.

    Hi,
    I have a function which is like this
    DECLARE @oldmax bigint, @newmax bigint
    SELECT @oldmax = max(exportTimestamp) FROM EXPORT_TIMESTAMPS
    IF @oldmax IS NULL
    SET @oldmax = 0
    SELECT * FROM ServerA.TableA.fnExportTrafficTS(@oldmax) ORDER BY storeID, TrafDate
    SELECT @newmax = max(timestamp) FROM TRAFFIC t
    IF @newmax > @oldmax
    INSERT INTO EXPORT_TIMESTAMPS
    VALUES(@newmax, GETDATE())
    And now i need to insert the data coming out of this function into ServerB Table B
    And the column names and everything coming out of the function is the same columns in Table B.So, no need to worry there.
    I have never worked with inserting data from function through linked server.
    Can someone please help me with this?
    Thanks,
    Sujith

    Well, first of all, your table structure doesn't match the structure of returned table by your table-valued function.
    This is what table valued function returns:
    [storeID] varchar(32) default('noRefID'),
    [TrafDate] [datetime] default(NULL),
    [QtyTraffic] [float] default(0)
    And this is what your table structure is:
    [tUTL_JobLogging_Key] [int] NOT NULL,
    [StoreId] [varchar](10) NULL,
    [TrafDate] [datetime] NULL,
    [Visits] [numeric](8, 2) NULL
    Apart from different size for the StoreID and using float vs. numeric and different name for the last column, there is one extra column in your table.
    So, this is the first problem you need to correct.
    Also, please post how exactly you're calling your procedure? E.g. the procedure has 2 parameters, but the values of them are not used as you're calculating them in the code. So, I assume they should not be parameters for the procedure.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • How to pull data from a c/c++ Application

    I am working on a project to instrument a product which runs on java as well as c/c++.
    Is there a way to pull data from a c/c++ application to a MBean?
    I am able to push the data through a custom TCP Adapter, But I could not get much help on a pull model.
    Also I would like to get some pointers on instrumentation techniques / patterns.
    Regards
    Chandramohan

    I'm not aware of any JMX out-of-the-box support for managing C++ applications with JMX or MBeans, but you can find some ideas on how this might be done in [this thread|http://forum.java.sun.com/thread.jspa?threadID=5240363] from [this very forum|http://forum.java.sun.com/forum.jspa?forumID=537&start=0].

  • Pull data from SQL Table and display it in mail

    I have a requirement to pull the data from SQL table and send it in email.  Currently I am sending the hard coded info in email but is it possible to pull some data from SQL Table and than format it and send it across in the same email? 
    Can you guide me with steps on this.
    Neil

    There are several ways to do this.  First is to populate a file in a data flow and then send that as an attachment in the send mail task. 
    As far as including the results in the email body this becomes a bit trickier.  To use a variable you would need to use an SSIS variable type of
    Object, this is similar to a collection in .NET.  The problem once the object is populated is that it isn't like a readable result set, but again more like an array or a collection.  There is no native method to take the object variable and
    specify .ToString() or cast its results as text.  You would need to iterate through each row and append it to another variable of type string, this could be done with a script task or ForEach container.
    Also you mentioned formatting the results.  What type of formatting were you looking for.  A limitation of the SMTP send mail task is that the message body doesn't support HTML so if you were looking at creating a table within the mail body you
    would have to use a script task or a custom component
    David Dye My Blog

  • Import Data from Office Control (Web Dynpro for ABAP) into SAP-Table

    Hello,
    I have a question concerning the Office Control UI-Eelement in Web Dynpro for ABAP:
    How can I import spreadsheet data from the Office Control in a SAP-table?
    I have an Excel-sheet (without any data) which is shown initially in the Office Control. First the empty Excel-Sheet will be loaded and in the second step data from an alvxml-transformation will be loaded into the Excel-sheet with the method 'activatexmlsource'. This works so far. When I change the loaded data in the Office Control and save it it will be stored as XLS-File. The problem is that I'm not able to use existing Upload-FM because every function module I tried uses GUI-functions and WebDynpro has no GUI-functionality. I always get the error that data from clipboard cannot be imported.
    So now the question is:
    How can I import changed data from the Office control into a SAP-table staying in Web Dynpro application?
    Please give some advice, if you have some useful code or ideas.
    Thanks in advance,
    Philipp
    Edited by: Philipp Hiebler on Feb 11, 2008 10:15 AM

    Hi,
    Once you save to desktop again you have made some changes to that file, this file you want to upload it right.
    Then in that case you need to use the FILEUPLOAD UI element right.
    Regards,
    Lekha.

  • How to select data from 3rd row of Excel to insert into Sql server table using ssis

    Hi,
    Iam having Excel files with headers in first two rows , i want two skip that two rows and select data from 3rd row to insert into Sql Server table using ssis.3rd row is having column names.

                                                         CUSTOMER DETAILS
                         REGION
    COL1        COL2        COL3       COL4           COL5          COL6          COL7
           COL8          COL9          COL10            COL11      
    1            XXX            yyyy         zzzz
    2            XXX            yyyy        zzzzz
    3           XXX            yyyy          zzzzz
    4          XXX             yyyy          zzzzz
    First two rows having cells merged and with headings in excel , i want two skip the first two rows and select the data from 3rd row and insert into sql server using ssis
    Set range within Excel command as per below
    See
    http://www.joellipman.com/articles/microsoft/sql-server/ssis/646-ssis-skip-rows-in-excel-source-file.html
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to merge data from SQL server to Oracle Database

    Dear Expert,
    I am having problem with SQL server with Oracle.
    Problem: I want to merge table records from SQL server to Oracle Table. Which License free tool I can use to achive the goals.
    If I able to make a free DB link from Oracle to SQL server , then we can select table and will be able to update.
    Right now I have made a DB link from SQL server to Oracle, Using that I can see the records from oracle database but I can't update them.
    Thanks,
    Sher

    Hi,
    What about using Oracle SQL Developer for migration
    http://www.oracle.com/technetwork/database/migration/sqlserver-095136.html
    HTH

  • How to pull data from EJB and present them using Swing ?

    Hi all,
    I've written stateful session bean which connect to Oracle database, and now I must write stand alone client application using Swing.
    The client app must present the data and then let users add,delete and edit data and it must be flexible enough to iterate through the records.
    The swing components can be JTextField,JTable etc.
    How to pull the data from EJB and present them to users with the most efficient network trip ?
    Thanks in advance
    Setya

    Thanks,
    Since the whole app originally was client-server app and I want to make it more scalable, so I decide to separate business logic in the EJB but I also want to keep the performance and the userfriendliness of the original user interface, and I want to continue using Swing as the original user interface does.
    I've read about using Rowset and I need some opinions about this from you guys who already have some experience with it.
    Any suggestions would be greatly appreciated.
    Thanks
    Setya

Maybe you are looking for