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

Cant get a function to return a table

Former Member
0 Likes
495

Hi, im using the new version of sap, in which using the tab TABLES is absolete

So, I made a Table Type, and I'm using it on the EXPORT TAB of my function

The code on my Function its very simple, and it works, here it is:

FUNCTION ZGETCLASE.

*"----


""Interfase local

*" EXPORTING

*" REFERENCE(CLASE) TYPE ZCLASE1

*"----


*DATA : clase type standard table of zclase1.

select /BIC/ZRICCLAS /BIC/CLASTXT into table CLASE from /BIC/PZRICCLAS.

ENDFUNCTION.

I'm trying to make it work with a program.

Heres the code i use on my program:

*----


REPORT ZPRUEBAINDCAPITAL.

data: begin of claseoperacion occurs 0,

ricclas like zclase-ricclas,

clastxt like zclase-clastxt,

end of claseoperacion.

CALL FUNCTION 'ZGETCLASE'

IMPORTING

CLASE = claseoperacion.

loop at claseoperacion.

write: claseoperacion-RICCLAS , 30 claseoperacion-CLASTXT.

skip 1.

endloop.

The problem is when i run my programs, it won't work because of this error:

CALL_FUNCTION_CONFLICT_TYPE

Excep. CX_SY_DYN_CALL_ILLEGAL_TYPE

any ideas??

thanks

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
472

Hi,

Try to change the following and try


data: begin of claseoperacion occurs 0,
       include structure ZCLASE1.
end of claseoperacion.

aRs

3 REPLIES 3
Read only

Former Member
0 Likes
472

Hi,

Change this in your code

DATA claseoperacion TYPE TABLE OF ZCLASE1.

Regards,

Atish

Read only

former_member194669
Active Contributor
0 Likes
473

Hi,

Try to change the following and try


data: begin of claseoperacion occurs 0,
       include structure ZCLASE1.
end of claseoperacion.

aRs

Read only

0 Likes
472

An Extended Syntax change will normally highlight where the problem exists... what confuses me is that you say you have defined "ZCLASE1" as a table type, so why is "clase" a standard table of a table type... i.e. should you have something like (not syntax checked):

FUNCTION ZGETCLASE.
*"----------------------------------------------------------------------
*"*"Interfase local
*" EXPORTING
*" REFERENCE(CLASE) TYPE ZCLASE1
*"----------------------------------------------------------------------

DATA : 
  lt_clase            type zclase1.

  select /BIC/ZRICCLAS /BIC/CLASTXT into table lt_clase 
    from /BIC/PZRICCLAS.

  clase[] = lt_clase[].

ENDFUNCTION.

and call it with:


REPORT ZPRUEBAINDCAPITAL.

data:
  gt_clase            type zclase1,
  gs_clase           like line of gt_clase.

start-of-selection.

CALL FUNCTION 'ZGETCLASE'
  IMPORTING
    CLASE = gt_clase.

loop at gt_clase into gs_clase. "into a structure like line of gt_clase.
write: gs_clase-RICCLAS, 30 gs_clase-CLASTXT.
skip 1.
endloop.

(sorry, I don't have a system in front of me otherwise I'd do a better example).