Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Unicode error

Former Member
0 Likes
1,872

Hi All,

I have an internal table

DATA: IT_DATA(2048) TYPE C OCCURS 1 WITH HEADER LINE.

Im trying to do this on certain conditions

APPEND LINES OF IT_DATA TO I_EIPO_A.

Similarly im doing this for I_KONV_A, I_NAST_A, I_VBFA_A internal tables.

Where I_EIPO_A is declared as

DATA: BEGIN OF I_EIPO_A OCCURS 0.

INCLUDE STRUCTURE EIPO .

DATA: END OF I_EIPO_A.

And similarily are the internal tables I_KONV_A, I_NAST_A, I_VBFA_A

Im getting a Unicode error as "I_EIPO_A" and "IT_DATA" are not mutually convertible in a Unicode program,

I have a solution that we need to declare all the fields in the internal tables as Type C

Is there any other solution other than this??

keerthi

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,661

Hi

Yes u can use the field-symbols and MOVE statament, something like this:

DATA: IT_DATA(2048) TYPE C OCCURS 1 WITH HEADER LINE.
DATA: DFIES_TAB TYPE STANDARD TABLE OF DFIES WITH HEADER LINE.

DATA: I_EIPO_A TYPE STANDARD TABLE OF EIPO WITH HEADER LINE.



CALL FUNCTION 'DDIF_FIELDINFO_GET'
     EXPORTING
          TABNAME   = 'EIPO'
     TABLES
          DFIES_TAB = DFIES_TAB.

FIELD-SYMBOLS: <FS> TYPE ANY.

LOOP AT IT_DATA.
  LOOP AT DFIES_TAB.
   ASSIGN COMPONENT DFIES_TAB-FIELDNAME OF STRUCTURE I_EIPO_A TO <FS>.
    MOVE IT_DATA+DFIES_TAB-OFFSET(DFIES_TAB-LENG) TO <FS>.
  ENDLOOP.
  APPEND I_EIPO_A.
ENDLOOP.

Max

15 REPLIES 15
Read only

Former Member
0 Likes
1,661

Hi,

In Unicode Enabled Systems, you can not just copy two tables with different structures. Both the tables should have same structure. Now, in your case, it_data & i_eipo_a have different structures. Therefore, you are getting an Unicode Error.

To solve your problem,

- declare it_data same like it_eipo_a.

OR

- declare a work area of type it_eipo_a. Then, using SPLIT, split it_data into various fields of the work area & then append this work area to it_eipo_a.

Regards,

Mukul

Message was edited by:

Mukul R. Kulkarni

Read only

Former Member
0 Likes
1,662

Hi

Yes u can use the field-symbols and MOVE statament, something like this:

DATA: IT_DATA(2048) TYPE C OCCURS 1 WITH HEADER LINE.
DATA: DFIES_TAB TYPE STANDARD TABLE OF DFIES WITH HEADER LINE.

DATA: I_EIPO_A TYPE STANDARD TABLE OF EIPO WITH HEADER LINE.



CALL FUNCTION 'DDIF_FIELDINFO_GET'
     EXPORTING
          TABNAME   = 'EIPO'
     TABLES
          DFIES_TAB = DFIES_TAB.

FIELD-SYMBOLS: <FS> TYPE ANY.

LOOP AT IT_DATA.
  LOOP AT DFIES_TAB.
   ASSIGN COMPONENT DFIES_TAB-FIELDNAME OF STRUCTURE I_EIPO_A TO <FS>.
    MOVE IT_DATA+DFIES_TAB-OFFSET(DFIES_TAB-LENG) TO <FS>.
  ENDLOOP.
  APPEND I_EIPO_A.
ENDLOOP.

Max

Read only

0 Likes
1,661

hi max,

CALL FUNCTION 'DDIF_FIELDINFO_GET'

EXPORTING

TABNAME = 'VBRK'

TABLES

DFIES_TAB = DFIES_TAB.

FIELD-SYMBOLS: <FS> TYPE ANY.

LOOP AT IT_DATA.

LOOP AT DFIES_TAB.

ASSIGN COMPONENT DFIES_TAB-FIELDNAME OF STRUCTURE I_VBRK_A TO <FS>.

MOVE IT_DATA+DFIES_TAB-OFFSET(DFIES_TAB-LENG) TO <FS>.

ENDLOOP.

APPEND I_VBRK_A.

ENDLOOP.

with the code u had given, its giving a dump for a particular field KURRF as

Unable to interpret " " as a number, because the value for this field in the it_data is space...

so how to resolve this???

Read only

Former Member
0 Likes
1,661

please can anyone provide a solution???????its urgent

Message was edited by:

keerthi kiran varanasi

Read only

Former Member
0 Likes
1,661

Am sorry if this answer sounds dumb coz am new to ABAP and was just wondering if this would work. Can you try running your report by unchecking the "Use Unicode Check" in the In the program---> Attributes screen....

Thanks,

Uday

Read only

0 Likes
1,661

hi uday,

if i had unchecked that option i wouldn't have got this dump:-)....but sorry thats not the answer i want.

Read only

0 Likes
1,661

Hi

The problem is on the format of the number in the file: the SAP just only want the point as separator between integer and decimal part.

So if you have 1.000,10 => 1000.10

U can check the type of the field, and so decide which action to be done to convert the number:

LOOP AT IT_DATA.
  LOOP AT DFIES_TAB.
   ASSIGN COMPONENT DFIES_TAB-FIELDNAME OF STRUCTURE I_EIPO_A TO <FS>.
"--- Check the ABAP TYPE:
    IF DFIES_TAB-INTTYPE = 'P' OR
       DFIES_TAB-INTTYPE = 'F'.
"--- It means the data is a number with decimals: how to convert the number 
"--- depend on how it's written on the file, if you have 1.150,00    
      DO.
"--- Delete the points
        REPLACE '.' WITH SPACE INTO IT_DATA+DFIES_TAB-OFFSET(DFIES_TAB-LENG).
        IF SY-SUBRC <> 0. EXIT. ENDIF. 
        CONDENSE IT_DATA+DFIES_TAB-OFFSET(DFIES_TAB-LENG) NO-GAPS.
      ENDDO.
      REPLACE ',' WITH '.' INTO IT_DATA+DFIES_TAB-OFFSET(DFIES_TAB-LENG). 
      IF IF IT_DATA+DFIES_TAB-OFFSET(DFIES_TAB-LENG) IS INITIAL.
        MOVE '0' TO IT_DATA+DFIES_TAB-OFFSET(DFIES_TAB-LENG).
      ENDIF.    
    ENDIF. 
    MOVE IT_DATA+DFIES_TAB-OFFSET(DFIES_TAB-LENG) TO <FS>.
  ENDLOOP.
  APPEND I_EIPO_A.
ENDLOOP.

Max

Read only

0 Likes
1,661

hi,

For the field KURRF the value in IT_DATA+DFIES_TAB-OFFSET(DFIES_TAB-LENG) it's taking as #### 000 because of which it's still going for a dump, inspite of checking..

IF IT_DATA+DFIES_TAB-OFFSET(DFIES_TAB-LENG) IS INITIAL.

how to correct this dump??

Read only

0 Likes
1,661

Hi

Just only a question: but you're dowloading the data from table (database) to internal (char) table or from internal (char) table to database.

Max

Read only

0 Likes
1,661

hi,

i have data in a internal table it_data which is declared as

IT_DATA(2048) TYPE C OCCURS 1 WITH HEADER LINE,

im trying to append the values in it_data to another internal table on certain conditions...i had tried with the code u had given but still its going for a dump

how to correct when its taking junk characters at runtime..

Read only

0 Likes
1,661

HI

I believe the problem is how the numeriv fields are loaded on IT_DATA, where and how this table is filled?

Max

Read only

0 Likes
1,661

hi,

im getting the data into IT_DATA as

call function 'ARCHIVE_GET_NEXT_RECORD'

exporting

archive_handle = v_read_handle

importing

record = it_data

record_structure = v_structure

exceptions

end_of_object = 1.

case v_structure.

when 'VBRK'.

CALL FUNCTION 'DDIF_FIELDINFO_GET'

EXPORTING

TABNAME = 'EIPO'

TABLES

DFIES_TAB = DFIES_TAB.

FIELD-SYMBOLS: <FS> TYPE ANY.

LOOP AT IT_DATA.

LOOP AT DFIES_TAB.

ASSIGN COMPONENT DFIES_TAB-FIELDNAME OF STRUCTURE I_VBRK_A TO <FS>.

MOVE IT_DATA+DFIES_TAB-OFFSET(DFIES_TAB-LENG) TO <FS>.

ENDLOOP.

APPEND I_VBRK_A.

ENDLOOP.

Read only

0 Likes
1,661

Hi

So I suppose the code should be:

LOOP AT IT_DATA.
  LOOP AT DFIES_TAB.
     ASSIGN COMPONENT DFIES_TAB-FIELDNAME OF STRUCTURE I_VBRK_A TO <FS>.
*   MOVE IT_DATA+DFIES_TAB-OFFSET(DFIES_TAB-LENG) TO <FS>.
    MOVE IT_DATA-SEGMENT+DFIES_TAB-OFFSET(DFIES_TAB-LENG) TO <FS>.
   ENDLOOP.
  APPEND I_VBRK_A.
ENDLOOP.

Max

Read only

0 Likes
1,661

hi max,

i didnt understand, IT_DATA-SEGMENT?? the table it_data does not have any segment..

can u explain me.. more clearly....

anybody has any solution???

Message was edited by:

keerthi kiran varanasi

Read only

0 Likes
1,661

Hi

Excuse me! I have mistaken, I confused the structure of the interfaces.

Anyway U can check the format of the original data.

I saw the report RASHSD03 here perhaps you can find out something can help you:

DATA: XVBRK LIKE VBRK OCCURS 0 WITH HEADER LINE.

*&---------------------------------------------------------------------*
*&      Form  GET_ONE_ENTRY_FROM_ARCHIVE
*&---------------------------------------------------------------------*
*       Explzit einen Eintrag aus dem Archiv holen VBRK                *
*----------------------------------------------------------------------*
FORM GET_ONE_ENTRY_FROM_ARCHIVE.

*.get object
  CALL FUNCTION 'ARCHIVE_READ_OBJECT'
       EXPORTING
            OBJECT         = 'SD_VBRK'
            ARCHIVKEY      = LT_RESULT-ARCHIVEKEY
            OFFSET         = LT_RESULT-ARCHIVEOFS
       IMPORTING
            ARCHIVE_HANDLE = HANDLE
       EXCEPTIONS
            OTHERS         = 1.

  IF SY-SUBRC <> 0.

*   message id sy-msgid type 'S' number sy-msgno with
*                sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    EXIT.
  ELSE.

    DO.
*.get records
      CALL FUNCTION 'ARCHIVE_GET_NEXT_RECORD'
           EXPORTING
                ARCHIVE_HANDLE   = HANDLE
           IMPORTING
                RECORD           = DATA
                RECORD_STRUCTURE = STRUCTURE
           EXCEPTIONS
                END_OF_OBJECT    = 1.

      IF SY-SUBRC <> 0.
        EXIT.
      ENDIF.

*.move records (relation-entries - subsequent data)
      CASE STRUCTURE.
*.move records (relation-entries - preceding data)
        WHEN 'VBRK'.
          XVBRK = DATA. APPEND XVBRK.  "billing document
          EXIT.
      ENDCASE.

    ENDDO.

    CALL FUNCTION 'ARCHIVE_CLOSE_FILE'
         EXPORTING
              ARCHIVE_HANDLE = HANDLE.

  ENDIF.

ENDFORM.                               " GET_ONE_ENTRY_FROM_ARCHIVE

Max