Character type field
Hi all,
I stored 'A' in a character field which is of lenght 1. How can it be incremented to B, C, D and so on. (Suppose in loop or so).
Regards,
Balakrishna.N
Use Translate
CONSTANTS:
trn(52) VALUE 'ABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZA'.
DATA:
chrfld VALUE 'A'.
DO 26 TIMES.
WRITE:/ chrfld.
TRANSLATE chrfld USING trn.
WRITE AT 10 chrfld.
ENDDO.
Similar Messages
-
Unicode - "DMBTR" must be a character-type field (data type C,N,D or T)
Greetings Experts!
I am trying to convert legacy code to Unicode for a current ERP6.0 reinstallation and have encountered the syntax error "DMBTR" must be a character-type field (data type C,N,D or T)
The field is part of a structure and the fields attributes are as follows:
COMPONENT = DMBTR
COMPONENT TYPE = DMBTR
DATA TYPE = CURR
LENGTH = 13
DECIMALS = 2
DESCRIPTION = Amount in Local Currency
The code in question is as follows:-
macro Move_Zoned.
Converts a numeric variable to zoned format and moves it to a
target variable.
DEFINE move_zoned.
&1 - source variable
&2 - Number of Decimal Places
&3 - 'To'
&4 - Target Variable.
write &1 to w_zoned no-grouping decimals &2.
condense w_zoned.
Remove the Decimal Points.
search w_zoned for '...'.
while sy-subrc = 0.
move sy-fdpos to w_to_point.
if w_to_point = 0.
w_to_point = 1.
endif.
compute w_from_point = sy-fdpos + 1.
concatenate w_zoned+0(w_to_point)
w_zoned+w_from_point
into w_zoned.
search w_zoned for '...'.
endwhile.
shift w_zoned right deleting trailing space.
translate w_zoned using ' 0'.
call function 'Z_TRANSLATE_ZONED_DECIMALS'
exporting
i_input = w_zoned
importing
i_output = w_zoned
exceptions
x_invalid_zoned_char = c_invalid_zoned_char
x_numeric_info_lost = c_numeric_info_lost
others = c_other_zoned_error.
Get the length of the recipient field so we don't truncate the
numbers....
describe field &4 length w_flength in character mode.
describe field &4 type w_type.
describe field w_zoned length w_zoned_len in character mode.
if w_zoned_len <= w_flength.
move w_zoned to &4.
shift &4 right deleting trailing space.
translate &4 using ' 0'.
else.
Get the start position....
If it's a packed field allow for values up to 6 figures
compute w_zoned_len = w_zoned_len - w_flength.
if w_type = 'P'.
subtract 2 from w_zoned_len.
clear w_type.
endif.
move w_zoned+w_zoned_len &3 &4.
endif.
END-OF-DEFINITION. "Move_zoned
LOOP AT t_single_kunnr.
move_zoned t_single_kunnr-postamt 2
to t_single_kunnr-dmbtr.
DIVIDE t_single_kunnr-dmbtr BY 100.
MODIFY t_single_kunnr.
ENDLOOP.
Is there a solution to get past this syntax error as I would rather not change the datatype of the field in the structure.
Much Obliged
Elphick.Type X is not allowed in Unicode. When a field is declared as Type X with Value u201809u2019 or any other value, it can be resolved by using classes.
Before Unicode
CONSTANTS: c_hex TYPE x VALUE '09'.
Resolution:
Itu2019s work for any value of x.
First a temporary field of Type c should declare. Following class will convert Type x variable into type c.
Example:
CONSTANTS: c_hex TYPE x VALUE '09'.
DATA: LV_TEMP TYPE STRING.
DATA: LV_TMP TYPE C.
TRY.
CALL METHOD CL_ABAP_CONV_IN_CE=>UCCP
EXPORTING
UCCP = c_hex
RECEIVING
CHAR = LV_TMP .
CATCH CX_SY_CONVERSION_CODEPAGE.
CATCH CX_PARAMETER_INVALID_TYPE.
CATCH CX_SY_CODEPAGE_CONVERTER_INIT.
ENDTRY.
CONCATENATE I_OUTPUT-BKTXT I_OUTPUT-BVORG
I_OUTPUT-BUDAT I_OUTPUT-MESSAGE INTO
SEPARATED BY LV_TMP.
I_BUFFER = LV_TEMP.
CLEAR LV_TEMP.
CLEAR LV_TMP.
OR
Note: It works only for type x value 09.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS: c_hex TYPE c VALUE
abap_char_utilities=>HORIZONTAL_TAB. -
It_field1 must be character type field
hai all,
I was facing the following error:
there is a macro called wdr_file_export 1 'ASC' p_report.
In this it is giving an error that
"IT_FILE1" must be a character-type field (data type C, N, D, or T).
But I was not able to find the object it_file1.
I tried to create a new object of the same name it says that the object already exists.
now I was unable resolve this error .
can anybody pls help me.
thanks in advance,
sri.hi ,
first get the structure of the itab u r using .
declare like this ..
data : begin of itab occurs 0.
include structure <structure name>.
data: end of itab.
regards,
venkat. -
Comparision of character type field
hello expert,
i want to compare a character type field without using operator like ge, ne etc.
plz help me if you know.
thanks in advanceHi,
If it is character type. it will compare like this
For operands with a character-type data type (c, d, n, t, string) the contents are compared from left to right. Based on the order in the code page used, the first different character from the left decides which operand is larger.
let try this example you will get wrong output
data : lv_field1 type char2 value '2',
lv_field2 type char2 value '12'.
if lv_field1 GT lv_field2.
write : / 'test'.
endif.
So assing the values to some integer varaibles and compare then it will work fine.
Hope it will helps -
Problem with select range for a character type field. Kindly Help! Urgent!
Hi Experts,
I have to write a report to pull data from a table BUT000 for a selected range of BPEXT field values in selection screen.
In the table BUT000, the BPEXT field is type char. Now what is happening is that if the user gives a range in selection screen from 1000 to 1010 the query pulls all the records where teh forst character starts from 1.
For example if the table has
BPEXT
1
10
100
101
1000
1001
1002
1005
1010
20
200
2000
Then my query pulls
BPEXT
101
1000
1001
1002
1005
1010
Instead it should pull only
BPEXT
1000
1001
1002
1005
1010
My guess this is because the BPEXT field is of CHAR type instead of numeric.
What shall i do to solve this problem? Kindly help please!
Thanks
Gopal
Message was edited by:
gopalkrishna baligaHi Chakradhar,
How to find the conversion exit for BPEXT field?
How to use the conversion exit in a select query in my ABAP report? Any sample code will be really helpfull.
Please help!
Thanks
Gopal -
Select option for a character type field
Hi all as per my requirement i have a selection for a data type char40
Hence in my wddoinit method i used the following code to generate the select options in WD
create a range table that consists of this new data element
LT_RANGE_TABLE = WD_THIS->M_HANDLER->CREATE_RANGE_TABLE( I_TYPENAME = 'CHAR40' ).
add a new field to the selection
WD_THIS->M_HANDLER->ADD_SELECTION_FIELD( I_ID = 'CHAR40'
IT_RESULT = LT_RANGE_TABLE I_READ_ONLY = READ_ONLY I_NO_INTERVALS = 'X').
The select option is properly displayed but "char" word is infront of the selection fields.
I want to remove this char word.
Can someone please advice me on this ?Hi
Modify the Add_selection_field call to add descrption for the field.
if you dont want anything pass space.
* add a new field to the selection
WD_THIS->M_HANDLER->ADD_SELECTION_FIELD(
I_ID = 'CHAR40'
IT_RESULT = LT_RANGE_TABLE
I_READ_ONLY = READ_ONLY
I_NO_INTERVALS = 'X'
I_DESCRIPTION = ' ' " whatever you pass here will come as a label to the field or we can say
" inplace of CHAR
thanks
sarbjeet singh -
Can not converted to be a charter-type field
Hi everyone,
As i m new in abap . i wrote this code and received charter type error.
*& Report ZT11
REPORT ZT11.
DATA: aa type lfa1.
tables lfa1.
select * from lfa1 into aa where lifnr > 'Z' .
write / aa.
endselect.
if sy-subrc <> 0.
write / 'No records found'.
endif.
error is
'AA' can not converted to a character-type field.
plz help to reslove the error .
thanks in advance.
Edited by: Faisal Abbasi on May 9, 2010 11:19 AMHi Dear,
This is Unicode problem, In unicode systme some restriction in programing.
There is three kid of data type
Character Processing ( C, N, D, T and STRING ).
Byte Processing Mode ( X and XString ).
Numeric Data Type ( I, P , F ).
whenever in structure all kind of data types are used then you can not use WRITE and then whole structure name.
in LFA1 in ECC6.0 if any custom fields are not added then up to length 1232 is determined as Character.
so if you will give aa(1232) it will work similarlly other kid of remainig data tpe you move in another structure of required format and then check.
REPORT ZT11.
DATA: aa type lfa1.
tables lfa1.
select * from lfa1 into aa where lifnr > 'Z' .
write / aa(1232).
endselect.
if sy-subrc 0.
write / 'No records found'.
endif.
For better Understanding Check
The following structure has both character-type and non-character-type components:
BEGIN OF STRUC,
a TYPE c LENGTH 3, "Length 3 characters
b TYPE n LENGTH 4, "Length 4 characters
c TYPE d, "Length 8 characters
d TYPE t, "Length 6 characters
e TYPE f, "Length 8 bytes
f TYPE c LENGTH 28, "Length28 characters
g TYPE x LENGTH 2, "Length 2 bytes
END OF STRUC.
The Unicode fragment view splits the structure into four areas F1 - F5.
[ aaa | bbbb | cccccccc | ddd | AAA | eeee | fffffffffffff | gg ]
[ F1 | F2 | F3 | F4 | F5 ]
Offset/length access is only possible for the character-type initial fragment F1. Specifications such as struc(21) or struc7(14) are accepted and are handled as a single field of type c. An access such as struc57(2), for example, is not permitted in Unicode systems. -
Dynamic Data: Character Type Declaration
Hello Experts,
I would like to get your feedback regarding declaration of a character type field with dynamic length?
For example, I would like to declare data like: char(size) type c, where size is dynamic.
How can I do this? Thanks in advance.
Regards,
JeromeHi,
DATA r_elemdescr TYPE REF TO cl_abap_elemdescr.
r_elemdescr ?= cl_abap_elemdescr=>describe_by_name( 'DATA_ELEMENT_HERE' ).
DATA r_field TYPE REF TO data.
FIELD-SYMBOLS <field> TYPE ANY.
CREATE DATA r_field TYPE HANDLE r_elemdescr.
ASSIGN r_field->* TO <field>.
<field> = .....
now <field> is your dynamic field value
Regards,
Ravi -
While inserting numeric data into a character datatype field and vice versa
Sir,
I have a very basic qiestion.Why am i not getting any error while inserting to say employees table a character type data to a numeric type field and vice versa?Iam using Oracle Database 10g Enterprise edition.Why am i not getting any error while inserting to say employees table a character type data to a numeric type field and vice versa?
Oracle tries an automatic conversion, when possible. Post an example of a character type data inserted into a numeric column. -
Hi All,
following piece of code was working fine in 4.6 C but in ECC 6.0 I get the following error:
" "END_OF_RECORD" must be a character-type data object (data type C, N,D, T or STRING) . "
I tried type-casting with field symbols but still not able to remove the error. Cannot convert end_of_record directly to type C as it may hamper the functionality. Plz advice how to remove the error without converting type x to type C
In the following code :
DATA: DELIMITER TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
end_of_record TYPE x.
SPLIT data_file_i AT delimiter INTO it_ekko-rtype
it_ekko-ebeln
it_ekko-bsart
it_ekko-lifnr
it_ekko-bedat
it_ekko-ekorg
it_ekko-ekgrp
it_ekko-bukrs
it_ekko-zterm
it_ekko-zbd1t
it_ekko-zbd1p
it_ekko-zbd2t
it_ekko-zbd2p
it_ekko-zbd3t
it_ekko-inco1
it_ekko-inco2
it_ekko-waers
it_ekko-wkurs
it_ekko-kufix
it_ekko-verkf
it_ekko-telf1
it_ekko-ihrez
it_ekko-unsez
it_ekko-angnr
it_ekko-ihran
it_ekko-submi
it_ekko-loekz
end_of_record.
where all these fields except " end_of_record " are of character type and "data_file_i " is a character type structure as defined below:
DATA :
BEGIN OF data_file_i OCCURS 0,
record(1000),
END OF data_file_i,Type X is not allowed in Unicode. When a field is declared as Type X with Value u201809u2019 or any other value, it can be resolved by using classes.
Before Unicode
CONSTANTS: c_hex TYPE x VALUE '09'.
Resolution:
Itu2019s work for any value of x.
First a temporary field of Type c should declare. Following class will convert Type x variable into type c.
Example:
CONSTANTS: c_hex TYPE x VALUE '09'.
DATA: LV_TEMP TYPE STRING.
DATA: LV_TMP TYPE C.
TRY.
CALL METHOD CL_ABAP_CONV_IN_CE=>UCCP
EXPORTING
UCCP = c_hex
RECEIVING
CHAR = LV_TMP .
CATCH CX_SY_CONVERSION_CODEPAGE.
CATCH CX_PARAMETER_INVALID_TYPE.
CATCH CX_SY_CODEPAGE_CONVERTER_INIT.
ENDTRY.
CONCATENATE I_OUTPUT-BKTXT I_OUTPUT-BVORG
I_OUTPUT-BUDAT I_OUTPUT-MESSAGE INTO
SEPARATED BY LV_TMP.
I_BUFFER = LV_TEMP.
CLEAR LV_TEMP.
CLEAR LV_TMP.
OR
Note: It works only for type x value 09.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS: c_hex TYPE c VALUE
abap_char_utilities=>HORIZONTAL_TAB. -
Abap dump: internal table too small, condense non-character like fields
Hi there,
I created a dynamic internal table by:
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
ASSIGN IT_EP_TABLE->* TO <IT_DBTABLE>.
SELECT * FROM (P_TABLE_NAME)
<b> INTO TABLE <IT_DBTABLE> </b>
It gave the error <b> internal table too small </b> SAPSQL_SELECT_TAB_TOO_SMALL,
so I removed the error by using "into corresponding fields of <IT_DBTABLE>.
But now it is not creating a TXT file by function module from internal table records. As it says the CONDENSE statement cannot be executed and dump occurs: 'OBJECTS_NOT_CHARLIKE' 'The current statement only supports character-type data objects', 'In statement
"CONDENSE" the argument "<F_SOURCE>" can only take a character-type data object'.
It only happens for table AFPO. As I think this table has fields i.e. currency which cannot be treated as characters. Is the move corresponding approach ok. Or how can I create text file with these records.try creating a dynamic table in the image of the source table and then move-corresponding to the original one. Something like this:
DATA dref TYPE REF TO data.
DATA tabdref TYPE REF TO data.
FIELD-SYMBOLS <dyn_struc> TYPE ANY.
FIELD-SYMBOLS <struc> TYPE ANY.
FIELD-SYMBOLS <tab> TYPE table.
*create table of your choice
CREATE DATA tabdref TYPE TABLE OF (P_TABLE_NAME).
ASSIGN tabdref->* TO <tab>.
create a line variable for the above table
CREATE DATA dref like line of <tab>.
ASSIGN dref->* TO <struc>.
create a line variable for the dynamically created table
CREATE DATA dref like line of <IT_DBTABLE>.
ASSIGN dref->* TO <dyn_struc>.
SELECT * FROM (P_TABLE_NAME)
INTO TABLE <tab>.
loop at <tab> assigning <struc>.
move-corresponding <tab> to <dyn_struc>.
append <dyn_struc> to <IT_DBTABLE>.
endloop. -
How to Update Date data type field value in oracle
I want to update records in a table that has a Date data type field. It's a oracle databse. I use the oracle thin drive to connect to the database. The everything works well, only when i try to update records that have date type value, something doesn't work.
I use the following stmt to update DB:
Class.forName("oracle.jdbc.driver.OracleDriver");
Conn = DriverManager.getConnection("jdbc:oracle:thin:@hostname:portnumber:schname", "uid","pwd");
stmt=Conn.createStatement();
String updStr = "UPDATE Article SET Archive = ' Disable' WHERE ArticleDate = # " + sqlDate +"# " ;
stmt.executeUpdate( updAStr ) ;
But I always got the SQLException run time error, which is "ORA-00911: invalid character"
Who can help me to find out how to write the above Update statement correctly? esp. that how to present the Date type variable in the statement.!
BTW, sqlDate is a Java.sql.Date variable, Is it "# " + sqlDate + "# " the right way?
Many thanksWhat do you get out of Oracle's TO_DATE that java.sql.PreparedStatement.setDate()
won't give you? - MODWell, I don't know that I've used all capabilities of either, but when it comes to managing Date Strings my Oracle bias :) would be to code using Oracle's TO_CHAR and TO_DATE functions. Perhaps someone can tell me vendor neutral ways to do something simiilar to managing these input date/times (and hopefully just as easily, pretty much all done in a single line, single function)?
WHERE aDATE > TO_DATE('2010','YYYY')
WHERE aDATE > TO_DATE('2010 AUG 22','YYYY MMM DD')
WHERE aDATE > TO_DATE( 'January 15, 1989, 11:00 A.M.', 'Month dd, YYYY, HH:MI A.M.')
I believe most databases have something similar to this, although I have found Oracle's to be the most flexible and consistent, if not the most intuitive. Other vendors (DB2, SQL Server, Access) don't force you to always be explicit, and can accept a variety of date strings without masks. The problem is that while you might not be getting an error, it also may not be parsing your date as expected.
One could argue that this vendor specific hodgepodge of literal date/time strings is only one program modification away from disaster. They might be right.
Just to be clear. I'm not recommending using a vendor specific approach, but it's not a perfect world and somtimes you have to use what works easiest or best or fastest, and in some cases, that is the vendor specific alternatives. -
Function module to convert character type to required data type
Hi,
Is there a function module which can convert data in character type to any other required data type?
Like i have a date 12.2.2008 and it is stored as character now i want to convert it into type d.
so that when i use
Describe field <field_name> type <type>.
statement afterwards then it gives me D not C as its data type.
The requirement does'nt stick to conversion of just one data type.I need an FM which can convert data in character type to any data type.
Hope you understood the problem.
Thanks for your time.Hi,
Use the code.
data : date like sy-datum.
call function 'CONVERT_DATE_TO_INTERNAL'
exporting
date_external = '01.01.2008'
IMPORTING
DATE_INTERNAL = date
EXCEPTIONS
DATE_EXTERNAL_IS_INVALID = 1
OTHERS = 2
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Regards,
Morris Bond.
Reward Points if Helpful. -
How to convert strings into character type?
I have created a function module which will display the attributes of the fields of the structure/table by using "DESCRIBE FIELD" command. The problem is that it supports only character-type data objects and the program goes into dump
if the structure contain any string type.Please have a look at class CL_ABAP_DATADESCR. Using this instances of this class should provide all information needed...
Reward points, if reply is applicable -
Character type to currency type conversion
hi all,
i need to transfer the character type data to the currency type data.
my requirement is when i am trying to transfer the data from excel i need to store it as a character. again i need to change the same as currency. any pointers will be highly appriciated.
thanks.Hi use the belwo function module and first move the currecy field to character..and inthe out put table decclare field as character 20 ..and download the field..
hope will works..
Amount to string:
CALL FUNCTION 'HRCM_AMOUNT_TO_STRING_CONVERT'
EXPORTING
betrg = w_curerency "currency field
WAERS = 'DKK'
IMPORTING
STRING = slam . "Output table field type char20
String to amount:
CALL FUNCTION 'HRCM_STRING_TO_AMOUNT_CONVERT'
EXPORTING
string = slam2 "character field
DECIMAL_SEPARATOR = '.'
THOUSANDS_SEPARATOR =
WAERS = 'HUF'
IMPORTING
BETRG = b2 . "converting into currency field
Prabhudas
Maybe you are looking for
-
I have two Macs, an i-Mac flat screen that runs on OSX.4.11 and i-tunes 9 and a MacBook Intel Duo that runs on Snow Leopard and i-tunes 10. I have carefully followed all the Advanced instructions for sharing music libraries, which is not a problem;
-
Fifa 14 doesnt start after Updating Windows 8.1. Update is -KB2919355.
So back in March when i installed this update everything was running smoothly. After installing the update Fifa 14 doesnt even start like after clicking the launcher nothing happens. I reinstalled my program, Direct X and .net Framework but nothing w
-
Can I delete Version 3 after downloading Beta 4?. I like 4 much better--faster
I need space on my crowded hard drive. Can I delete previous version 3. and just run Beta 4? Thanks
-
Wifi Help, Please help :(
I have trouble connecting onto my ipods wifi at home. It sometimes says i am connected but when i go onto the safari it says "cannot connect to server" I know i have the right password for the wifi network And I know I have wifi in my house because i
-
Planning permitted in planning elements only Message no. BP024
Hi All, I got this error message in CJR2 (wbs and Cost element) - detail planning. I already set the WBS with object indicator planning elements. What should i do? Cheers, Nies Planning permitted in planning elements only Message no. BP024 Diagnosis