Skip to Content
2
Former Member
Jan 03, 2007 at 06:21 PM

Dynamic assignment of field in a Structure

5254 Views

Hello there,

i'm looking for a solution of the following Problem:

I have a structure STRUC with several fields e.g. Name, Street, City

In my program i get dynamically the fieldname and the corresponding value.

With these information i like to do the following assignment:

STRUC-<fieldname> = 'Hello world'. (which is not working in ABAP)

How can i do an assignment like this? I only found a way to read colums dynamically from a structure but not the oppside way.

ASSIGN COMPONENT <fieldname> of structure <STRUC> to <fieldvalue>.

I need something like this

ASSIGN <fieldvalue> to COMPONENT <comp> of structure <STRUC>.

Does anybody has an idea?

Many thanks in advance!

Josef