09-21-2006 6:58 PM
The system tried to access field "ALL_NINES" with type "C" and length
36 in the current program "ZVADQU01_NEW" using length 40.
Partial field access is not allowed with a length specification that is
larger than actual field length.
CODE EXTRACT:
DATA: index LIKE sy-index,
f_type(1),
length TYPE i,
all_nines(36) VALUE '99999999999999999999'.
FIELD-SYMBOLS: <fsin>,
<fsout>,
<fieldname>.
DO.
index = index
+ 1.
ASSIGN COMPONENT index OF STRUCTURE inrec
TO <fsin>.
ASSIGN COMPONENT index OF STRUCTURE outrec
TO <fsout>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
IF <fsin> <> space.
MOVE <fsin> TO <fsout>.
ELSE.
DESCRIBE FIELD <fsout> TYPE f_type.
IF f_type = 'C'.
MOVE 'ZZZZZZZZZZZZZZZZZZ' TO <fsout>.
ELSEIF f_type = 'N'.
DESCRIBE FIELD <fsout> LENGTH length in byte mode.
ERROR OCCURED HERE****
MOVE all_nines(length) TO <fsout>.
ENDIF.
ENDIF.
ENDDO.
09-21-2006 7:03 PM
Hi Joseph,
What is the size of OUTREC structure in your report.
If size of OUTREC is less than size of ALL_NINES then your MOVE statement will work, otherwise change the length of ALL_NINES to size of OUTREC.
all_nines(X) VALUE '99999999999999999999'.
X - needs to be length of OUTREC.
Thanks,
Vinay
09-21-2006 7:09 PM
09-21-2006 7:22 PM
I am not able to recreate your problem, this code works good for me.
report zrich_0002 .
data: begin of outrec,
fld1(18) type c,
fld2(10) type n,
fld3(18) type c,
fld4(10) type n,
end of outrec.
field-symbols: <fs>.
data: f_type,
length type i,
all_nines(20) type c value '99999999999999999999'.
outrec-fld1 = 'ABCDEFGHIJKLMNOPQR'.
outrec-fld2 = '1234567890'.
outrec-fld3 = 'ABCDEFGHIJKLMNOPQR'.
outrec-fld4 = '1234567890'.
do.
assign component sy-index of structure outrec to <fs>.
if sy-subrc <> 0.
exit.
endif.
describe field <fs> type f_type.
if f_type = 'C'.
move 'ZZZZZZZZZZZZZZZZZZ' to <fs>.
elseif f_type = 'N'.
describe field <fs> length length .
move all_nines(length) to <fs>.
endif.
write:/ <fs>.
enddo.
Regards,
Rich Heilman
09-21-2006 7:24 PM
hi rich,
this error occure when copying code frm 4.5 to 5 and tried to run it..
09-21-2006 7:32 PM
This even works in my nw2004s system.
report zrich_0003.
data: begin of outrec,
fld1(18) type c,
fld2(10) type n,
fld3(18) type c,
fld4(10) type n,
end of outrec.
field-symbols: <fs>.
data: f_type,
length type i,
all_nines(20) type c value '99999999999999999999'.
outrec-fld1 = 'ABCDEFGHIJKLMNOPQR'.
outrec-fld2 = '1234567890'.
outrec-fld3 = 'ABCDEFGHIJKLMNOPQR'.
outrec-fld4 = '1234567890'.
do.
assign component sy-index of structure outrec to <fs>.
if sy-subrc <> 0.
exit.
endif.
describe field <fs> type f_type.
if f_type = 'C'.
move 'ZZZZZZZZZZZZZZZZZZ' to <fs>.
elseif f_type = 'N'.
describe field <fs> length length <b>in BYTE MODE</b> .
move all_nines(length) to <fs>.
endif.
write:/ <fs>.
enddo.
Then only thing I changed was to add the IN BYTE MODE.
Regards,
Rich Heilman
09-21-2006 7:35 PM
Oh, wait a minute, it would help if I actually read your error message. I think the problem is that you are trying to access the field when the field symbols length is greater than 36. You need to increase the length of ALL_NINES. Make it like 50.
all_nines(50) VALUE '9999999999999999999999999999999999'.
Regards,
Rich Heilman