2009 Mar 25 10:55 AM
Hi all,
The below code gives an unicde error.
Please give your inputs.
Code:
DATA: hexfield0 TYPE x VALUE 'FF'.
TYPES: BEGIN OF ty_belnr,
belnr TYPE bkpf-belnr,
END OF ty_belnr.
DATA it_tab TYPE TABLE OF ty_belnr.
DATA wa_tab TYPE ty_belnr.
SELECT belnr FROM bkpf UP TO 10 ROWS
INTO TABLE it_tab.
IF sy-subrc = 0.
LOOP AT it_tab into wa_tab.
If not wa_tab-Belnr z Hexfield0.
Write wa_tab-Belnr.
Endif.
ENDLOOP.
ENDIF.
Thanks.
Hi all,
The below code gives an unicde error.
Please give your inputs.
Code:
DATA: hexfield0 TYPE x VALUE 'FF'.
TYPES: BEGIN OF ty_belnr,
belnr TYPE bkpf-belnr,
END OF ty_belnr.
DATA it_tab TYPE TABLE OF ty_belnr.
DATA wa_tab TYPE ty_belnr.
SELECT belnr FROM bkpf UP TO 10 ROWS
INTO TABLE it_tab.
IF sy-subrc = 0.
LOOP AT it_tab into wa_tab.
If not wa_tab-Belnr z Hexfield0.
Write wa_tab-Belnr.
Endif.
ENDLOOP.
ENDIF.
Thanks.
2009 Mar 25 11:00 AM
Hi,
For similar kind of error, here iam giving example code.
Error: DATA: BEGIN OF ht,
x(1) TYPE x VALUE '09',
END OF ht.
Solution:
1.Define Class after the Tables definition.
CLASS cl_abap_char_utilities DEFINITION LOAD.
2.Data Defination : Comment internal table HT and define a variabl
HT type C.
Insert + APRIA00 05/02/2007 Unicode project
DATA: BEGIN OF ht,
x(1) TYPE x VALUE '09'
END OF ht.
Insert - APRIA00 05/02/2007 Unicode project
DATA HT type C.
3. Before using HT assign Horizontal tab.
Ht = CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
Do let me know if you have any queries.
Regards
Arani Bhaskar
2009 Mar 25 11:03 AM
Hi,
The if condition in my code is as follows.
Z is used as operator.
please let me know how to deal with this.
If not wa_tab-Belnr z Hexfield0.
2009 Mar 25 11:03 AM
Pl. re-check ur code again
DATA: hexfield0 TYPE x VALUE 'FF'.
TYPES: BEGIN OF ty_belnr,
belnr type bkpf-belnr,
END OF ty_belnr.
DATA it_tab TYPE TABLE OF ty_belnr.
DATA wa_tab TYPE ty_belnr.
SELECT belnr FROM bkpf
UP TO 10 ROWS
INTO TABLE it_tab.
IF sy-subrc = 0.
LOOP AT it_tab into wa_tab.
If not wa_tab-Belnr = Hexfield0.
Write wa_tab-Belnr.
Endif.
ENDLOOP.
ENDIF.
2009 Mar 25 11:14 AM
Hi,
I need to solve the Unicode error here.
Z if you replace by = , the functionality will change.
Z operator cannot be replaced here.
2009 Mar 25 11:19 AM
Hi purshotaman,
I am sure that , check once again that code,
functionality of "z" operator is ::
Zeros: True, if the bits that are 1 in operand2 are 0 in operand1. If operand2 contains only zeroes, the logical expression is always true.
Problem is not with Z, i guess it will be with type "x". try to convert it what i said earlier and check it out.
Regards
Arani Bhaskar
2009 Mar 25 11:25 AM
Hi,
You cannot compare the char field with the Hexa field in the Unicode version..so you need to convert the Hexa field Hexfield0 in to char field and compare. Use the FM STPU1_HEX_TO_CHAR to the char value of the hexasting and compare with Belnr .
2009 Mar 25 11:26 AM
DATA: hexfield0 TYPE x VALUE 'FF'.
DATA: hexfield1 TYPE x .
TYPES: BEGIN OF ty_belnr,
belnr TYPE bkpf-belnr,
END OF ty_belnr.
DATA it_tab TYPE TABLE OF ty_belnr.
DATA wa_tab TYPE ty_belnr.
SELECT belnr FROM bkpf UP TO 10 ROWS
INTO TABLE it_tab.
IF sy-subrc = 0.
LOOP AT it_tab into wa_tab.
hexfield1 = wa_tab-Belnr.
If not hexfield1 z Hexfield0.
Write wa_tab-Belnr.
Endif.
ENDLOOP.
ENDIF.
"Though u can avoid errors..you can recheck with the requirement
Cheers
Edited by: Mukundan Ramanathan on Mar 25, 2009 12:28 PM
2009 Mar 25 11:08 AM
HI,
Check this Code..
TYPES: BEGIN OF ty_belnr,
belnr TYPE bkpf-belnr,
END OF ty_belnr.
DATA it_tab TYPE TABLE OF ty_belnr.
DATA wa_tab TYPE ty_belnr.
DATA: l_Char(5) TYPE c .
DATA: c_Hexl(5) TYPE c value '\X\FF' .
CALL FUNCTION 'STPU1_HEX_TO_CHAR'
EXPORTING
hex_string = c_hec
IMPORTING
CHAR_STRING = l_char.
SELECT belnr FROM bkpf UP TO 10 ROWS
INTO TABLE it_tab.
IF sy-subrc = 0.
LOOP AT it_tab into wa_tab.
If not wa_tab-Belnr Z l_Char.
Write wa_tab-Belnr.
Endif.
ENDLOOP.
ENDIF.
2009 Mar 25 11:20 AM
Thanks.
But here i am checking with a hexadecimal value 'FF'.
and the operator is Z .
The functionality should remain the same.
The unicode error needs to be resolved.
Thanks. Kindly suggest.
2009 Mar 25 11:29 AM
Hi,
first convert your hexadecimal field to C by following my steps, then use your code it will works fine.
Regards
Arani Bhaskar
2009 Mar 25 12:01 PM
STPU1_HEX_TO_CHAR function module takes character as input.
Looking if there are any FM that would convert X to C.
Literally BKPF-BELNR "10 Char" to hexadecimal.
Or Hexdecimal value 'FF' to Char.
Tried using the Fm, its dumping. Trying other options.
Thanks.
2009 Mar 25 11:27 AM
belnr data type is chara length 10
and hexfield0 TYPE x hexadecimal
since the data type is mismatching hence it is showing the error.
2009 Mar 25 11:41 AM
DATA: hexfield0 TYPE x VALUE 'FF'.
TYPES: BEGIN OF ty_belnr,
belnr TYPE bkpf-belnr,
END OF ty_belnr.
class CL_ABAP_CONV_IN_CE definition load. "class for hex to char conversion
data lv_Hexfield0_uc type c. " field for storing hex value in char format
DATA it_tab TYPE TABLE OF ty_belnr.
DATA wa_tab TYPE ty_belnr.
SELECT belnr FROM bkpf UP TO 10 ROWS
INTO TABLE it_tab.
IF sy-subrc = 0.
lv_Hexfield0_uc = CL_ABAP_CONV_IN_CE=>UCCP('FF'). " conv HEX to C.
LOOP AT it_tab into wa_tab.
If not wa_tab-Belnr z lv_Hexfield0_uc. " use of lv_hexfield...
Write wa_tab-Belnr.
Endif.
ENDLOOP.
ENDIF.
2009 Mar 25 12:07 PM
Hi,
lv_Hexfield0_uc = CL_ABAP_CONV_IN_CE=>UCCP('FF'). " conv HEX to C.
is still giving the same error.
It says wa_tab-Belnr must be a byte-type field. ( type X or XSTRING).
I guess this is due to the Operator they used "Z" in the system.
2009 Mar 25 12:42 PM
then u need to convert the character field into X.
suppose ur char field is wa-axx and Hexa field is hex, then.......
field-symbols: <lv> type X.
assign: wa-axx to <lv> casting.
if <lv> Z hex.
//ur code.
endif.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |