I customized the table KNVV. The append structure includes a structure where I actually defined all my custom fields. Lets call it zz_knvv_app_s.
A function pool, used to get and set the custom fields, has a function called ZSD_FOO_GET_DATA. It is exporting structure es_knvv TYPE knvv.
My current solution works, but is 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 are actually many more fields...
ENDFUNCTION.
What I am looking for is something like that:
- loop through KNVV
- assign the custom fields that are defined in my dictionary structure zz_knvv_aps_s...
- ... from KNVV to ES_KNVV
- something similary is also required for ZSD_FOO_GET_DATA
I am kind of new to ABAP. I think about looping and field symbols, but cant get it right. How would you solve it?