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: 

Dynamic Assign Statement is not working in 4.6C

Former Member
0 Kudos

Hi Team,

I have done the following coding to get teh dynamic value sof a field but the assign statement is failing... Its returing the sy-subrc as 4.

LOOP AT <t_tab> INTO <s_tab>.

LOOP AT t_flds.

CONCATENATE '<s_tab>-' t_flds-fieldname INTO v_fldval.

ASSIGN (v_fldval) TO <fldval>.

endloop

endloop.

Appericiate your suggestions.

Thnx,

Ankur..

3 REPLIES 3

former_member181995
Active Contributor
0 Kudos

Are the structure lenght for both (v_fldval) and <fldval> is Same?

F1 help od "Assign" says:

The assigned memory area mem_area must be at least as long as the data type specified in casting_spec and must have the same alignment.

0 Kudos

Hi Amit,

Thanks for your update .. My situation is as follows...

Data: v_fldval Type Fieldnam

Field-symbols: <fldval> type any

The variable will be any field name like(i_mara-matnr/i_bseg-belnr) the assin statement should assign the value of the row to the field symbol.. but its givign subrc as 4.

Appreciate your ur help.

Thanks,

Anjan...

Former Member
0 Kudos

Hi Ankur,

I am facing the same problem.........wit no solution in hand, cud u plz let me knw if u have got some solution over this.....

The problem occurs, maybe because the internal table field symbol <t_tab> (and hence <s_tab>) does not contain the fieldname for which u r tryin to get the value in <v_fldval>

Is there a way to chk if a particular fieldname exists in the <t_tab>, so tht if v dont get it, we wud avoid the ASSIGN statement, so tht v dont get a dump

Appreciate ur inputs.....

Regards,

Aparna.