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

how insert data to oracle data base from SAP through procedure

0 Likes
461

hi Experts,

Iam able to insert data from SAP to orcale database table:'MAKT' whicah was created in the orcale with the similar sap fields from SAP as follows:

LOOP AT gt_makt INTO wa_makt.
    EXEC SQL.
      INSERT into makt@VCPD_LINK1
             ( MATNR, SPRAS, MAKTX, MAKTG )
      VALUES ( :wa_makt-matnr, :wa_makt-spras, :wa_makt-maktx, :wa_makt-maktg  )

    ENDEXEC.
    EXEC SQL.
      COMMIT
    ENDEXEC.
   CLEAR wa_makt.
  ENDLOOP.

And now i want to insert data to procedure:'MAKT_DATA'  created in Oracel side as follows:

CREATE OR REPLACE PROCEDURE  MAKT_DATA(

       iMATNR VARCHAR2,

       iSPRAS VARCHAR2,

       iMAKTX VARCHAR2,

       iMAKTG VARCHAR2

    ) AS

  BEGIN

   INSERT INTO MAKT (MATNR, SPRAS, MAKTX, MAKTG)

   VALUES(iMATNR, iSPRAS, iMAKTX, i MAKTG)

   ;

END MAKT_DATA;

please let me know the code to insert the the data from my sap proragm to the above procedure:MAKT_DAT.

Thanks,

Sivagoapl R.

hi Experts,

Iam able to insert data from SAP to orcale database table:'MAKT' whicah was created in the orcale with the similar sap fields from SAP as follows:

LOOP AT gt_makt INTO wa_makt.
    EXEC SQL.
      INSERT into makt@VCPD_LINK1
             ( MATNR, SPRAS, MAKTX, MAKTG )
      VALUES ( :wa_makt-matnr, :wa_makt-spras, :wa_makt-maktx, :wa_makt-maktg  )

    ENDEXEC.
    EXEC SQL.
      COMMIT
    ENDEXEC.
   CLEAR wa_makt.
  ENDLOOP.

And now i want to insert data to procedure:'MAKT_DATA'  created in Oracel side as follows:

CREATE OR REPLACE PROCEDURE  MAKT_DATA(

       iMATNR VARCHAR2,

       iSPRAS VARCHAR2,

       iMAKTX VARCHAR2,

       iMAKTG VARCHAR2

    ) AS

  BEGIN

   INSERT INTO MAKT (MATNR, SPRAS, MAKTX, MAKTG)

   VALUES(iMATNR, iSPRAS, iMAKTX, i MAKTG)

   ;

END MAKT_DATA;

please let me know the code to insert the the data from my sap proragm to the above procedure:MAKT_DAT.

Thanks,

Sivagoapl R.

1 REPLY 1
Read only

Former Member
0 Likes
433

Try following code, if you are connecting to the default underlying database of SAP ECC, try the following code:

LOOP AT gt_makt INTO wa_makt.
    EXEC SQL.
      begin

          MAKT_DATA( :wa_makt-matnr, :wa_makt-spras, :wa_makt-maktx, :wa_makt-maktg );

     end;

    ENDEXEC.
    EXEC SQL.
      COMMIT
    ENDEXEC.
   CLEAR wa_makt.
  ENDLOOP.

if the above code not working try removing begin and end;