11-14-2016 3:31 PM
Hello guys
I'm new to abap and I'm facing a problem that I believe to be simple to solve:
I have a method and I want to return a table (the method itself will fill the table with another method inside it). Here goes the declaration:
get_application_item IMPORTING iv_appldoc_id TYPE /accgo/e_appldoc
RETURNING VALUE(rt_application_items) TYPE /ACCGO/CAS_TT_CAI_BL.
Here is the implementation:METHOD get_application_item.
DATA(lo_appldoc_manager) = /accgo/cl_cas_appdoc_mgr=>get_instance( ).
DATA is_appldoc TYPE lty_appldoc.
is_appldoc-appldoc = iv_appldoc_id.
TRY.
DATA(lo_application_document) = lo_appldoc_manager->get_appdoc(
im_s_appdoc_hdr_key = CORRESPONDING #( is_appldoc ) ).
lo_application_document->get_data(
IMPORTING ex_t_appdoc_item = rt_application_items ).
CATCH /accgo/cx_cas_appl_error.
MESSAGE 'Error' TYPE 'I'.
ENDTRY.
ENDMETHOD.
The idea is to call get_data and fill my returning table rt_application_items with data. But I'm getting this error, so I don't know how to deal with it, since rt_application_items has the same type as ex_t_appdoc_item (images from the table type and structure below).
Does anyone have an idea?
11-14-2016 5:33 PM
The issue in only with the line:
RETURNING VALUE(rt_application_items) TYPE /ACCGO/CAS_TT_CAI_BL.
It's not accepted to use a generic type with RETURNING.
You simply need to define a complete type compatible with /ACCGO/CAS_TT_CAI_BL, and declare the returning parameter with that new type (it's an example, as you didn't provide the full definition of /ACCGO/CAS_TT_CAI_BL) :
TYPES ty_cas_tt_cai_bl TYPE STANDARD TABLE OF /ACCGO/CAS_S_CAI_BL WITH EMPTY KEY.
11-14-2016 5:33 PM
The issue in only with the line:
RETURNING VALUE(rt_application_items) TYPE /ACCGO/CAS_TT_CAI_BL.
It's not accepted to use a generic type with RETURNING.
You simply need to define a complete type compatible with /ACCGO/CAS_TT_CAI_BL, and declare the returning parameter with that new type (it's an example, as you didn't provide the full definition of /ACCGO/CAS_TT_CAI_BL) :
TYPES ty_cas_tt_cai_bl TYPE STANDARD TABLE OF /ACCGO/CAS_S_CAI_BL WITH EMPTY KEY.