Passing data from abap-program to mssql database table thro native sql

Hi,
To pass the data from abap-program to mssql server,i have created database connection through dbco t.code.
now i am trying to get connection thro native sql but am not able to get it .Am working in ECC 5.0.
Could anyone help me on this.Did i miss anything?
i have tried Native-sql like this.
DATA: CON_NAME LIKE DBCON-CON_NAME VALUE 'BIW'.
EXEC SQL.
  CONNECT TO :con_name AS 'C1'
ENDEXEC.
Thanks in advance.

Hi,
Trying to do the same here, only using Oracle DB.
DATA:     dbc TYPE DBCON_NAME VALUE 'BI'
TRY.
  EXEC SQL.
    CONNECT TO :dbc
  ENDEXEC.
  IF sy-subrc NE 0.
    RAISE EXCEPTION TYPE cx_sy_native_sql_error.
  ENDIF.
CATCH cx_sy_native_sql_error INTO oref_native_sql_error.
  sql_emsg = oref_native_sql_error->get_text( ).
  MESSAGE sql_emsg TYPE 'I'.
ENDTRY.
I keep getting the message 'Native SQL exception has occured' (because of the RAISE statement, I wonder how we can get a meaningfull error description).
Of course this can be a result of a number of network issues, so I'm trying to resolve this together with my BC admin.
I suggest the same to you..
In the meantime, if anyone can help out, it will be appreciated.
Regards,
SD

Similar Messages

  • PASS DATA FROM ABAP PROGRAM TO WORKFLOW CONTAINER

    Hello Everybody,
    I am a workflow beginner and I want to pass a data from my ABAP code to a workflow container. This workflow container is used in the Send Mail step.
    The ABAP  Program is:
    REPORT  zdb_work_flow.
    tables : vbak.
    DATA : k TYPE sweinstcou-objkey,
                e TYPE swetypecou-event.
    DATA : st TYPE swcont,
                itab TYPE STANDARD TABLE OF swcont.
    PARAMETERS : vbeln TYPE vbak-vbeln.
    start-of-selection.
      st-element = 'VBELN'.   "This is my WORKFLOW CONTAINER
      st-tab_index = 1.
      st-elemlength = 10.
      st-type = 'C'.
      st-value = vbeln.
      append st to itab.
      k = vbeln.
      e = 'TRIGGER'               "This is an event in my BUS OBJ ZDB_WFLOW
      CALL FUNCTION 'SWE_EVENT_CREATE'
        EXPORTING
          objtype                               = 'ZDB_WFLOW'   "My BUS OBJ
          objkey                                 = k
          event                                  = e    "Event TRIGGER in ZDB_WFLOW
        tables
          event_container               = itab
        exceptions
          objtype_not_found             = 1
          OTHERS                        = 2
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.         .
      COMMIT WORK.
    Now I have created a workflow in SWDD as ZDB_WF_SW.
    In this WF I have created a container as VBELN.
    In the SEND MAIL I have given a header as "Worflow Triggered for &VBELN&"
    PROBLEM.
    The Workflow is getting triggered. I am also getting a mail "Workflow Triggered for" in my mailbox but the &VBELN& is missing from the header.
    I have set the IMPORT EXPORT flag of the WF CONTAINER "VBELN"
    Please Help.
    Edited by: Deepankar.B on Feb 22, 2011 4:08 PM
    Edited by: Deepankar.B on Feb 22, 2011 4:10 PM

    You wouldn't use a SMA as an assistance class - but refer to one within it.
    I would use Shared Memory Area classes - but I'd also build a SMA that could talk across multiple application servers.
    Thomas Jung proposed this in a forum reply some time ago.
    It shouldn't be too difficult to use RFC's to access the content of SMA's in multiple app servers - ensuring synchronisation across multi app servers. I've not yet had the need, so haven't attempted.
    The long polling in 7.02 apparently uses this approach, so in a 7.02 system there may even be standard components/ SMAs that you could use.
    I do not think global areas in FM's are available across sessions - I don't think you could use that as a data transport.

  • How to delete data from single field in a database table?

    Hi guys,
         Plz suggest me How to delete data from single field in a database table?
    thnks,
    pavan

    hi
    in addition to abv details..chk this:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3aef358411d1829f0000e829fbfe/content.htm
    http://dev.mysql.com/doc/maxdb/en/34/ee7fbd293911d3a97d00a0c9449261/content.htm
    regards,
    madhu

  • Passing data from ABAP to MSSQl

    Dear Experts,
                 I have an requirement to pass the data from Abap to Mssql server. Is it possible thro bapi? or should i follow ALE?
    Pls Give some ideas to proceed.
    Thanks in Advance.

    Closing this thread...

  • Reading XML Data from ABAP Program?

    Hi,
    How do I read XML Data from an ABAP Program? For example if I have the below basic XML Code-
    <xml>
    <Name> Thiru </Name>
    <Age> 24 </Age>
    <City> chennai </Chennai>
    </xml>
    How do i read the data within the Name,Age, and City tags into variables in the ABAP Program?
    Regards,
    Thiru

    if you decide to do in XSLT, I have a sample list here:
    XML file like this:
    <?xml version="1.0" encoding="UTF-16"?>
    <F>
    <P1>
    <t_1>value1</t_1>
    <t_2>testvalue</t_2>
    </P1>
    <P2>
    </P2>
    </F>
    XSLT file like this:
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sapxsl="http://www.sap.com/sapxsl" version="1.0">
    <xsl:strip-space elements="*"/>
    <xsl:template match="F">
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    <asx:values>
    <<b>DOCUMENT</b>>
    <xsl:apply-templates/>
    </<b>DOCUMENT</b>>
    </asx:values>
    </asx:abap>
    </xsl:template>
    <xsl:template match="P1">
    <ENTRY>
    <<b>T_1</b>><xsl:value-of select="t_1"/></T_1>
    <<b>T_2</b>><xsl:value-of select="t_2"/></T_2>
    </ENTRY>
    </xsl:template>
    </xsl:transform>
    ABAP program like this:
    DATA: BEGIN OF wa_upload,
    text(255) TYPE c,
    END OF wa_upload,
    itab_upload LIKE TABLE OF wa_upload,
    BEGIN OF wa_document,
    t_1 TYPE string,
    t_2 TYPE string,
    END OF wa_document,
    itab_document LIKE TABLE OF wa_document.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = 'XXXXX'
    filetype = 'ASC'
    TABLES
    data_tab = itab_upload.
    CALL TRANSFORMATION zrappel_xml_test
    SOURCE XML itab_upload
    RESULT <b>document</b> = itab_document.
    You should pay attention to the bold words.
    hope it will be helpful
    thanks

  • Upload data from abap program to abap inbound proxy

    Hi,
    I have requirement to upload flat file data to an internal table and call Inbound proxy abap class and pass all the internal table data to tha proxy clas method structure.
    So could any one help me how to send/pass data to class, Please give some e.g.
    thanks
    bobby
    Edited by: Bobby G on Nov 18, 2009 4:35 AM

    hi;
    you may follow the following ways
    1. create a report and by using GUI_upload, give the path as default , you can convert the flat file's data into internal table.
    2. call that report in proxy method by returning parameter as a table, this table can use further in the proxy.
    Another way, you have
    1.  Create a transparent table and by using the GUI_Upload in report,  you may  store the data.
    2.  from step 1, you may use data in the proxy.
    Regards
    Shashi

  • Import data from ABAP program to Excell template file

    Hello everyone
    I have  a such task: In abap program I have fields(screen fields), which I want to import into excell file. I don't want to export into empty file but into ready template .xls. Is there any possibility to match corresponding fields?
    I really need to know, I will be gratefully for any suggestions.
    Greetings

    Hi Katarzyna ,
    something like
    DATA: EXCEL TYPE OLE2_OBJECT.
    DATA: BOOKS TYPE OLE2_OBJECT.
    DATA: BOOK  TYPE OLE2_OBJECT.
    DATA: CELL  TYPE OLE2_OBJECT.
    DATA: FONT  TYPE OLE2_OBJECT.
    DATA: FILE  TYPE OLE2_OBJECT.
      CREATE OBJECT EXCEL 'EXCEL.APPLICATION'.
      CALL METHOD OF EXCEL 'WORKBOOKS' = FILE.
      CALL METHOD OF  FILE 'OPEN' EXPORTING #1 = P_FILE
                                            #2 = 1.  
      CALL METHOD OF EXCEL 'CELLS' = CELL EXPORTING #1 = P_LINE
                                                    #2 = P_COLUMN.
      SET PROPERTY OF CELL 'VALUE' = P_VALUE.
      CALL METHOD OF EXCEL 'QUIT'.
    This is just a compilation from a complex program. Do some modularization (i.e. create FORM fill_cell using P_line P_column P_value...)
    Hope I did not forget anything. Meanwhile we have much more modern and advanced methods and classes - this one is of 2000 (Release 4.5?).
    Regards,
    Clemens

  • How can i save the data from ALV grid to my database tables?

    Hi all,
    Suppose in a grid i want to edit some fields and after editing the data i want to store the refresh data to my database tables. How can i do that? what is procedure? Please tell me in details.
    Thanks in Advance,
    Abhijit.

    Hi, 
       If you are doing it with oops concept then here are the steps for that.
    1) Declare DATA : er_data_changed TYPE REF TO cl_alv_changed_data_protocol,
           data_changed TYPE REF TO cl_alv_changed_data_protocol.
    --For getting the row no of of the row which is edited by user
    DATA : ls_mod_cell TYPE table of lvc_s_modi with header line,
    lv_value TYPE lvc_value .
    in your program
    2) Define a class
    CLASS notification DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS : handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING er_data_changed.
    ENDCLASS.                    "NOTIFICATION DEFINITION
    3) For that class write the implementation
    CLASS notification IMPLEMENTATION.
      METHOD handle_data_changed.
        PERFORM handle_data_changed USING er_data_changed.
      ENDMETHOD.                    "handle_data_changed
    ENDCLASS.                    "NOTIFICATION IMPLEMENTATION
    4) In the  PERFORM handle_data_changed  you code like this
    FORM handle_data_changed  USING er_data_changed type ref TO
    cl_alv_changed_data_protocol.
    SORT er_data_changed->mt_mod_cells BY row_id .
    LOOP AT er_data_changed->mt_mod_cells
    INTO ls_mod_cell .
    append ls_mod_cell.
    ENDLOOP.
    *LS_MOD_CELL will have all the rows which were edited
    and all the updated data corresponding to those rows*
    You can now use the the data which is in LS_MOD_CELL
    to update into your DB Table.
    LOOP at ls_mod_cell.
      READ TABLE itab3 INTO t_output INDEX ls_mod_cell-row_id.
    ENDLOOP.
    ENDFORM.                    " handle_data_changed
    Regards,
    Syed

  • Uploading Data From Excel Sheet to SAP Database Tables

    Dear Friends,
    We are having an Excel Sheet with 90 different columns. Now we want only 2 of the columns to be uploaded in the database tables. So, Plz tell me which function module will be suitable for this. And plz help me with the code also.
    Thanks,
    Nishant Jain

    Hi Nishu,
    A sample for the same..
    data it_excel like table of ALSMEX_TABLINE with header line.
    here we retrieve only 2 cols directly..
    now itab will contain only 2 cols of all rows seperated by comma ..
    data str(1000).
    data itab like table of str with  header line.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                      = 'C:sample1.xls'
        i_begin_col                   = 1
        i_begin_row                   = 1
        i_end_col                     = 2
        i_end_row                     = 100
      tables
        intern                        =  it_excel
      LOOP AT it_excel.
        AT NEW row.
          CLEAR itab.
        ENDAT.
        IF itab IS INITIAL.
          MOVE it_excel-value TO itab.
        ELSE.
          CONCATENATE itab ',' it_excel-value INTO itab.
        ENDIF.
        AT END OF row.
          APPEND itab.
        ENDAT.
      ENDLOOP.
    regards
    satesh

  • Loading the data from a text file to a table using pl/sql

    Hi Experts,
    I want to load the data from a text (sample1.txt) file to a table using pl/sql
    I have used the below pl/sql code
    declare
    f utl_file.file_type;
    s varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    loop
    utl_file.get_line(f,s);
    insert into sampletable (a,b,c) values (s,s,s);
    c := c + 1;
    end loop;
    exception
    when NO_DATA_FOUND then
    utl_file.fclose(f);
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;
    and my sample1.txt file looks like
    1
    2
    3
    The data is getting inserted, with below manner
    select * from sampletable;
    A     B     C
    1     1     1
    2     2     2
    3     3     3
    I want the data to get inserted as
    A     B     C
    1     2     3
    The text file that I have is having three lines, and each line's first value should go to each column
    Please help...
    Thanks

    declare
    f utl_file.file_type;
    s1 varchar2(200);
    s2 varchar2(200);
    s3 varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    utl_file.get_line(f,s1);
    utl_file.get_line(f,s2);
    utl_file.get_line(f,s3);
    insert into sampletable (a,b,c) values (s1,s2,s3);
    c := c + 1;
    utl_file.fclose(f);
    exception
    when NO_DATA_FOUND then
    if utl_file.is_open(f) then utl_file.fclose(f); ens if;
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;SY.

  • Error when passing data from app server...

    Hello Experts,
    I am encountering an error when trying to pass data from application server
    to my internal table. Below is the error:
    "You cannot convert the character set"
    Hope you can help me guys.Thank you and take care!

    Hi  ,
    ABAP code for uploading a TAB delimited file into an internal table. See code below for structures. The code is base on uploading a simple txt file.
    REPORT  zuploadtab                    .
    PARAMETERS: p_infile  LIKE rlgrap-filename
                            OBLIGATORY DEFAULT  '/usr/sap/'..
    DATA: ld_file LIKE rlgrap-filename.
    *Internal tabe to store upload data
    TYPES: BEGIN OF t_record,
        name1 like pa0002-VORNA,
        name2 like pa0002-name2,
        age   type i,
        END OF t_record.
    DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
          wa_record TYPE t_record.
    *Text version of data table
    TYPES: begin of t_uploadtxt,
      name1(10) type c,
      name2(15) type c,
      age(5)  type c,
    end of t_uploadtxt.
    DATA: wa_uploadtxt TYPE t_uploadtxt.
    *String value to data in initially.
    DATA: wa_string(255) type c.
    constants: con_tab TYPE x VALUE '09'.
    *If you have Unicode check active in program attributes then you will
    *need to declare constants as follows:
    *class cl_abap_char_utilities definition load.
    *constants:
       con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
    *START-OF-SELECTION
    START-OF-SELECTION.
    ld_file = p_infile.
    OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc NE 0.
    ELSE.
      DO.
        CLEAR: wa_string, wa_uploadtxt.
        READ DATASET ld_file INTO wa_string.
        IF sy-subrc NE 0.
          EXIT.
        ELSE.
          SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
                                          wa_uploadtxt-name2
                                          wa_uploadtxt-age.
          MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
          APPEND wa_upload TO it_record.
        ENDIF.
      ENDDO.
      CLOSE DATASET ld_file.
    ENDIF.
    *END-OF-SELECTION
    END-OF-SELECTION.
    *!! Text data is now contained within the internal table IT_RECORD
    Display report data for illustration purposes
      loop at it_record into wa_record.
        write:/     sy-vline,
               (10) wa_record-name1, sy-vline,
               (10) wa_record-name2, sy-vline,
               (10) wa_record-age, sy-vline.
      endloop.
    Reward  points if it is usefull ..
    Girish

  • How to pass data from one internal session to another internal session

    hi all sap experts ,
    How to pass data from one internal session to another internal session and from oneExternal session to another external session.
    Except : Import and Export parameters and SPA/GPA parameters.
    Tell me the otherWay to pass data ..
    Plz
    Thanks in advance

    hi,
      abap memory management u will understand about this concept.
    the import /export parameter will help u that passing data between two internal sessions by using abap memory.
      for syntax
    Passing Data Between Programs
    There are two ways of passing data to a called program:
    Passing Data Using Internal Memory Areas
    There are two cross-program memory areas to which ABAP programs have access (refer to the diagram in Memory Structures of an ABAP Program) that you can use to pass data between programs.
    SAP Memory
    SAP memory is a memory area to which all main sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens (see below).
    ABAP Memory
    ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements. Data within this area remains intact during a whole sequence of program calls. To pass data to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse. For further information, refer to Data Clusters in ABAP Memory.
    Filling Input Fields on an Initial Screen
    Most programs that you call from other programs have their own initial screen that the user must fill with values. For an executable program, this is normally the selection screen. The SUBMIT statement has a series of additions that you can use to fill the input fields of the called program:
    Filling the Selection Screen of a Called Program
    You cannot fill the input fields of a screen using additions in the calling statement. Instead, you can use SPA/GPA parameters. For further information, refer to Filling an Initial Screen Using SPA/GPA Parameters.
    Message was edited by:
            sunil kumar
    Message was edited by:
            sunil kumar

  • How to pass data from one internal session to another

    Hi SAP Experts,
    How to pass data from one internal session to another and from One external session to another external session. I used import and export parmeter and SPA/GPA parameters. What is the other way to pass data?
    Please tel me urgently
    Thank you
    Basu

    Memory Structures of an ABAP Program
    In the Overview of the R/3 Basis System you have seen that each user can open up to six R/3 windows in a single SAPgui session. Each of these windows corresponds to a session on the application server with its own area of shared memory.
    The first application program that you start in a session opens an internal session within the main session. The internal session has a memory area that contains the ABAP program and its associated data. When the program calls external routines (methods, subroutines or function modules) their main program and working data are also loaded into the memory area of the internal session.
    Only one internal session is ever active. If the active application program calls a further application program, the system opens another internal session. Here, there are two possible cases: If the second program does not return control to the calling program when it has finished running, the called program replaces the calling program in the internal session. The contents of the memory of the calling program are deleted. If the second program does return control to the calling program when it has finished running, the session of the called program is not deleted. Instead, it becomes inactive, and its memory contents are placed on a stack.
    The memory area of each session contains an area called ABAP memory. ABAP memory is available to all internal sessions. ABAP programs can use the EXPORT and IMPORT statements to access it. Data within this area remains intact during a whole sequence of program calls. To pass data to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse.
    All ABAP programs can also access the SAP memory. This is a memory area to which all sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters are often used to preassign values to input fields. You can set them individually for users, or globally according to the flow of an application program. SAP memory is the only connection between the different sessions within a SAPgui.
    The following diagram shows how an application program accesses the different areas within shared memory:
    In the diagram, an ABAP program is active in the second internal session of the first main session. It can access the memory of its own internal session, ABAP memory and SAP memory. The program in the first internal session has called the program which is currently active, and its own data is currently inactive on the stack. If the program currently active calls another program but will itself carry on once that program has finished running, the new program will be activated in a third internal session.
    Data Clusters in ABAP Memory
    You can store data clusters in ABAP memory. ABAP memory is a memory area within the internal session (roll area) of an ABAP program and any other program called from it using CALL TRANSACTION or SUBMIT.
    ABAP memory is independent of the ABAP program or program module from which it was generated. In other words, an object saved in ABAP memory can be read from any other ABAP program in the same call chain. ABAP memory is not the same as the cross-transaction global SAP memory. For further information, refer to Passing Data Between Programs.
    This allows you to pass data from one module to another over several levels of the program hierarchy. For example, you can pass data
    From an executable program (report) to another executable program called using SUBMIT.
    From a transaction to an executable program (report).
    Between dialog modules.
    From a program to a function module.
    and so on.
    The contents of the memory are released when you leave the transaction.
    To save data objects in ABAP memory, use the statement EXPORT TO MEMORY.
    Saving Data Objects in Memory
    To read data objects from memory, use the statement IMPORT FROM MEMORY.
    Reading Data Objects from Memory
    To delete data clusters from memory, use the statement FREE MEMORY.
    Deleting Data Clusters from Memory
    please read this which provide more idea about memory
    Message was edited by:
            sunil kumar

  • Read EDI-856 interface data in ABAP program

    HI Experts,
    I have a requirement to read the incomming EDI-856 interface data from ABAP program and generate an IDOC.  I have gone through few EDI-856 documents and theformat in which to read the data .
    Request you to let me know the code logic , function module to use or if  you have any document which can help me in the development.
    Thanks in advance
    Regards
    Santosh

    Please help regarding
    First could you please help me regarding the SCN search option?
    please always try to attempt from your side if not able to solve than search in SDN finally you may land on SDN with thread.

  • Passing data from JAVASCRIPT to SAP database

    Hi Experts,
    Is it possible to connect or access RFC function module through JAVASCRIPT? I want to send data from JAVASCRIPT to SAP database table.
    Is it possible to pass data from JAVASCRIPT to SAP database table?
    Thanks in advance.
    Regards,
    Arindam Samanta.

    OData services can be one option to achieve this.
    Another possibility can be use of Generic REST enablement with SAP NetWeaver Gateway.
    If you are not considering Gateway at all, then  A JSON adapter like the one mentioned in JSON Adapter for ABAP Function Modules can be handy.

Maybe you are looking for

  • Job_queue_processes

    Hi friends I have a BD that it has created several jobs, 5 of which they execute themselves to 1:00am and the parameter job_queue_processes is 1. I see in DBA_JOBS view and apparently executes all jobs without problems and in simultaneous form. i don

  • New iTunes download delets my sound card

    Everytime I try to download the new version of iTunes it delets my sound card. I would return to the older version but off the website all you can download it the newversion and I can no longer find my download disk. ANything I can do to prevent loss

  • Job error (0x80004005) received for assignment

    I have a SP2 client that is failing to download the patch content. The client has been repaired, wmi repository rebuilt,software distribution folder rebuilt, and the sccm client has been uninstalled/reboot/installed. The cache folder is not repopulat

  • Portal Logoff Error

    Hi Folks, Can you please help me on this? When i open the browser and login into the portal and click on the logoff button I am not able to logoff, it just remains on the same screen. The message on the status bar of the browser was "Object Expected"

  • Reset Password Notify altered workflow

    Im trying to alter the Reset User Password workflow to include an email to the user with the new password, however i am having difficulties referencing the variables that contains the new password and the userview in general... Any ideas how to refer