Skip to Content
avatar image
-1
Former Member

Select Data from nth row using ABAP

Hello Experts,

My requirement is as follows:

I want to select records from large tables like BSEG etc.

In that case, I want to select only 25000 records at first attempt, do processing on it and then select next 25000 records. this will happen till the last record.

Currently I am using sy-dbcnt variable to do that but it's impacting the performance.

Please suggest if there's any other way to do that.

Regards,

OS

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Jul 17, 2017 at 03:49 PM

    From ABAP 7.51 on, there's an addition OFFSET to SELECT.

    https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abennews-751-open_sql.htm

    Before, the PACKAGE SIZE addition to the INTO clause should also be sufficient.

    https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abapinto_clause.htm

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 17, 2017 at 04:22 PM
    -2

    Hi Onkar,

    Try to avoid to do Select on BSEG Table: For that use BSIK/BSAK for Vendor, BSID/BSAD for Customer and BSIS/BSAD for document details (All Based on Opening or close documents).

    Now, in reference on every 25,0000 documents; previously, you can fill an internal table with 25,0000 records and for each 25,0000 records you can use a LOOP sentences in this way.

    LOOP AT internal_table INTO structure FROM value_from TO value_final.

    ENDLOOP.

    Regards,

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 17, 2017 at 03:47 PM

    Have a look at open cursor/fetch package size. (e.g. at https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abapopen_cursor.htm)

    Add comment
    10|10000 characters needed characters exceeded