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: 

fieldsymbols

Former Member
0 Kudos

Hi experts,

I am working with fieldsymbols and very new to the concept.

Can anybody tell me whether there is something wrong with the code. Its giving dump. Where am I wrong here?

form gather_cond_data using p_wa_pr_cond type type_pr_cond

value(p_1524)

p_prp_prod_i_ref_guid

changing p_wa_cond_data.

data: v_field1(40) type c,

v_field2(40) type c,

v_field3(40) type c,

v_field4(40) type c,

v_field5(40) type c.

data: v_konwa(10) type c,

v_kmein_670(10) type c,

v_kpein_670(10) type c.

data: v_kpein(10) type c,

v_kmein(10) type c.

data: ev_output_qty type CMST_QUANTITY_UNIT.

field-symbols:<fs1> type any,

<fs2> type any,

<fs3> type any,

<fs4> type any,

<fs5> type any.

concatenate 'KBETR' p_1524 into v_field1.

assign component v_field1 of structure p_wa_pr_cond to <fs1>.

concatenate 'KPEIN' p_1524 into v_field2.

assign component v_field2 of structure p_wa_pr_cond to <fs2>.

concatenate 'KMEIN' p_1524 into v_field3.

assign component v_field3 of structure p_wa_pr_cond to <fs3>.

concatenate 'KONWA' p_1524 into v_field4.

assign component v_field4 of structure p_wa_pr_cond to <fs4>.

concatenate 'KRECH' p_1524 into v_field5.

assign component v_field5 of structure p_wa_pr_cond to <fs5>.

*Comparison at record level

if p_1524 CS 'YMP0'.

clear: v_konwa, v_kpein, v_kmein.

v_konwa = <fs4>. " Giving dump here

v_kmein_670 = <fs3>.

v_kpein_670 = <fs2>.

elseif p_1524 NS 'YMP0'.

clear v_field4.

concatenate 'KONWA' p_1524 into v_field4.

assign component v_field4 of structure p_wa_pr_cond to <fs4>.

My objective is to take the values from one of the field in the structure and put it in a field symbol.

How to go about it?

How is assignment done in field-symbol?

Thanks in advance,

Sangeeta.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Change your code to do this instead....

concatenate 'KBETR' p_1524 into v_field1.

assign component (v_field1) of structure p_wa_pr_cond to <fs1>.

and so on.

7 REPLIES 7

Former Member
0 Kudos

Change your code to do this instead....

concatenate 'KBETR' p_1524 into v_field1.

assign component (v_field1) of structure p_wa_pr_cond to <fs1>.

and so on.

LeonardoAraujo
Active Contributor
0 Kudos

I think you should validate if you result of each assign statement below:

assign component v_field2 of structure p_wa_pr_cond to <fs2....

You may be concatenating in a way that you dont have the field in the structure P_WA_PR_COND so the assign fails, leaving the field-symbol unassigned.

If afterwards you us the field for comparison (like you do) and the field is not assigned you get a DUMP.

Hope it helps,

Leonardo De Araujo

Former Member
0 Kudos

Hello,

What is the value that is transferred via p_1524 ?

Is the result of your concatenate really a fieldname of stucture p_wa_pr_cond ?

Which dump do you get ?

regards,

Philippe

Former Member
0 Kudos

Hi,

Whats your structure here.is your structure is dynamic?Explain it in detail.

former_member194669
Active Contributor
0 Kudos

Hi,

Change this line


write <fs4> to v_konwa . 
write <fs3> to v_kmein..
write <fs2> to v_kpein.

aRs

Former Member
0 Kudos

The field symbol has nothing assigned to it.

You can do this

IF <fs4> IS ASSIGNED.

...

ENDIF.

However you need to change to the following code

concatenate 'KONWA' p_1524 into v_field4.

assign component (v_field4) of structure p_wa_pr_cond to <fs4>.

Note the addition of the brackets.

Former Member
0 Kudos

Hi Sangeeta,

You had just assigned an address to the field-symbols, you need to populate those values also

concatenate 'KBETR' p_1524 into v_field1.

assign component v_field1 of structure p_wa_pr_cond to <fs1>.

<b><fs1> = 'XXXXXX'.</b>

concatenate 'KPEIN' p_1524 into v_field2.

assign component v_field2 of structure p_wa_pr_cond to <fs2>.

<b><fs2> = 'YYYYY'.</b>