‎2011 Mar 30 3:00 AM
Hi
Im new to ABAP OO.
I declared a parameter ret_kna1 Returning Type KNA1.
Inside the method, I am retrieving data from table KNA1 into internal table and then I want return the interal table value.
But Im not able to assing the internal table for eg : code
method READ_CUSTOMER_LIST.
data: lt_kna1 type TABLE OF kna1,
wa_kna1 LIKE LINE OF lt_kna1.
data: lv_kunnr type kna1-kunnr,
lv_land1 type kna1-LAND1.
SELECT * FROM kna1
INTO TABLE lt_kna1
WHERE land1 eq lv_land1.
insert LINES OF lt_kna1 INTO TABLE ret_kna1.
endmethod.when I try to activate the error says 'ret_kna1 is not an internal table "OCCURS n" specification is missing.
but I can not declare the internal table 'ret_kna1' once again in the code, as it already defined in the parameter as type KNA1.
please help me how to assign internal table values to the returing structur.
‎2011 Mar 30 4:19 AM
If you have mentioned KNA1 as the TYPE for returing parameter (in RETURNING part of method defintiion), method can only pass a single record. If you want to return an internal table from the method, define the type as LB_T_BIL_KNA1 (Table type for KNA1).
‎2011 Mar 30 4:19 AM
If you have mentioned KNA1 as the TYPE for returing parameter (in RETURNING part of method defintiion), method can only pass a single record. If you want to return an internal table from the method, define the type as LB_T_BIL_KNA1 (Table type for KNA1).
‎2011 Mar 30 7:31 PM
Are you passing it as an EXPORT parameter?
use and define it in the TABLES section of your function module as so:
*" IMPORTING
*" VALUE(INCLUDE_X_LEVELS) TYPE CHAR1 OPTIONAL
*" TABLES
*" I_SELECTED_OU STRUCTURE HRROOTOB
*" I_SELECTED_EE STRUCTURE OBJEC
*" E_VIP_EPM_DISTR STRUCTURE ZHR_VIP_EPM_DISTR
*" E_RETURN STRUCTURE BAPIRET1
That way you can pass value in the table (if needed) and then pass the table with your values based on your own logic