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:
I am kind of new to ABAP. I think about looping and field symbols, but cant get it right. How would you solve it?
You could try to use a named include:
ZZ_MY_KNVV_FIELDS
ZZ_KNVV_APP_S
ZZ_KNVV_APP_S
has a single entry .INCLUDE
ZZ_MY_KNVV_FIELDS
with a group name ZZ_MY_FIELDS
You can then address all of your fields using KNVV-ZZ_MY_FIELDS
as a structure of type ZZ_MY_KNVV_FIELDS