Skip to Content
0
Former Member
Apr 14, 2010 at 03:42 PM

EXEC SQL: Internal table and loop needed to push records from SAP?

476 Views

Hello,

I have a requirement to perform a table extract from SAP to External Database using DBCO config and Native SQL. The source system is Oracle ECC 6.0 and the target is an external MS SQL Server database (non-SAP).

Technical questions:

1) Do you have to use an internal table and loop to insert each record into the external database? Is it possible to pass an entire table or group of records in one call?

2) See any places for optimization here? I will look into using the PACKAGE SIZE to control the size of the internal tables, but it appears the bottleneck is the loop.

*Get source data and insert into ITAB

SELECT  *
  INTO TABLE lt_jest
  FROM jest.

*?????????????????????????????????????????????????????????????*
* #### IS IT POSSIBLE TO NOT LOOP OVER EACH RECORD HERE? #### *
*?????????????????????????????????????????????????????????????*

*Loop at ITAB and insert into SQL Server one record at a time

  LOOP AT lt_jest ASSIGNING <FS>.
    EXEC SQL.
      INSERT INTO [dbo].[JEST]
       VALUES (:<FS>-MANDT,:<FS>-OBJNR,:<FS>-STAT,:<FS>-INACT,:<FS>-CHGNR);
        commit;
    ENDEXEC.
  ENDLOOP.