Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with field assign

former_member622551
Participant
0 Kudos

Hello Guys;

i have a table with two fields, one have data of fields names and the other contains the values of this fields. For example,

ztable-field = ekpo-ebeln

ztable-value = 0000001

I need to assign this value to the field (that means ekpo-ebeln = 0000001), does anyone know how can i do it?

Thank you very much.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

The first step u need to create or have a workare just like the table in the field ZTABLE-FIELD:

DATA MY_WORKARE TYPE REF TO DATA.
DATA MY_TAB(30) TYPE C.
DATA MY_FIELD(30) TYPE C.

SPLIT ZTABLE-FIELD AT '-' INTO MY_TAB MY_FIELD.

CREATE DATA MY_WORKAREA TYPE (MY_TAB).

Now u can assign the value

FIELD-SYMBOLS: <FS_TAB> TYPE ANY.
FIELD-SYMBOLS: <FS_FIELD> TYPE ANY.

ASSIGN MY_WORKAREA->* TO <FS_TAB>.
ASSIGN COMPONENT MY_FIELD OF STRUCTURE <FS_TAB> TO <FS_FIELD>.
<FS_FIELD> = ZTABLE-VALUE.

Else if u have deafine a workare by statamanet TABLES:

.

ASSIGN (ZTABLE-FIELD) TO <FS_FIELD>.
<FS_FIELD> = ZTABLE-VALUE..

Max

1 REPLY 1

Former Member
0 Kudos

Hi

The first step u need to create or have a workare just like the table in the field ZTABLE-FIELD:

DATA MY_WORKARE TYPE REF TO DATA.
DATA MY_TAB(30) TYPE C.
DATA MY_FIELD(30) TYPE C.

SPLIT ZTABLE-FIELD AT '-' INTO MY_TAB MY_FIELD.

CREATE DATA MY_WORKAREA TYPE (MY_TAB).

Now u can assign the value

FIELD-SYMBOLS: <FS_TAB> TYPE ANY.
FIELD-SYMBOLS: <FS_FIELD> TYPE ANY.

ASSIGN MY_WORKAREA->* TO <FS_TAB>.
ASSIGN COMPONENT MY_FIELD OF STRUCTURE <FS_TAB> TO <FS_FIELD>.
<FS_FIELD> = ZTABLE-VALUE.

Else if u have deafine a workare by statamanet TABLES:

.

ASSIGN (ZTABLE-FIELD) TO <FS_FIELD>.
<FS_FIELD> = ZTABLE-VALUE..

Max