cancel
Showing results for 
Search instead for 
Did you mean: 

Exporting table through call method

Former Member
0 Kudos

Hello experts,

I'm trying to make my get_entity_set methode for a condition type:

DATA itab_cond_type TYPE TABLE OF zstruc_cond_type.

DATA wa_cond_type type zstruc_cond_type.

     CALL METHOD class->GET_COND_TYPE IMPORTING ex_cond_type  = itab_cond_type

         .

   DATA: ls_entityset LIKE LINE OF et_entityset.

LOOP AT itab_cond_type INTO wa_cond_type.

     ls_entityset-KSCHL = wa_cond_type-KSCHL.

     ls_entityset-class = wa_cond_type-VTEXT.

     APPEND ls_entityset TO et_entityset.

ENDLOOP.



I get an error at the import.   => "itab_cond_type" is not type-compatible with the

formal parameterr "ex_cond_type".

Even though they are both from the same type ... (type table of zstruc_cond_type).

When i change 'DATA itab_cond_type TYPE TABLE OF zstruc_cond_type' to 'DATA itab_cond_type TYPE zstruc_cond_type'

i get an error at the loop at because it is no longer an iternal table and i cannot append my data to et_entityset...

Any ideas of what it is i'm doing wrong here?

Kind regards,

Bart

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

K i solved it.

I defined the ex_cond_type as a structure. The type was a structure and not a table type...

So ex_cond_type was a structure and therefor not compatible with the itab_cond_type which is an internal table.

Thanks for all the help.

Kind Regards,

Bart

Answers (1)

Answers (1)

ChandraMahajan
Active Contributor
0 Kudos

for the below statement check what is the type of ex_cond_type. check the signature of method GET_COND_TYPE and the type associated with exporting parameter.


CALL METHOD class->GET_COND_TYPE IMPORTING ex_cond_type  = itab_cond_type


It might be different than zstruc_cond_type.


Regards,

Chandra

Former Member
0 Kudos

It is the same type ' zstruc_cond_type'

Regards,

Bart

ChandraMahajan
Active Contributor
0 Kudos

Please check these threads and

your code should look as below,


  DATA: lt_cond_type TYPE TABLE OF zstruc_cond_type,

        ls_cond_type LIKE LINE OF lt_cond_type,

        ls_entity   LIKE LINE OF et_entityset.

*Get data from ZSTRUC_COND_TYPE table

  SELECT * FROM zstruc_cond_type INTO TABLE lt_cond_type.

*Fill ET_ENTITYSET

  LOOP AT lt_cond_type INTO  ls_cond_type.

    ls_entity-KSCHL = ls_cond_type-KSCHL.

    ls_entity-class = ls_cond_type-VTEXT.

    APPEND ls_entity TO et_entityset.

  ENDLOOP.

assuming zstruc_cond_type is table.

Regards,

Chandra

Former Member
0 Kudos

zstruc_cond_type is a structure not an internal table.


Regards,


Bart