Application Development 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: 

Assign a complex structure (with CHAR and DEC type fields for example) to a char type field only.

tafkap95
Explorer
0 Kudos

Hello everybody,

I have this little program that does not compile:

TYPES: BEGIN OF ys_test,
mtype TYPE char3,
mval TYPE i.
TYPES: END OF ys_test.

DATA: lv_test TYPE ys_test.

DATA: wsl_ext TYPE bapiparex.

wsl_ext-valuepart1 = lv_test.

Errror is: "WSL_EXT-VALUEPART1" and "LV_TEST" cannot be converted to each other in a Unicode program. program.

I totally understand the typing problem, but would there be a way to force/convert this assignment?

Thanks for your help.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

SAP provided for Unicode a method to handle this, cl_abap_container_utilities=>fill_container_c, which will also handle case when extension structure is wider than VALUEPART1.

3 REPLIES 3

SURYA_ABAP
Participant
0 Kudos

Hi tafkap95,

Try this.

wsl_ext-valuepart1 = conv #( lv_test ).

I hope this may work.

ThorstenHoefer
Active Contributor
0 Kudos
wsl_ext-valuepart1 = |{ lv_test-mtype }{ lv_test-mval }|.

raymond_giuseppi
Active Contributor
0 Kudos

SAP provided for Unicode a method to handle this, cl_abap_container_utilities=>fill_container_c, which will also handle case when extension structure is wider than VALUEPART1.