Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error

Former Member
0 Likes
1,031

Hi,

In the following program, i am getting the "error

itab-wrbtr must be a character-type data object (data type C,N,DT or String )".

How to avoid this please let me know, i need to use the same data type.

data : begin of itab occurs 0,

BLDAT(10) TYPE C,

BLART(2) TYPE C,

BUKRS(4) TYPE C,

BUDAT(10) TYPE C,

MONAT(2) TYPE C,

WAERS(5) TYPE C,

NEWBS(2) TYPE C,

NEWKO(17) TYPE C,

WRBTR TYPE P decimals 2,

VALUT(10) TYPE C,

GSBER(4) TYPE C,

TNEWBS(2) TYPE C,

TNEWKO(17) TYPE C,

TWRBTR TYPE p decimals 2,

end of itab.

PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.

data : i_bdcdata like bdcdata occurs 0 with header line.

data : i_bdcmsgcoll like bdcmsgcoll occurs 0 with header line.

DATA : filename TYPE string.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CLEAR p_file.

CALL FUNCTION 'F4_FILENAME'

IMPORTING

file_name = p_file.

start-of-selection.

filename = p_file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = filename

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = itab1

  • EXCEPTIONS

  • FILE_OPEN_ERROR = 1

  • FILE_READ_ERROR = 2

  • NO_BATCH = 3

  • GUI_REFUSE_FILETRANSFER = 4

  • INVALID_TYPE = 5

  • NO_AUTHORITY = 6

  • UNKNOWN_ERROR = 7

  • BAD_DATA_FORMAT = 8

  • HEADER_NOT_ALLOWED = 9

  • SEPARATOR_NOT_ALLOWED = 10

  • HEADER_TOO_LONG = 11

  • UNKNOWN_DP_ERROR = 12

  • ACCESS_DENIED = 13

  • DP_OUT_OF_MEMORY = 14

  • DISK_FULL = 15

  • DP_TIMEOUT = 16

  • OTHERS = 17

.

V_COUNT = 1.

LOOP AT ITAB1.

IF V_COUNT = 1.

SPLIT ITAB1 AT ',' INTO ITAB-BLDAT ITAB-BLART ITAB-BUKRS ITAB-BUDAT ITAB-MONAT

ITAB-WAERS ITAB-NEWBS ITAB-NEWKO ITAB-WRBTR ITAB-VALUT ITAB-GSBER

Please help me out.

Thanks,

Pavan.

10 REPLIES 10
Read only

christian_wohlfahrt
Active Contributor
0 Likes
997

Hi Pavan!

Just use two tables, one for upload (because either you use binary mode or for text mode all fields have to be character type), second for rest of program.

With a loop ... move-corresponding ... append ... endloop you can fill the second table and you get the field conversion.

Regards,

Christian

Read only

Former Member
0 Likes
997

Hi Pavan

Declare itab-wrbtr as type 'C' i.e, Character type . Hope this way you will not come acorss such error.

Regards,

Santosh

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
997

Hi,

In BDC,we cannot use type p.That's why the error is coming.

Declare

WRBTR(15) type c

in declaring itab.

Length should be equal to the output lenght of WRBTR.

Read only

vinod_gunaware2
Active Contributor
0 Likes
997

u can not use p type instead of it use char type.

regards

vinod

Read only

Former Member
0 Likes
997

Hi pavan,

1. there are two mistakes.

2. we cannot use split ITAB1

bcos itab1 is a internal table,

split expects a string(ie. CHARACTER FIELD)

eg.

SPLIT 'ABCD' AT ',' INTO ITAB-BLDAT ITAB-BLART ITAB-BUKRS ITAB-BUDAT ITAB-MONAT

ITAB-WAERS ITAB-NEWBS ITAB-NEWKO

*ITAB-WRBTR

ITAB-VALUT ITAB-GSBER

3. second mistake is

*ITAB-WRBTR

This needs to be again a character field.

4. So what u can do is,

use another character field for splitting,

and then assign to your original numeric variable.

*----


4. If your requirement is uploading a file

into internal table,

then make the file TAB DELIMITED,

and just use GUI_UPLOAD.

It will work nice. (there will be no need to use split ';')

5. In that case also, use all character fields,

in internal table,

after uploading,

transfer to another internal table with

corresponding numeric fields.

regards,

amit m.

Message was edited by: Amit Mittal

Read only

Former Member
0 Likes
997

Hi Pavan,

In ITAB declaration u have defined the values WRBTR TYPE P decimals 2.

it makes problem when u use split command. So defione it as C after splitting the value get it as packed decimal for WRBTR by defining some other variable.

Thanks

eswar

Read only

athavanraja
Active Contributor
0 Likes
997

whats the definition of itab1.

to use split, concatenate the field has to be of type C,N,d or t

i am not sure but try the addition <b>IN BYTE MODE</b>

Regards

Raja

Read only

Former Member
0 Likes
997

the error is coming because of the below code...

SPLIT ITAB1 AT ',' INTO ITAB-BLDAT ITAB-BLART ITAB-BUKRS ITAB-BUDAT ITAB-MONAT
ITAB-WAERS ITAB-NEWBS ITAB-NEWKO ITAB-WRBTR ITAB-VALUT ITAB-GSBER

since you have used type p and you are using split, so it will give that error. to avoid declare type c variable as above stated.

regards

vijay

Read only

Former Member
0 Likes
997

Hi ,

WRBTR output length is of 16.when u declear

WRBTR TYPE P decimals 2, it will take only 13 characters .

Thanks

Vikranth

Read only

Former Member
0 Likes
997

Hi ,

WRBTR output length is of 16.when u declear

WRBTR TYPE P decimals 2, it will take only 13 characters .so take a variable lenght of 16 char and pass that WRBTR to that variable and then use it.i think this will solve u r problem

Thanks

Vikranth