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
672

Hi,

I am getting a unicode error in callling a subroutine.

data : BEGIN OF ITAB OCCURS 0.

INCLUDE STRUCTURE KOMP.

data: flag type c,

chk_flg type c.

DATA: END OF ITAB.

  • Fetch data in Itab.

Perform value_check tables ITAB.

Form value_check tables p_itab1 structure komp.

  • Some processing

Endform.

The unicode error I am getting is ITAB and line type p_itab1 are incompatible.

I think it is due to 2 extra fields in ITAB. Kindly proposed a soloution without affecting the functionality of program.

Regards,

Rajneesh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
653

hi

give it this way....

Form value_check tables p_itab1 like itab.
.....
endform.

Regards,

Siddarth

5 REPLIES 5
Read only

Former Member
0 Likes
654

hi

give it this way....

Form value_check tables p_itab1 like itab.
.....
endform.

Regards,

Siddarth

Read only

Former Member
0 Likes
653

HI,

Either make the tables as global and use them directly instead of passing.

In Unicode the table structure should be same with reference type.

OR

Form value_check tables p_itab1 structure itab.

Endform.

Read only

Former Member
0 Likes
653

Try this

DATA : BEGIN OF itab OCCURS 0.

INCLUDE STRUCTURE komp.

DATA: flag TYPE c,

chk_flg TYPE c.

DATA: END OF itab.

PERFORM value_check TABLES itab.

&----


FORM value_check TABLES p_itab1 STRUCTURE itab.

ENDFORM. "value_check

Read only

uwe_schieferstein
Active Contributor
0 Likes
653

Hello Rajneesh

TABLES parameters are obsolete for both function module interfaces and FORM interfaces. If the itab data are not changed within the FORM routine then forward it as USING parameter otherwise as CHANGING parameter.


TYPES BEGIN OF ty_s_record.
  INCLUDE TYPE komp.
TYPES: flag type c.
TYPES: chk_flg type c.
TYPES: END OF ty_s_record.
TYPES: ty_t_itab   TYPE STANDARD TABLE OF ty_s_itab
                            WITH DEFAULT KEY.

DATA:
  lt_itab    TYPE ty_t_itab.


...
PERFORM values_check USING lt_itab.
PERFORM values_check CHANGING lt_itab.

FORM values_check USING VALUES(ut_itab)  TYPE ty_t_itab.
...
ENDFORM.


FORM values_check CHANGING ct_itab  TYPE ty_t_itab.
...
ENDFORM.

Regards

Uwe

Read only

former_member183804
Active Contributor
0 Likes
653

Hello Rajneesh,

you are right the 2 types are not compatible. Define the structure type and table type first and you will get rid of this issue.


types:
  begin of TY_STRUCT.
  include type OLD_STRUCT.
types:
  FLAG type c length 1,
  end of TY_STRUCT.
types:
  TY_TABLE type standard table of TY_STRUCT with default key.

data:
  MY_STRUCT type TY_STRUCT,
  MY_TABLE  type TY_TABLE.

Whereever possible avoid forms. Their runtime behaviour is inferior compared to methods. Even without OO Design a program using static methods will be a benefit.

Best Regards

Klaus