07-12-2007 3:36 PM
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.
07-12-2007 3:46 PM
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.
07-12-2007 3:46 PM
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.
07-12-2007 3:46 PM
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
07-12-2007 3:49 PM
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
07-12-2007 3:51 PM
Hi,
Whats your structure here.is your structure is dynamic?Explain it in detail.
07-12-2007 3:56 PM
Hi,
Change this line
write <fs4> to v_konwa .
write <fs3> to v_kmein..
write <fs2> to v_kpein.
aRs
07-12-2007 4:00 PM
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.
07-12-2007 4:20 PM
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>