0 Replies Latest reply: Nov 19, 2012 6:07 AM by user613681 RSS

    tracing queries from abap to a custom database via dblink

    user613681
      I' m connecting to a database by dblink (name magiap).
      I would like to know if somewhere I can trace all the queries from abap to oracle in this specific session , to dbs ='MAGIAP'.
      For istance, i would like that the query "SELECT "DESPARTY1"

      into :v_DESPARTY1

      FROM "T040PARTY"

      WHERE "CODPARTY" = '305142941' will be stored some where (in a file??).
      I would like that parameters - w_CODPARTY- will be substituted and stored in the trace file with the value (305142941), as shown in the previous
      Here is the piece of code ..(a very short example of course)..

      DATA : dbs LIKE dbcon-con_name,

      v_CODPARTY(15),
      v_DESPARTY1(60).


      data : w_CODPARTY(15) value '305142941'.



      dbs = 'MAGIAP'.
      TRY.



      EXEC SQL.

      CONNECT TO :dbs

      ENDEXEC.

      IF sy-subrc <> 0.

      EXEC SQL.

      CONNECT TO :dbs

      ENDEXEC.

      ENDIF.



      IF sy-subrc <> 0.
      * RAISE err_conn_aea.

      ENDIF.



      EXEC SQL.

      set connection :dbs

      ENDEXEC.





      EXEC SQL .



      SELECT "DESPARTY1"

      into :v_DESPARTY1

      FROM "T040PARTY"

      WHERE "CODPARTY" = :w_CODPARTY



      ENDEXEC.



      IF sy-subrc NE 0.
      * rc = 4.

      ENDIF.



      EXEC SQL.

      DISCONNECT :dbs

      ENDEXEC.


      ENDTRY.