10-15-2007 8:16 AM
Hi all,
This is regarding a Unicode error we are facing in upgrading a program from 4.6c to ECC6.0.
The following pice of code gives error now in ECC6.0, stating Unicode incompatible structures.
DATA: WA_MSEG TYPE MSEG,
WA_MKPF TYPE MKPF.
DATA: LE_DATA(8192) TYPE C.
CALL FUNCTION 'ARCHIVE_GET_NEXT_RECORD'
EXPORTING
ARCHIVE_HANDLE = LE_HANDLE
GET_REAL_STRUCTURE_NAME = 'X'
AUTOMATIC_CONVERSION = 'X'
IMPORTING
RECORD = LE_DATA
RECORD_CURSOR =
RECORD_FLAGS =
RECORD_STRUCTURE = LE_STRUCTURE
RECORD_LENGTH =
EXCEPTIONS
END_OF_OBJECT = 1
INTERNAL_ERROR = 2
WRONG_ACCESS_TO_ARCHIVE = 3
OTHERS = 4
.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
move records
CASE LE_STRUCTURE.
WHEN 'MSEG'.
<b> WA_MSEG = LE_DATA.</b>
move-corresponding WA_MSEG to TBL_ARC_MSEG.
APPEND TBL_ARC_MSEG.
CLEAR: WA_MSEG, LE_DATA, TBL_ARC_MSEG.
WHEN 'MKPF'.
<b> WA_MKPF = LE_DATA.</b>
move-corresponding WA_MKPF to TBL_ARC_MKPF.
APPEND TBL_ARC_MKPF.
CLEAR: WA_MKPF, LE_DATA, TBL_ARC_MKPF.
ENDCASE.
Can you please suggest a way to overcome this error.
Thanks in advance,
Sreenivasa Reddy V.
10-15-2007 8:50 AM
try this FM:
CALL FUNCTION 'OIF_CONVERT_CHAR_TO_STRUCTURE'
EXPORTING
iv_string = le_data
iv_structure_name = 'MSEG'
iv_offset = w_len
IMPORTING
ev_structure = wa_mseg
ev_offset = w_len
EXCEPTIONS
ddif_nametab_get = 1
OTHERS = 2.
Hope That Helps
Anirban M.
10-15-2007 10:18 AM
Hi Anirban,
Your solution seems very helpful for me.
Could you please explain me the role of 'offset' here.
Thanks in advance
Sreenivasa Reddy V.
10-15-2007 10:42 AM
IV_OFFSET is the position from the C field will be started to be read (should be 0) and EV_OFFSET is the length to which the data is going to be fetched. The Following code could be useful ---
w_len = STRLEN( p_data ).
CALL FUNCTION 'OIF_CONVERT_CHAR_TO_STRUCTURE'
EXPORTING
iv_string = p_data
iv_structure_name = 'VBAK'
* iv_offset = w_len
IMPORTING
ev_structure = wa_vbak
ev_offset = w_len
EXCEPTIONS
ddif_nametab_get = 1
OTHERS = 2.
Hope That Helps
Anirban M.
10-15-2007 8:59 AM
Hi,
In Unicode compatible programs two dissimilar structures cannot be equated.
So firstly you will have to <b>split</b> the LE_DATA into a structure similar to MSEG and MKPF then only you can pass values to WA_MSEG and WA_MKPF .
Regards,
Amit
10-15-2007 9:02 AM
Hi,
WA_MSEG = LE_DATA.
You can't pass this way.
Try like,
WA_MSEG<b>-field1</b> = LE_DATA.
Thanks,
Reward If Helpful.
10-15-2007 10:26 AM
Hi
MSEG is a structure
and le_data is a character type field.
how can u move this character to the whole structure? just think, the structure will have many fields, this character field, where it gets stored.
it is not possible.