Skip to Content
author's profile photo Former Member
Former Member

Unicode structure problem

Hello

I was hoping someone could help me with this Unicode problem.

In the non-unicode system we have the following ABAP:

FIELD-SYMBOLS: <RECORD_STRUCTURE>.

DATA: P_IT_RAW(1000).

F_RECORD_TYPE = ‘HDR’.

ASSIGN (F_RECORD_TYPE) TO <RECORD_STRUCTURE>

P_IT_RAW = <RECORD_STRUCTURE>. <== Unicode runtime error

Basically the structure of HDR is all different types of fields, such as CHAR, DATS, INT4, NUMC etc…

Whats the recommend way to copy "CHAR, DATS, INT4, NUMC" fields “in” and “out” of character structures in a Unicode system.

This is the code that fails when we try to copy a character field over a field that contains CHAR, DATS, INT4, NUMC…

<RECORD_STRUCTURE> = P_IT_RAW. <== Unicode runtime error

Thanks in advance

Peter

PS: To replace the:

P_IT_RAW = <RECORD_STRUCTURE>.

I have been using the follow code:

data: f_compcnt TYPE i,

f_comptype(1) TYPE c,

f_field_len type i,

f_total_write_len type i,

f_temp_str(1000) type c,

f_compcnt2 TYPE i,

f_comptype2(1) TYPE c.

field-symbols : <comp> TYPE ANY.

clear: f_field_len.

f_total_write_len = 0.

DESCRIBE FIELD <RECORD_STRUCTURE> TYPE f_comptype COMPONENTS f_compcnt.

DO f_compcnt TIMES.

ASSIGN COMPONENT sy-index OF STRUCTURE <RECORD_STRUCTURE> TO <comp>.

P_IT_RAW+f_total_write_len = <comp>.

describe field <comp> output-length f_field_len.

f_total_write_len = f_total_write_len + f_field_len.

ENDDO.

But how do I get data back out of the P_IT_RAW field into a structured field?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 06, 2005 at 04:17 AM

    either do casting or use different variables for receiving different type of variable from field symbol

    regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 06, 2005 at 04:25 AM

    Hi Peter,

    You can only solve this issue by definining only char fields in HDR . You can define INT4 fields with char fields of same name with length equal to output length.

    You can fill INT4 ( defined as CHAR) field using Write To . DATS/ NUMC are char fields so should not be an issue .

    Cheers

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 06, 2005 at 04:23 AM

    or you could simply switch off the uni-code check in the program attributes ....

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.