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

Error converting types in FM

Former Member
0 Likes
1,928

Guys,

Some days ago i do this code:

RANGES:

     r_vkorg for vbak-vkorg.

     t_term[] = r_term[].

(T_TERM HAS NO TYPE, IT WAS DECLARED IN TABLE TAB IN FM WITH NO TYPE)

And this code, works well.

Today i try to do something like that, but whitout sucess:

DATA: BEGIN OF t_ps OCCURS 0.

                INCLUDE STRUCTURE ZTBSD_VMOI_PS.

DATA:      VGBEL  LIKE ZTBSD_VMOI_PS_VS-VGBEL.

DATA: END OF t_ps.

T_ALV[] = T_PS[].

(T_ALV HAS NO TYPE TOO , IT WAS DECLARED IN TBALE TAB IN FM WITH NO TYPE)

But SAP is showing me a DUMP ( Cannot Convert ) :

                                                  

OBJECTS_TABLES_NOT_COMPATIBLE                                                

SAPLZGSD_VMOI                                                                

Nicht zugeordnet                                                             

28.06.2012 14:08:43                                                          

                                                                                                                                                                                                        

                                                                                                                                                                                           

     Two internal tables are neither compatible nor convertible.           

Can anyone help me with this? I don't want to create a structure in DDIC just to use one time.               

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,837

Hi,

First of all, keep in mind that TABLES parameters in FM are now obsolete (prefer CHANGING). Same for OCCURS key word (better use a TYPES  statement to define your table fields)

Now I guess if you declare the table with type STANDARD TABLE in the FM, this could fix your issue... (if you opt for a CHANGING parameter instead, you can use the type ANY TABLE).

Kr,

Manu.

8 REPLIES 8
Read only

Former Member
0 Likes
1,838

Hi,

First of all, keep in mind that TABLES parameters in FM are now obsolete (prefer CHANGING). Same for OCCURS key word (better use a TYPES  statement to define your table fields)

Now I guess if you declare the table with type STANDARD TABLE in the FM, this could fix your issue... (if you opt for a CHANGING parameter instead, you can use the type ANY TABLE).

Kr,

Manu.

Read only

0 Likes
1,837

Thanks for your help , stardard table is a charlike structure and my table is non charlike structure.

I think that's the problem, sap can't convert.

I solved creating a structure in DDIC , but it was a fast solution.

Ps.: Ranges tables are charlike structure too.

Read only

0 Likes
1,837

Passing a non charlike structured table should not give any issue...

I tried by using a complex structure including VBAP struture+some other DEC fields witout any issue... how is your Z structure defined?

Another workaround for this could be to use a data reference (TYPE REF TO DATA) and dereference it within the FM with a field-symbols...

e.g:

GET REFERENCE of itab into lo_data.

"pass lo_data to changing parameter of FM (ch_data type ref to data)

"Then, In the FM:

FIELD-SYMBOLS <itab> type any table.

ASSIGN ch_data->* to <itab>.

Kr,

Manu.

Read only

0 Likes
1,837
MANDTCLNT
CLIENTECHAR
MATERIALCHAR
PO_VENDORNUMC
PO_ITEMNUMC
VERSAONUMC
PO_CUSTOMERNUMC
BASE_DTDATS
ETA_DTDATS
ETA_TIMETIMS
QUANTIDADEQUAN
UNIDADEUNIT
TP_TRANSPORTCHAR
PO_PARCEIRONUMC
VENDORNUMC
UPLOAD_DATECHAR
USUARIOCHAR
Read only

0 Likes
1,837

Hi,

So this should not give any issue with a TABLES parameter of type STANDARD TABLE....(or with a CHANGING parameter of type ANY).

To stick to your code, I did try this:

DATA: BEGIN OF itab OCCURS 0,

          fld TYPE string.

          INCLUDE STRUCTURE vbap.

  DATA: END OF itab.

  CALL FUNCTION 'ZZTEST'
    TABLES
      it_tab = itab.

With function ZZTEST beeing defined like:

*"----------------------------------------------------------------------
*"*"Local Interface:
*"  TABLES
*"      IT_TAB TYPE  STANDARD TABLE
*"  (or
*"  CHANGING
*"     REFERENCE(IT_TAB) TYPE  ANY TABLE )
*"----------------------------------------------------------------------

This is fully working...

Kr,

Manu.

Read only

0 Likes
1,837

Hello,

I will try here, thanks for help!

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,837

Hello Eduardo,

The only missing piece of the jigsaw is the type of the actual param bound to the tables param

Can you check the compatibility between the row types of:

  • the actual internal table bound to the TABLES param T_ALV &
  • the internal table T_PS?

Are they same (read: compatible)? You can post a screenshot if it's possible!

BR,

Suhas

Read only

Former Member
0 Likes
1,837

T_ALV

T_PS

A solved my problem creating a structure in DDIC and declaring T_ALV TYPE MY_STRUCT.