2008 Jun 17 9:33 AM
i recorded a batch input for transaction SM30 - just simply entering data,pressing 'save' and thats all...
afterwards i created a program using this record. it runs fine with the values i entered originally.
now i modified the program so that it runs in a loop, replacing my original values with the data structures corresponding fields.
for fields with type character it works fine. But when i run the program with numerical data fields in my table (and of course the table-field i want to enter it is also numerical) i receive a CONVT_NO_NUMBER error which comes from the 2nd line of this:
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> NODATA.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.
this method was created by my record,i didnt change it...
so my question finally is: is there any -smart- other way to replace it other than:
FORM BDCFIELD USING FNAM FVAL.
data _fval(255) type c.
_fval = fval.
IF _FVAL <> NODATA.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.
2008 Jun 17 9:43 AM
Why don't u move ur numerical data into a char field before doing the further processing?
data: l_char type c length ....
l_num type i.
l_char = l_num.
perform BDC_FIELD XXXX l_char.
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL NODATA.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.
Regards,
Joy.
2008 Jun 17 9:58 AM
Joyjit Ghosh:
thats exactly what my workaround is doing, just you do it outside the method and i do it inside for just defining it once (but needing to change the method's name everywhere).
i wouldnt prefer one of those two 'workarounds' to the other but i thought there was some mistake in my program or things i didnt consider or maybe a smarter solution....
(if i, btw when running the program choose a nodata-sign 0 instead of / it doesnt give the error,of course)