2014 May 09 10:26 AM
Hello
I have a field symbol
field-symbols:<wf_file> TYPE any. ,and the table WT_file like alsmex_tabline
(data : WT_file like alsmex_tabline occurs ) the field wt_file-value is of type CHAR 50 .
Later in a code i have loop in the table wt_file moving the values to field symbol
at the moment when wt_file-value = /1.3831 I have short dump because of the conversion issue .
Bach slash is there because later is used as operand for division with 1.3831.
I am surprised because field symbol is declared as TYPE ANY .
Could i solve it if i declare field simbol as the same type as the table wt_file is ?
Thanks
Krsto
LOOP AT wt_file.
wv_cnt = wt_file-col.
CONCATENATE 'WT_FINAL-FLD' wv_cnt INTO wlv_name.
ASSIGN (wlv_name) TO <wf_file>.
MOVE : wt_file-value TO <wf_file>. " short dump when /1.3831
AT END OF row.
APPEND wt_final.
CLEAR wt_final.
CLEAR wv_cnt.
ENDAT.
ENDLOOP.
2014 May 09 10:57 AM
Hi Krsto,
Can you try by ASSIGN statment instead of moving the value. It shoudl work.
2014 May 09 10:50 AM
Hi Krsto,
You should :
CONCATENATE 'FLD' wv_cnt INTO wlv_name.
ASSIGN COMPONENT wlv_name OF STRUCTURE wt_final TO <wf_file>.
regards,
Archer
2014 May 09 10:57 AM
ASSIGN (wlv_name) TO <wf_file>.
MOVE : wt_file-value TO <wf_file>. " short dump when /1.3831 You should always check if the assignment is successful by checking the SY-SUBRC (or IS ASSIGNED, my personal choice).
BR,
Suhas
2014 May 09 12:49 PM
2014 May 09 1:06 PM
Please read the post before posting a solution. The problem says:
" short dump when /1.3831
In the code there was no check after the ASSIGN statement that's what i was pointing out.
2014 May 09 1:19 PM
I prefer to check sy-subrc. Semantically IS ASSIGNED would be better, but consider:
ASSIGN (this) TO <fs>.
....
ASSIGN (that) TO <fs>. <------------ this could fail
IF <fs> IS ASSIGNED. <--------- but if the first one assign worked, then this will be true
do stuff.
ENDIF.
2014 May 09 1:22 PM
2014 May 09 1:33 PM
Valid point, but i have this habit of UNASSIGNing the field-symbol before every assignment (maybe an overkill)
ASSIGN (this) TO <fs>.
....
UNASSIGN <fs>. <------- Unassign the FS
ASSIGN (that) TO <fs>. <------------ this could fail
IF <fs> IS ASSIGNED. <--------- but if the first one assign worked, then this will be true
do stuff.
ENDIF.
2014 May 09 1:45 PM
I definitely think sy-subrc is more useful. Anyway Krsto assigned some points to himself so I think he finally understood his error.
2014 May 09 2:27 PM
Fortunately you cannot assign points to yourself, as this would result in SY-SUBRC = 4 or even a non-catchable IMMODEST_BEHAVIOUR short dump.
Thomas
2014 May 09 10:57 AM
Hi Krsto,
Can you try by ASSIGN statment instead of moving the value. It shoudl work.
2014 May 09 10:58 AM
Hi Krsto,
it won't be of type any after the assign, so what type was field wt_final-fld... at the moment of short dump and what value was in wt_file-value?
regards,
Edgar
2014 May 09 11:31 AM
2014 May 09 11:45 AM
Ok but what type is variable wt_final-fld?
If it's a numeric type then your dump is normal.
Again, your field symbol is NOT of type any at the dump moment.
2014 May 09 11:50 AM
2014 May 09 11:55 AM
Hi
If you are using same field symbol in two places, did you un assign first after the use.
The issue may be due to that. Just athought.
Regards
Sree
2014 May 09 12:01 PM
That's irrelevant Krsto,
It's when you assign the variable that you typify it:
ASSIGN (wlv_name) TO <wf_file>.
In this moment wlv_name is the name of the variable 'WT_FINAL-FLD' and some number.
What type is this variable? It's not the same as WT_FINAL-VALUE.
Regards,
Edgar
2014 May 09 12:55 PM
Have you declared the field symbol <wf_file> with TYPE ANY or any numeric data type?
It probably got type casted to Numeric and thats why it cannot accept a character one (due to the slash /) now.
2014 May 09 3:14 PM
2014 May 09 3:17 PM
Hi ,
Not yet , I sent proposal . The program is not in my ownership. I will let you know .
Thanks