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

Syntax error..Not mutually convertible in a Unicode program.

arpit_shah9
Explorer
0 Likes
695

Hello Experts,

I am getting below syntax error in my custom Z report,

Program ZUMSATZ_JE_KOSTENART

"GW_BKPF_PBS" and "ARC_BUFFER-SEGMENT" are not mutually convertible in a Unicode program. .

Code snippets are below,

---------------------------------------------------------------------------------------------------------------

  CASE arc_buffer-rname.

  WHEN 'BKPF'.
     
gw_bkpf_pbs = arc_buffer-segment.<------ Here is the error line

   MOVE arc_buffer-segment TO gw_bkpf_pbs.
   
IF gw_bkpf_pbs-bukrs =  p_bukrs AND
      gw_bkpf_pbs-gjahr =  p_gjahr
AND
      gw_bkpf_pbs-blart =  r_blart
AND
      gw_bkpf_pbs-budat
IN s_budat AND
      gw_bkpf_pbs-belnr
IN s_belnr.

----------------------------------------------------------------------------------------------------------------

Help will be rewarded by points, Thanks!

Regards,

Arpit

3 REPLIES 3
Read only

amy_king
Active Contributor
0 Likes
633

Hi Arpit,

What are the data types used to define your variables, gw_bkpf_pbs and arc_buffer-segment? The runtime isn't able to cast on-the-fly the values or structure in arc_buffer-segment to the data type used by gw_bkpf_pbs.

Cheers,

Amy

Read only

0 Likes
633

Hey Amy,

Please find below the same, (This code snippet is from ECC 4.6)

gw_bkpf_pbs = arc_buffer-segment

-----------------------------------------------------

DATA: BEGIN OF gt_bkpf_pbs OCCURS 10.
INCLUDE STRUCTURE bkpf.
DATA:
END OF gt_bkpf_pbs.

DATA: gw_bkpf_pbs LIKE LINE OF gt_bkpf_pbs.

-----------------------------------------------------

  1. arc_buffer-segment---à Data type MAX_SEGM

ARC_BUFFER is a structure.

-------------------------------------------------------------------------------

If you required anything else please let me know.

Regards,

Arpit

Read only

Former Member
0 Likes
633

You cannot pass the segment values directly to a structure.

Use this to copy value from the segment to structure.

   CALL METHOD cl_abap_container_utilities=>read_container_c
  EXPORTING
    im_container           = arc_buffer-segment
  IMPORTING
    ex_value               = gw_bkpf_pbs
  EXCEPTIONS
    illegal_parameter_type = 1
    OTHERS                 = 2.

Thanks,

Shambu