/AbapCharacteristics

Dynamically add characteristics to internal table by customizing

Primary LanguageABAP

AbapCharacteristics

Dynamically add characteristics to internal table by customizing

Tables structure

I created 2 tables, header and item

ZXXT001 ->Header

MANDT
PROGRAMNAME

ZXXT002 --> Item

MANDT
PROGRAMNAME
ATINN

ZXXT002_V --> And I Created Maintance view Join with cabn and cabnt tables

MANDT
PROGRAMNAME
ATINN
ATFOR
ANZST
ANZDZ
ATBEZ

Cluster view

alt text alt text

Code Sample

 "Get Any data
 DATA(lt_stock) = cl_businessLayer=>if_stock~get_data( parameters = parameters ).
 "Add Characteristics dynamicall
 DATA(Result) = zcl_sd_characteristics=>add_characteristics( EXPORTING table  = REF #( lt_stock )
                                                              programname = 'ZSD_R_STOCK'
                                                             IMPORTING fieldcatalog = Fieldcatalog
                                                            ).
  "All characteristics in the customization table dynamically added
  ASSIGN Result->* TO FIELD-SYMBOL(<Table>).