FUNCTION zcreate_range.
*"----------------------------------------------------------------------
*"*"Interface locale :
*" IMPORTING
*" REFERENCE(I_FIELDNAME) TYPE CHAR30
*" TABLES
*" IT_TABLE
*" ET_RANGE
*"----------------------------------------------------------------------
************************************************************************
* Description : A module function capable of building a range from *
* any table !!! *
************************************************************************
FIELD-SYMBOLS : <ls_value> TYPE any,
<fieldname> TYPE any,
<ls_range> TYPE any,
<lit_range> TYPE STANDARD TABLE,
<ls_table> TYPE any.
ASSIGN i_fieldname TO <fieldname>.
ASSIGN et_range[] TO <lit_range>[].
ASSIGN et_range TO <ls_range>.
LOOP AT it_table ASSIGNING <ls_table>.
ASSIGN COMPONENT <fieldname> OF STRUCTURE <ls_table> TO <ls_value>.
<ls_range>(3) = 'IEQ'.
<ls_range>+3 = <ls_value>.
APPEND <ls_range> TO <lit_range>.
ENDLOOP.
SORT <lit_range>.
DELETE ADJACENT DUPLICATES FROM <lit_range>.
ENDFUNCTION.
abap
<iframe width="100%" height="812" src="http://ginkobox.fr/vamp/index.php?embed=55f19a2b6623c" type="text/html"></iframe>
Text only - Permalink - Snippet public post date 10/09/2015