Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2794

Re: Select 1000 rows each time program starts

$
0
0

I had the same requirement, like send 200 records at a time via proxy to SQL DB.

 

1. After select Query, get total no of records in final output ITAB.

 

2. define index_low , index_high.

 

3. create one more temp. table and store itab data to temp itab.

 

   itab_temp[] = itab[].

 

4.process as below.

 

*Sample code

 

 

 

   DESCRIBE TABLE LT_ITAB[] LINES LV_LINES.

 

   IF LV_LINES > 200.

 

     WHILE LV_LINES > 200.

 

       LV_COUNT = LV_COUNT + 200.

 

      APPEND LINES OF LT_ITAB[] FROM LV_INDEX_LOW TO LV_COUNT TO LT_ITAB_TEMP[].

 

 

       TRY.

 

           CALL METHOD LR_PROXY->SI_PROXY

             EXPORTING

               OUTPUT = LT_OUTPUT.

 

           COMMIT WORK.

           wait UP TO 10 SECONDS.

       ENDTRY.

 

       LV_INDEX_LOW = LV_INDEX_LOW + 200.

       LV_LINES = LV_LINES - 200.

 

       REFRESH LT_RECORD_TEMP[].

 

     ENDWHILE.

 

*==========Push the rest of data which are less than 200===================*

 

     IF LV_LINES NE 0 AND LV_LINES <= 200.

 

       REFRESH LT_TEMP[].

 

       LV_COUNT = LV_COUNT + 200.

 

     APPEND LINES OF LT_ITAB[] FROM LV_INDEX_LOW TO LV_COUNT TO LT_ITAB_TEMP[].

 

       LT_OUTPUT-MT_PROXY-RECORD = LT_ITAB_TEMP[].

 

       TRY.

 

           CALL METHOD LR_PROXY->SI_PROXY

             EXPORTING

               OUTPUT = LT_OUTPUT.

 

           COMMIT WORK.

           wait UP TO 10 SECONDS.

       ENDTRY.

     ENDIF.

 

   ELSE.

 

** If the number of records less than 200

 

     LT_OUTPUT-MT_PROXY-RECORD = LT_ITAB[].

 

     TRY.

 

         CALL METHOD LR_PROXY->SI_PROXY

           EXPORTING

             OUTPUT = LT_OUTPUT.

 

         COMMIT WORK.

         wait UP TO 10 SECONDS.

     ENDTRY.

    ENDIF.

   ENDIF.

ENDIF.

 

NOTE: This logic is for Pushing data in form of checks of data via PI proxy.

 

Pl modify the logic as per your requirement.

 

Regds,

Lokes.


Viewing all articles
Browse latest Browse all 2794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>