User Tools

Site Tools


abap:toolbox

ABAP Toolbox

Création dynamique de range

FUNCTION zcreate_range.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(I_FIELDNAME) TYPE  CHAR30
*"  TABLES
*"      IT_TABLE
*"      ET_RANGE
*"----------------------------------------------------------------------
************************************************************************
* Description : A module function capable of building a range from     *
* any table !!!                                                        *
************************************************************************
*                      Modification  history                           *
*----------------------------------------------------------------------*
* modif id   Author       Date     Modification description            *
* M001                                                                 *
*----------------------------------------------------------------------*
************************************************************************
 
  FIELD-SYMBOLS : <ls_value> TYPE any,
                  <fieldname> TYPE any,
                  <ls_range> TYPE any,
                  <lit_range> TYPE STANDARD TABLE.
 
ASSIGN i_fieldname TO <fieldname>.
ASSIGN et_range[] TO <lit_range>[].
 
LOOP AT it_table ASSIGNING FIELD-SYMBOL(<ls_table>).
  ASSIGN COMPONENT <fieldname> OF STRUCTURE <ls_table> TO <ls_value>.
  CONCATENATE 'IEQ' <ls_value> INTO <ls_value>.
  APPEND <ls_value> TO  <lit_range>.
ENDLOOP.
 
ENDFUNCTION.
abap/toolbox.txt · Last modified: 2014/12/05 17:08 by ginko