Application Development and Automation 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: 
Read only

Dynamic filed value Population

Former Member
0 Likes
642

Hi All,

I have a below requirment:

A workarea e_final has different fields populated such as MATNR/VKORG/VTWEG etc.

A Internal table is_dfies which holds the key fileds of any table.

Now I want to concatenate the the value from e_final for the fields in is_dfies in to a variable filed.

Could you please suggest how to achive this.

Regards,

Ravi Kasnale

Moderator message: Please do some research before posting

Message was edited by: Kesavadas Thekkillath

Hi All,

I have a below requirment:

A workarea e_final has different fields populated such as MATNR/VKORG/VTWEG etc.

A Internal table is_dfies which holds the key fileds of any table.

Now I want to concatenate the the value from e_final for the fields in is_dfies in to a variable filed.

Could you please suggest how to achive this.

Regards,

Ravi Kasnale

Moderator message: Please do some research before posting

Message was edited by: Kesavadas Thekkillath

3 REPLIES 3
Read only

tolga_polat
Active Participant
0 Likes
586

Hi,

I think that is what you need:

FIELD-SYMBOLS : <value> type any.

loop at is_dfies

     into ls_dfies.

ASSIGN COMPONENT ls_dfies-fieldname OF STRUCTURE e_final TO <value>.

IF sy-subrc EQ 0.

CONCATENATE lv_variable <value> INTO lv_variable.

CONDENSE lv_variable.

UNASSIGN <value>.

ENDIF.

endloop.

Regards

Read only

RaymondGiuseppi
Active Contributor
0 Likes
586

Jusr use an ASSIGN COMPONENT dfies-fieldname OF STRUCTURE e_final syntax, use the field name from dfies in a LOOP.

Regards,

RAymond

Read only

Former Member
0 Likes
586

Hi Ravi,

From your requirement what I understood is, the output should be like <key_field_name> = <value_of_that_field>.

Here's the code for this:

FIELD_SYMBOL:

    <fs_value> TYPE any.

LOOP AT is_dfies INTO wa_dfies.

   ASSIGN COMPONENT wa_dfies OF STRUCTURE e_final TO <fs_value>.

   IF sy-subrc = 0.

      CONCATENATE is_dfies-fieldname '=' <fs_value> INTO lv_variable SEPEARTED BY space.

   ENDIF.

ENDLOOP.