‎2005 Nov 29 8:53 PM
Hi,
whats the function to convert a numeric data to char ??
I have a field value which is numeric and when I use it in my BDC program I get a runtime error
CONVT_NO_NUMBER
Unable to interpret "/" as a number.
On debugging, I could see in the code that NODATA is represented as "/" and when it is being compared with my numeric field data, this mismatch is reported. So I think it would be right for me to pass on the value after conversion. the statement currently looks like
perform bdc_field using 'RF022-GJAHR'
bkpf_rec-gjahr.
where gjahr contains data such as 2004, 2005 etc.
Please help..
thanks
‎2005 Nov 29 9:54 PM
Hi,
I think see your question you need to pass the date field in character
BKPF_REC-GJAHR
So first declare
Data : v_gjahr(10) type c.
Write BKPF_REC-GJAHR to v_gjahr.
perform bdc_field using 'RF022-GJAHR'
v_gjahr.
Also remove the code perform bdc_field using 'BDC_CURSOR'
'19/07'. That is not required.
Hope this will help you.
Thanks
Rajeev
‎2005 Nov 29 8:56 PM
Hi,
Pass space instead of '/'.I guess it will work.
‎2005 Nov 29 8:57 PM
Check to make sure that in your file the "/" is not being shifted to the right " /".
Rob
‎2005 Nov 29 9:04 PM
Thanks to all for your quick response... Find below my code.. I have recorded BDC for FB12 and pasted that code in my report program, ZFB12 and so the entire code is as follows...
i am getting error for the last but one line , i.e.,
perform bdc_field using 'RF022-GJAHR'
bkpf_rec-gjahr.
i dont find any means to pass SPACE !! how do i do that ??
-
REPORT ZFB12TEST.
TABLES: BKPF.
DATA: BEGIN OF bkpf_rec OCCURS 0,
bukrs LIKE BKPF-BUKRS,
blart LIKE BKPF-BLART,
cpudt LIKE BKPF-CPUDT,
budat LIKE BKPF-budat,
belnr LIKE BKPF-BELNR,
gjahr LIKE BKPF-GJAHR,
END OF bkpf_rec.
SELECT-OPTIONS: so_bukrs FOR BKPF-BUKRS,
so_blart FOR BKPF-BLART,
so_cpudt FOR BKPF-CPUDT,
so_budat FOR BKPF-budat,
so_belnr FOR BKPF-BELNR,
so_gjahr FOR BKPF-GJAHR.
include bdcrecx1.
start-of-selection.
SELECT bukrs blart cpudt budat belnr gjahr into table bkpf_rec from bkpf
where bukrs IN
so_bukrs and blart in so_blart and cpudt in so_cpudt and budat in
so_budat and belnr in so_belnr and gjahr in so_gjahr.
loop at bkpf_rec.
perform open_group.
perform bdc_dynpro using 'SAPMF05M' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF022-BUKRS'.
perform bdc_field using 'BDC_OKCODE'
'=SEL'.
perform bdc_field using 'RF022-BUKRS'
bkpf_rec-bukrs.
perform bdc_dynpro using 'SAPMSSY0' '0120'.
perform bdc_field using 'BDC_CURSOR'
'19/07'.
perform bdc_field using 'BDC_OKCODE'
'=PICK'.
perform bdc_dynpro using 'SAPLF022' '1001'.
perform bdc_field using 'BDC_CURSOR'
'RF022-GJAHR'.
perform bdc_field using 'BDC_OKCODE'
'=GO'.
perform bdc_field using 'RF022-BELNR'
bkpf_rec-belnr.
perform bdc_field using 'RF022-GJAHR'
bkpf_rec-gjahr.
perform bdc_transaction using 'FB12'.
perform close_group.
endloop.
‎2005 Nov 29 9:16 PM
hi
please paste the code where you are passing No data = '/'.
regards
vijay
‎2005 Nov 29 9:24 PM
Try:
SELECT bukrs blart cpudt budat belnr gjahr
into <b>corresponding fields of table</b> bkpf_rec from bkpf
where bukrs IN so_bukrs
and blart in so_blart
and cpudt in so_cpudt
and budat in so_budat
and belnr in so_belnr
and gjahr in so_gjahr.
Rob
I take it back. I didn't see how BKPF_REC was declared.
Message was edited by: Rob Burbank
‎2005 Nov 29 9:37 PM
RF022-GJAHR is of type numc!
You cannot pass non-character types to form bdc_field.
If you are not using a standard include, perform a separate BDC_FIELD routine for non-character fields...take a look at the form below......
Try:
<b>perform bdc_field_nonchar using 'RF022-GJAHR' bkpf_rec-gjahr.</b>
FORM bdc_field_nonchar USING fnam fval.
IF fval is not initial.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDIF.
ENDFORM. "BDC_FIELD_NONCHAR
Otherwise, you can declare a place holder of type character and use it to build your bdcdata.
DATA: GJAHR(4) TYPE C.
MOVE bkpf_rec-gjahr TO gjahr.
PERFORM bdc_field USING 'RF022-GJAHR' gjahr.
Message was edited by: Sam
‎2005 Nov 29 9:47 PM
As I explained, you are getting this error from the standard SAP include that you used. What you can do is to check for initial values in your code, before calling the routine as follows.
if not bkpf_rec-gjahr is initial.
perform bdc_field using 'RF022-GJAHR' bkpf_rec-gjahr.
else.
perform bdc_field using 'RF022-GJAHR' '/'.
endif.
You have to do this for the date fields as well.
Srinivas
‎2005 Nov 29 8:59 PM
Is this your own recording or SAP standard program?
Typically, your input structures should be character fields and then you can compare the fields for nodata character. If a field has nodata character, then that field of the screen will be skipped. That is the logic.
Can you paste the lines of code where this is happening? also, if it is a routine, then paste the corresponding call(PERFORM) to this routine.
Regards,
Srinivas
‎2005 Nov 29 9:00 PM
Hi
Is this Standard LSMW kind of Program i mean Direct Input method , in that No DATA will be treated as "/"
but in normal cases we need to populate with space.
But Can i know in which case you are using this.
regards
vijay
‎2005 Nov 29 9:07 PM
Hi Rad,
The NODATA is in the include bdcrecx1 on the selection screen.
‎2005 Nov 29 9:54 PM
Hi,
I think see your question you need to pass the date field in character
BKPF_REC-GJAHR
So first declare
Data : v_gjahr(10) type c.
Write BKPF_REC-GJAHR to v_gjahr.
perform bdc_field using 'RF022-GJAHR'
v_gjahr.
Also remove the code perform bdc_field using 'BDC_CURSOR'
'19/07'. That is not required.
Hope this will help you.
Thanks
Rajeev
‎2005 Nov 29 10:01 PM
Sam,
Rajeev already presented that solution. Let us leave that credit to him instead of modifying our response.
Regards,
Srinivas
‎2005 Nov 29 10:03 PM
Srinivas, I didn't see his reply when I started to edit my message!
‎2005 Nov 29 10:10 PM
Sam, please don't take it seriously. I know it does happen sometimes that we hit the same idea but someone will be there first and other one will be a duplicate. Instead of modifying, may be we should just type in a new reply. I apologize if I unintentionally overstepped here.
Regards,
Srinivas
‎2005 Nov 29 10:21 PM
You are right...typing in a new reply is a better idea!
Cheers,
Sam
‎2005 Nov 29 10:10 PM