Skip to content

Instantly share code, notes, and snippets.

@dantesco
Last active December 30, 2015 04:59
Show Gist options
  • Save dantesco/7779592 to your computer and use it in GitHub Desktop.
Save dantesco/7779592 to your computer and use it in GitHub Desktop.
Obten informacion de tablas por paquetes para no sobrecagar la memoria disponible de itabs
OPEN DATASET <file name> FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
OPEN CURSOR l_c1 FOR SELECT * FROM <table NAME>.
WHILE l_c1 IS NOT INITIAL.
FETCH NEXT CURSOR l_c1 INTO TABLE <internal table> PACKAGE SIZE p_pkg.
* p_pkg is the maximum number of records to be fetched every time.
IF sy-subrc EQ 0.
LOOP AT <internal table> INTO <work area>.
TRANSFER <work area> TO <file name>.
ENDLOOP.
ELSE.
CLOSE CURSOR l_c1.
ENDIF.
ENDWHILE.
CLOSE DATASET <file name>.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment