‎2006 Mar 21 5:59 PM
Hi,
I am having an Unicode problem. I have an Internal table as follows.
DATA: BEGIN OF iedid4 OCCURS 10.
INCLUDE STRUCTURE edid4.
DATA: END OF iedid4.A structure is as follows:
DATA: wa_firstline(1000),
wa_header LIKE e1bpache04,
wa_gl_line_item LIKE e1bpacgl04,
wa_curr_fields LIKE e1bpaccr04,
infname LIKE ibipparms-path,
idocnum LIKE edid4-docnum,
pdcount LIKE zpdcount-runcount,
trans_date LIKE sy-datum,
pp_end_date LIKE sy-datum,
recon_docnum(10),
o_path LIKE filename-fileintern,
t_runid LIKE pevsh-runid,
&pernr LIKE ppdit-pernr.When I call the following statement,
READ TABLE iedid4 INTO wa_firstline INDEX 1I am getting the following error.
A line of "IEDID4" and "WA_FIRSTLINE" are not mutually convertible in a Unicode program.
Can somebody help me out?.
Thanks,
Raj.
‎2006 Mar 21 7:15 PM
Raj,
As a "golden rule", you should avoid changing data defs at all costs. IF it must be done, it must be done carefully.
This program is changing values into type CHAR, for example, from INT. This is very dangerous.
After the Unicode conversion, you might want to re-visit this program and do some house-cleaning on it.
‎2006 Mar 21 6:03 PM
In unicode systems, they have to have the same structures. Since you declared the internal table IEDID4 with header line, you don't need the additional INTO clause with your READ statement. You can do this.
READ TABLE iedid4 INDEX 1.
wa_firstline = i_edid4.
or declare 'wa_firstline' like iedid4.
‎2006 Mar 21 6:03 PM
iedid4 and wa_firstline MUST be of the same type in Unicode.
Declare like this:
data: wa_firstline type edid4.
Reward points as well.
‎2006 Mar 21 6:18 PM
What about length of wa_firstline(1000)?.
Srinvas, i think we should use type instead of like.
I have another statement I modified as both of you mentione like this,
READ TABLE iedid4 INDEX 2.
wa_inrec = iedid4.the structure of wa_inrec is as follows,
DATA: wa_inrec TYPE inrec,the structure of inrec is as follows,
TYPES: BEGIN OF inrec ,
data(1000),
END OF inrec.Here also I get the same error,
"WA_INREC" and "IEDID4" are not mutually convertible. In Unicode
Thanksa-a-lot for you help Srinavas, and John.
Raj.
Message was edited by: Raj
‎2006 Mar 21 6:22 PM
‎2006 Mar 21 6:35 PM
Hi John,
inrec is an internal table, how can I declare it as data: inrec type iedid4 ?.
Thanks,
Raj.
‎2006 Mar 21 6:40 PM
In this defintion:
TYPES: BEGIN OF inrec ,
data(1000),
END OF inrec.
inrec is NOT an internal table. It is a simple, custom-built data type.
data: in_tbl type table of inrec with header line.
would be an internal table of TYPE inrec.
‎2006 Mar 21 6:43 PM
Hi Raj,
John is talking about the wa_inrec. Basically you cannot move the contents of your internal table record to a flat structure of 1000 characters particularly if the EDID4 structure has non-character like fields. The problem is with the field DTINT2 of this structure. I think you actually need to do MOVE IEDID4-SDATA TO WA_INREC. Then it will be fine.
TYPES: BEGIN OF inrec ,
data(1000),
END OF inrec.
DATA: BEGIN OF iedid4 OCCURS 10.
INCLUDE STRUCTURE edid4.
DATA: END OF iedid4.
DATA: wa_inrec TYPE inrec.
READ TABLE iedid4 INDEX 2.
wa_inrec = iedid4-sdata.
‎2006 Mar 21 7:02 PM
Srinivas and John,
Thanks for the help. Ya that suggestion worked. But In other statement like this,
MOVE wa_firstline+68(932) TO wa_header.
It throws me an error like this,
The offset declaration "68" exceeds the length of the character-type start (=66) of the structure. This is not allowed in Unicode programs.
Thanks-a-lot.
Raj.
‎2006 Mar 21 7:12 PM
What is the latest definition of your wa_firstline? Is it same as EDID4?
In that case, as I explained, you still have to avoid the field DTINT2. The total length of all the fields upto this field(MANDT, DOCNUM, COUNTER, SEGNUM, SEGNAM, PSGNUM, HLEVEL) = 66. This field is 5 characters,. So you should write your statment as
MOVE wa_firstline+71(929) TO wa_header.
changed the offset length.
Message was edited by: Srinivas Adavi
‎2006 Mar 21 7:13 PM
In your system, what is "wa_header" declared as... wa_header LIKE e1bpache04 ?
If so, not sure of your R/3 version... please send the def of e1bpache04.
‎2006 Mar 21 7:17 PM
Look at the long text of the error message and then click on the 'Rules for Converting to Unicode'. Here it explains that if you are moving like this, the types of the fields of source should be compatible with that of the target. So if you look at your statement, wa_firstline+68(932) has two initial characters which are of integer type while the target has the first two initial characters as character type.
Srinivas
‎2006 Mar 21 8:31 PM
John,
The wa-header is declared as e1bpache04 only.
Srinivas,
Whats the way to go now?. I tried with offset wa_firstline+71(929), its not correct.
Thanks,
Raj.
‎2006 Mar 21 8:38 PM
ok let us go back to the basics and see. What is it that you are trying to achieve by moving this offset to wa_header? I thought you want to move the IDoc data to this structure, then you have to simply do this.
wa_header = wa_firstline-sdata.
sdata is the field that will always contain the actual data. All other fields of EDID4 are just control information that you don't need for your processing.
Can you please your latest code again and also specify the requirement?
Srinivas
‎2006 Mar 21 10:12 PM
Hi Srinas, Thanks for the help. Please find the code as follows.
FORM convert_idoc.
DATA: totallines TYPE i,
currline TYPE i,
offsetline TYPE i,
offset TYPE i.
* REad FIrstLine
* read table itab_inrecs into wa_firstline index 1.
READ TABLE iedid4 INDEX 1.
wa_firstline = iedid4.
* Read Header
* read table itab_inrecs into wa_inrec index 2.
READ TABLE iedid4 INDEX 2.
wa_inrec = iedid4-sdata.
* move wa_inrec-data+63 to wa_header.
MOVE wa_firstline+68(932) TO wa_header.
* get total lines
DESCRIBE TABLE iedid4 LINES totallines.
currline = 2. " sy-tabix
offset = ( totallines - 2 ) / 2.
totallines = currline + offset.
WHILE currline < totallines.
offsetline = currline + offset.
READ TABLE iedid4 INTO wa_inrec INDEX currline.
* read table itab_inrecs into wa_inrec index currline.
MOVE wa_inrec-data+68 TO wa_gl_line_item.
IF wa_gl_line_item-gl_account = '1339003000' OR
wa_gl_line_item-gl_account = '1339001000'.
currline = currline + 1.
CLEAR: wa_gl_line_item, wa_inrec.
CONTINUE.
ENDIF.
READ TABLE iedid4 INTO wa_inrec INDEX offsetline .
MOVE wa_inrec-data+68 TO wa_curr_fields.
PERFORM build_outrec.
currline = currline + 1.
ENDWHILE.
ENDFORM. " CONVERT_IDOC
‎2006 Mar 21 7:15 PM
Raj,
As a "golden rule", you should avoid changing data defs at all costs. IF it must be done, it must be done carefully.
This program is changing values into type CHAR, for example, from INT. This is very dangerous.
After the Unicode conversion, you might want to re-visit this program and do some house-cleaning on it.