Comparison operators for character-type operands
Hi Experts,
I have one internal table in that Name is one field(char type) .
some records have upper case,
some in lower case,
some are mixed.
in selection screen i am entering the name and i am serching the record using search button.
i am using code like as below,
loop at itab where name cs name.
endloop.
cs operator is not working properly.
can any body tell me how to do this.
thanks in advance.
tharangini.
first of all change both the strings into one comman case like uppercase or lowercase.
TRANSLATE w-string2 TO LOWER CASE.
or
TRANSLATE w-string2 TO UPPER CASE.
then do the search operation in internal table.
Similar Messages
-
Define infix operators for Object types
Hi,
Is it possible to define infix operators for object types?
Example:
CREATE TYPE BODY Complex AS
MEMBER operator + (x Complex) RETURN Complex IS
BEGIN
RETURN Complex(rpart + x.rpart, ipart + x.ipart);
END plus;
Usage:
given a table E (C1 Complex, C2 Complex)
Select C1+C2 from E;
Kind regards
TaouikAn "object type" is nothing but a an o-o class. Can you create SQL constraints on o-o classes? Usually not. Oracle is no different.
Where do you create constraints in Oracle? On tables. And yes, an o-o class (object type) can be used to create a table (aka an object table). That table can have any of the standard SQL constraints supported by Oracle. -
Logic for this comparision of character type operands.
Source field name: ZDCNFG
Target Info Objects:
ZDVD59
ZDVD10
ZDVD14
ZDVD18
ZDVD25
ZDVD50
Scenario1: If ZDCNFG = 2(10). 2 is quantity and 10 in brackets is part number (DVD format). So I will have to update the quantity respective field as shown below.
ZDVD59: 0
ZDVD10: 2 -->updated 10 part
ZDVD14: 0
ZDVD18: 0
ZDVD25: 0
ZDVD50: 0
Scenario2: If ZDCNFG: 2(25)3(50)
ZDVD59: 0
ZDVD10: 0
ZDVD14: 0
ZDVD18: 0
ZDVD25: 2 --> Updated
ZDVD50: 3 --> Updated
Scenario3: If ZDCNFG: 2(5)3(9) ---This is exceptional case. If we have 5 and 9 then add and assign 5 to ZDVD59 rest all are 0.
ZDVD59: 5 Sum of DVD5 and DVD9
ZDVD10: 0
ZDVD14: 0
ZDVD18: 0
ZDVD25: 0
ZDVD50: 0
Quantity is the value which is out side the brackets. For e.g. in 10(5), 10 is the quantity.
Can any one give me a logic for this.
I was trying with CA CS etc..but no charm.
Thanks
KiranKiran,
This should work
parameters: zdcnfg(50).
data: zdvd59(3),
zdvd10(3),
zdvd14(3),
zdvd18(3),
zdvd25(3),
zdvd50(3),
rcnt type i,
roff type i,
temp type i.
data: static(50).
start-of-selection.
static = zdcnfg.
replace all occurrences of '(5)' in zdcnfg with '+' replacement count rcnt.
if rcnt ge 1.
zdcnfg = static.
do rcnt times.
replace first occurrence of '(5)' in zdcnfg with '+' replacement offset roff.
temp = roff - 1.
add zdcnfg+temp(1) to zdvd59.
enddo.
endif.
zdcnfg = static.
clear: roff, rcnt, temp.
replace all occurrences of '(9)' in zdcnfg with '+' replacement count rcnt.
if rcnt ge 1.
zdcnfg = static.
do rcnt times.
replace first occurrence of '(9)' in zdcnfg with '+' replacement offset roff.
temp = roff - 1.
add zdcnfg+temp(1) to zdvd59.
enddo.
endif.
zdcnfg = static.
clear: roff, rcnt, temp.
replace all occurrences of '(10)' in zdcnfg with '+' replacement count rcnt.
if rcnt ge 1.
zdcnfg = static.
do rcnt times.
replace first occurrence of '(10)' in zdcnfg with '+' replacement offset roff.
temp = roff - 1.
add zdcnfg+temp(1) to zdvd10.
enddo.
endif.
zdcnfg = static.
clear: roff, rcnt, temp.
replace all occurrences of '(14)' in zdcnfg with '+' replacement count rcnt.
if rcnt ge 1.
zdcnfg = static.
do rcnt times.
replace first occurrence of '(14)' in zdcnfg with '+' replacement offset roff.
temp = roff - 1.
add zdcnfg+temp(1) to zdvd14.
enddo.
endif.
zdcnfg = static.
clear: roff, rcnt, temp.
replace all occurrences of '(18)' in zdcnfg with '+' replacement count rcnt.
if rcnt ge 1.
zdcnfg = static.
do rcnt times.
replace first occurrence of '(18)' in zdcnfg with '+' replacement offset roff.
temp = roff - 1.
add zdcnfg+temp(1) to zdvd18.
enddo.
endif.
zdcnfg = static.
clear: roff, rcnt, temp.
replace all occurrences of '(25)' in zdcnfg with '+' replacement count rcnt.
if rcnt ge 1.
zdcnfg = static.
do rcnt times.
replace first occurrence of '(25)' in zdcnfg with '+' replacement offset roff.
temp = roff - 1.
add zdcnfg+temp(1) to zdvd25.
enddo.
endif.
zdcnfg = static.
clear: roff, rcnt, temp.
replace all occurrences of '(50)' in zdcnfg with '+' replacement count rcnt.
if rcnt ge 1.
zdcnfg = static.
do rcnt times.
replace first occurrence of '(50)' in zdcnfg with '+' replacement offset roff.
temp = roff - 1.
add zdcnfg+temp(1) to zdvd50.
enddo.
endif. -
Does key comparison work for character arrays?
I am using the berkeley db(C) to store a 2-column table with key as a character array(not strings). Even though I can see that a record is present when i display all records, I cant get that record using the get function with the correct key. Is there a problem with key comparison? How does berkeley db check two keys for equality? Is there a way around this?
thanks in advance.Hi,
Your code posting was messed up due to the indexed addressing (the i in square brackets) which is in fact the italic start tag. You can put some spaces inside the square brackets, and make sure to enclose your source code between pre tags ([ pre ] <code goes here> [ / pre ], remove the spaces).
So, I assume you are trying to store a line of the bi-dimensional char array.
key.data = a + i;
key.size = sizeof(a[ i ]);
// char *aa = "0a0s0d0f0g0h0j0k0l0q0w0e0r0t0y0f";(I've changed the name of this pointer to distinguish it from the array)
aa points to a sequence of chars (a string in fact) that should be the same as the ones in the line of the bi-dimensional char array, line that was stored as key in the database, right?
key.data = aa;
key.size = sizeof(aa);Now, here is the problem. aa is a pointer to char, thus sizeof(aa) is 2B or 4B (depending on the pointer type, near or far) on a 32-bit machine. So, you're performing the search looking only for the match of the first 2 or 4 chars. Change that line to key.size = strlen(aa); or key.size = sizeof(*(a + i)); (the same as key.size = sizeof(a[ i ]);, a being the char array).
Regards,
Andrei -
How to use "Working with Character-Type Operands" in FOX.
Hi, guru.
In project, I want to use formula for specific customers.
The customers those have 4 digit customer account.
SO, they have "000000XXXX" customer accout.
In FOX.
I want to use "IF" statements for distingush 4 digit customer and Others(other customers have 6 digit or more, not 4 digit or below).
SO. How can I express it, with CP, CO, CA, CS operands?
I think belows.
FOREACH CUSTOMER.
1. IF CUSTOMER CP '000000++++'.
2. IF CUSTOMER CP '000000****'.
3. IF CUSTOMER CO '000000 '.
ENDFOR.
What is right among 1, 2 and 3?I know about it, by using SUBSTR function.
But, I want to know to slove that situation by using CP, CO, CA, CS or other skills.
Thanks for your response. -
Hello Experts,
According to my requirement, the billing is being created without checking the operand for installation type. System is allowing to create the billing document if some operand is missing for installation type. How do we prevent from getting billing if some operand is missing for installation type.
Thanks in advance.
Regards,
K
Edited by: kv on Mar 1, 2011 10:46 AMHi,
To be honest I'm not sure what you mean. For example it's not possible to set value as required on operand level - you can do this only in facts. So one more time:
1. I'm going to any working installation and I can see that on facts everything is ok - it should be possible to be billed
[http://pokazywarka.pl/ibhg93/]
2. I'm going to EA50 and I'm creating operand
[http://pokazywarka.pl/7wk6su-2/]
3. Now I'm going to rate category that is used by my installation and now go to facts page. Here I add this operand and set it as required but leave value empty.
[http://pokazywarka.pl/nzw4a7/]
now i see it on red in rate category facts
[http://pokazywarka.pl/5so1xs/]
4. If i go once again to my installation on facts tab I can see that this operand has shown up with no value, so someone will have to set it before billing because it's obligatory
[http://pokazywarka.pl/rk7900/]
I hope now it's clear., because I'm out of ideas how to explain it simpler.
BR
Marcin Cholewczuk -
Non-character-type structure need to be written in ASCI File in Unicode sys
Hi Gurus,
I am trying to write a structure into a ASCI file iapplication server.
My code is as follows.
data : ls_header type BBP_PDS_CTR_HEADER_D ,
lv_filename TYPE rlgrap-filename VALUE '/interface/AEE/IN/kalandi'.
CALL FUNCTION 'BBP_PD_CTR_GETDETAIL'
EXPORTING
I_OBJECT_ID = '4000000196'
IMPORTING
E_HEADER = ls_header.
open dataset lv_filename for output in text mode encoding default .
if sy-subrc = 0.
transfer ls_header to lv_filename.
close dataset lv_filename.
endif.
but it ives a dump .
Error is :
"TRANSFER f TO ..."
only character-type data objects are supported at the argument position
"f".
In this case. the operand "f" has the non-character-type
"BBP_PDS_CTR_HEADER_D". The
current program is a Unicode program. In the Unicode context, the type
'X' or structures containing not only character-type components are
regarded as non-character-type.
Thanks a lot in advance.
Points will be awared for appropriate Answers.
Regards
kalandiHi,
I think here ls_header and lv_filename are not compatible to transfer the data.
Regards,
Satish -
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 -
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. -
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. -
Though I found LabVIEW very interesting , still some of its basic fundamentals are not clear, like using comparison operators (>,<,..) for solving different
mathematical expressions. Please give example showing how to use such operators in advanced mathematical problems.
Best Regards,
Allawiallawi1 wrote:
What I am looking for is how to use such functions in selecting different mathematical expressions i.e..(working like logical if statement).
You need to be more specific. A comparison operation IS like a logical IF statement and the result is either TRUE or FALSE.
What do you mean by a "mathematical expression"? What do you mean by "different"? Can you give an illustrative example?
If two alternative mathematical expressions should depend on the comparison, wire the comparison output to a case structure and place the two different expressions in their own case, for example.
LabVIEW Champion . Do more with less code and in less time . -
In the current version (2.1.0.63) I can perform only unit test for packages, function and procedures. But we use a lot of object types in the database and would like to test them. Is there any support for object types scheduled?
You can also use the original UT PLSQL package from sourceforge.
I have used this in the past for testing with file comparisons, table object output from procedures, etc.
We've also used the same setup for Oracle Forms code testing.
Dennis -
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. -
Selection Screen Validation for Character
Hi All
My query is regarding the selection screen validation for character.
I am using a Select-option: S_ORDER FOR VBAK-VBELN OBLIGATORY.
and S_order should be only having the numeric field.
Please help how to validate it for character field.Hi,
Do as below :
at selection-screen.
if not s_order[] is initial.
if s_order-low CA 'ABCDEF.............Z'.
message 'Enter only numerics only' type 'E'.
endif.
"similarly for s_order-high also.
endif.
Thanks,
Sriram Ponna. -
Field Seletion for movement type / acct differes for BA
dear all
while posting in MM the user is facing the problem and error message
Field Seletion for movement type / acct differes for BA
please let me know if i can do some thing with Field status variant in FI
I am not able to figure this outIf you Run Program RM07CUFA in SE38 and compare movement type and GL you can see the
comparison of the field status variant of the movement type and GL
Hope this will resolve your issue
Bilal
Maybe you are looking for
-
Material staging time in sales order
Hi, I was trying to implement work times for shipping point and came across this scenario. I have an order that is past due. I have moved in plenty of stock so that a MAD of today is possible. There is no pick pack/Loading or transportaion scheduli
-
Connection to VPN doesn't work with exclamation mark on Network symbol
Hello everyone, I'm new to this forum and not really professional in VPN stuff, though I'm an experienced computer user and programmer. I'm using Cisco VPN 5.0.07.0440-k9-x64 from the Paul Scherrer Institute on Windows 8 64-bit. The program was worki
-
Mail sent from android phone does not appear in my pc icloud sent mail
Can anyone educate me on why my mac mail sent from my android does not appear in my pc icloud mail as sent?
-
Don't upgrade to X.4.9 if using WAVES plugins.
This may be of interest to many. If anyone has taken the leap, maybe you could share your experiences. From what I have read around the place, it is more of a problem if running on Intel. http://www.wavesupport.net/Content.aspx?id=2287
-
Broadcasting in BI 7.x - Do I need Portal, Missing Distribution Types
Hi, I'm looking into getting Broadcasting up and running. Errors abound of course. Could someone help with these questions? 1. Do I need Portal to do email broadcasting of HTML/MHTML? I was under the impression I only needed precalc server for