Saturday 15 September 2012

sap - ABAP: Move fields from table to local table based on structure -



sap - ABAP: Move fields from table to local table based on structure -

i customized table knvv. append construction includes construction defined custom fields. lets phone call zz_knvv_app_s.

a function pool, used , set custom fields, has function called zsd_foo_get_data. exporting construction es_knvv type knvv.

my current solution works, kind of stupid:

function zsd_foo_get_data. *"---------------------------------------------------------------------- *"*"lokale schnittstelle: *" exporting *" reference(es_knvv) type knvv *"---------------------------------------------------------------------- es_knvv-zzfoo = knvv-zzfoo. es_knvv-zzbar = knvv-zzbar. es_knvv-zzbaz = knvv-zzbaz. " there many more fields... endfunction.

what looking that:

loop through knvv assign custom fields defined in dictionary construction zz_knvv_aps_s... ... knvv es_knvv something similary required zsd_foo_get_data

i kind of new abap. think looping , field symbols, cant right. how solve it?

you seek utilize named include:

create construction - let's zz_my_knvv_fields knvv has append construction zz_knvv_app_s zz_knvv_app_s has single entry .include zz_my_knvv_fields grouping name zz_my_fields same other output structure

you can address of fields using knvv-zz_my_fields construction of type zz_my_knvv_fields

sap dynamic-programming abap

No comments:

Post a Comment