2012 Aug 31 3:06 PM
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
2012 Aug 31 6:16 PM
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
2012 Sep 03 9:28 AM
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.
-----------------------------------------------------
ARC_BUFFER is a structure.
-------------------------------------------------------------------------------
If you required anything else please let me know.
Regards,
Arpit
2012 Sep 03 9:56 AM
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