‎2005 Dec 08 10:42 PM
Hi ,
I am getting the following syntax error... Can anyone please help !!
'IMTGP-JAN' must be a character type data object (datatype C,N,D,T or String)
-
program is
&----
*& Report ZBDC_BUDGET_UPLOAD
*&
&----
*&
*&
&----
REPORT ZBDC_BUDGET_UPLOAD.
include bdcrecx1.
*Tables: CCSS , RKPLN .
types: begin of tdata,
rec(150) type c,
end of tdata,
begin of tmtgp,
costcent LIKE CCSS-KOSTL,
costelem LIKE CCSS-KSTAR,
fisyear LIKE CCSS-GJAHR,
jan LIKE RKPLN-WKG,
feb LIKE RKPLN-WKG,
mar LIKE RKPLN-WKG,
apr LIKE RKPLN-WKG,
may LIKE RKPLN-WKG,
jun LIKE RKPLN-WKG,
jul LIKE RKPLN-WKG,
aug LIKE RKPLN-WKG,
sep LIKE RKPLN-WKG,
oct LIKE RKPLN-WKG,
nov LIKE RKPLN-WKG,
dec LIKE RKPLN-WKG,
end of tmtgp.
data: idata type table of tdata with header line.
data: imtgp type table of tmtgp with header line.
selection-screen begin of block b1 with frame title text-001.
parameters: p_file type localfile default 'C:\budget_data_csv.csv'.
selection-screen end of block b1.at selection-screen on value-request
for p_file.
call function 'KD_GET_FILENAME_ON_F4'
exporting static = 'X'
changing file_name = p_file.
start-of-selection.
perform upload_data.
loop at imtgp.
perform open_group.
perform bdc_dynpro using 'SAPLKPP0' '1000'.
perform bdc_field using 'BDC_CURSOR'
'KPP0B-VALUE(04)'.
perform bdc_field using 'BDC_OKCODE'
'=CSPB'.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'Z-BDC03(01)'
'10000'.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(02)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'Z-BDC03(02)'
'10000'.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(03)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'Z-BDC03(03)'
'10000'.
perform bdc_field using 'Z-BDC03(04)'
'10000'.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(05)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'Z-BDC03(05)'
'10000'.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(06)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'Z-BDC03(06)'
'10000'.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(07)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'Z-BDC03(07)'
'10000'.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(08)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'Z-BDC03(08)'
'10000'.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(09)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'Z-BDC03(09)'
'10000'.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(10)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'Z-BDC03(10)'
'10000'.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(11)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'Z-BDC03(11)'
'10000'.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(12)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'Z-BDC03(12)'
'10000'.
perform bdc_dynpro using 'SAPLKPP2' '0110'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(12)'.
perform bdc_field using 'BDC_OKCODE'
'=CBUC'.
perform bdc_transaction using 'KP06'.
perform close_group.
endloop.
form upload_data.
data: filename type string.
clear idata.
refresh idata.
filename = p_file.
call function 'GUI_UPLOAD'
exporting filename = filename
filetype = 'ASC'
tables data_tab = idata
exceptions file_open_error = 1
file_read_error = 2
no_authority = 6
others = 17.
check sy-subrc = 0.
loop at idata.
clear imtgp.
split idata at ',' into imtgp-costcent imtgp-costelem imtgp-fisyear
imtgp-jan imtgp-feb imtgp-mar imtgp-apr imtgp-may imtgp-jun imtgp-jul
imtgp-aug imtgp-sep imtgp-oct imtgp-nov imtgp-dec.
append imtgp.
endloop.
endform.
‎2005 Dec 08 10:48 PM
Hi Rad,
PL declare your temp table IMTGP with CHAR type fields instaed of LIKE dictionary fields.
Reagrds,
Suresh Datti
‎2005 Dec 08 10:51 PM
Hi split behaves like commands used for string.Like all string processsing statements, you can only use character-type operands here.
You have to change the data type of all the fields in the table imtgp to 'C'.
‎2005 Dec 08 10:53 PM
Hi Rad,
You have defined IMTG-JAN as RKPLN-WKG which is data type CURR.
Please define IMTG-JAN as JAN CHAR(Length 21).
Data : Table IMTG....
JAN(21),
‎2005 Dec 09 2:36 AM
Thanks Murthy.. Now I understood the issue. Can u please tell me which function to use to convert character data to CURR type as when i have to give that data as input to the BDC, i need to convert to CURR, right ??
thanks
‎2005 Dec 09 2:43 AM
Hi Rad,
You can pass Char Value to bdc_field. No need for conversion.
For formatiing to currency format :
WRITE SALES CURRENCY 'CURRENCYKEY'.
currency key for the table TCURX like 'USD' or 'CAD'.
Message was edited by: Lanka Murthy
‎2005 Dec 09 2:36 AM
DECLARE THIS:
................
DATA:
begin of WORK,
costcent LIKE CCSS-KOSTL,
costelem LIKE CCSS-KSTAR,
fisyear LIKE CCSS-GJAHR,
jan(12),
feb(12),
mar(12),
apr(12),
may(12),
jun(12),
jul(12),
aug(12),
sep(12),
oct(12),
nov(12),
dec(12),
end of WORK.
...............
and change your loop:
loop at idata.
clear imtgp.
split idata at ',' into WORK-costcent WORK-costelem WORK-fisyear
WORK-jan WORK-feb WORK-mar WORK-apr WORK-may WORK-jun WORK-jul
WORK-aug WORK-sep WORK-oct WORK-nov WORK-dec.
MOVE-CORRESPONDING WORK TO IMTGP.
append imtgp.
endloop.