08-21-2007 10:18 AM
Hi all,
There is a table returned by a function module ZCDAPO_MATNR_CHECK_FOR_QUOTA .
I want to use the table returned by this FM in a subroutine.
So i pass this table thru FORM statement.
within PERFORM and ENDFORM i want to use the data in this table
and do some manipulation.
but i am getting an error saying for typing TABLES parameter only table types should be used
can anyone tell me where i am going wrong or please tell me how use tables in this PERFORM statement.for reference i will paste the code below,
TYPES : BEGIN OF x_quota ,
trpid type ztrpid ,
quota TYPE decv1_3 ,
END OF x_quota .
DATA : it_qheader TYPE TABLE OF zapo_trqtah,
wa_it_qheader LIKE LINE OF it_qheader.
DATA: it_qitem TYPE TABLE OF zapo_trqtap,
wa_it_qitem LIKE LINE OF it_qitem.
DATA : it_quotavalue TYPE TABLE OF x_quota ,
wa_it_quotavalue LIKE LINE OF it_quotavalue .
CALL FUNCTION 'ZCDAPO_MATNR_CHECK_FOR_QUOTA'
EXPORTING
i_matnr = 'AATESTQUOTA2'
i_werks = '5034'
IMPORTING
e_quota_exist_flag = lv_flag
TABLES
t_zapo_trqtap = it_qitem
t_zapo_trqtah = it_qheader
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
perform f_loadquota_apo TABLES it_qitem.
form f_loadquota_apo tables it_qitem type zapo_trqtap.
LOOP AT it_qitem INTO wa_it_qitem.
wa_it_quotavalue-trpid = wa_it_qitem-ztrpid.
wa_it_quotavalue-quota = wa_it_qitem-zquota / lv_sum.
append wa_it_quotavalue to it_quotavalue.
endloop.
endform.
08-21-2007 10:23 AM
Hi..
Using TABLES is like obselete.
So change your code like this:
Call the Subroutine like this:
<b>perform f_loadquota_apo using it_qitem[].</b>
You can change the Definition of Form like this:
<b>form f_loadquota_apo USING it_qitem LIKE zapo_trqtap[].</b>
LOOP AT it_qitem INTO wa_it_qitem.
wa_it_quotavalue-trpid = wa_it_qitem-ztrpid.
wa_it_quotavalue-quota = wa_it_qitem-zquota / lv_sum.
append wa_it_quotavalue to it_quotavalue.
endloop.
endform.
<b>Reward if Helpful</b>
08-21-2007 10:26 AM
Hi Hema,
perform f_loadquota_apo TABLES it_qitem.
form f_loadquota_apo tables it_qitem type zapo_trqtap. => your coding
<b>form f_loadquota_apo tables it_qitem_val. ==> try this one remove type don't need to declare it_qitem_val</b>
LOOP AT it_qitem INTO wa_it_qitem.
wa_it_quotavalue-trpid = wa_it_qitem-ztrpid.
wa_it_quotavalue-quota = wa_it_qitem-zquota / lv_sum.
append wa_it_quotavalue to it_quotavalue.
endloop.
endform.
Thanks & Good regards,
vallamuthu.M
08-21-2007 10:29 AM
Hi hemavathi,
1. Minor mistake.
2.
form f_loadquota_apo tables it_qitem <b>STRUCTURE</b> zapo_trqtap.
(where zapo_trqtap should be available in se11 as a table/structure definition)
regards,
amit m.
08-21-2007 10:31 AM
Hi Hemavathi,
U need to a small change to your code.
U've already declared <b>x_quota</b> and <b>it_qitem</b>.
Additionally,you declare a table type like this...
<b>data:type_t_x_quota type standard table of x_quota initial size 0.</b>
and modify your Perform and Form like this.
perform f_loadquota_apo using it_qitem.
and
form f_loadquota_apo using r_it_qitem type type_t_x_quota.
......................
endform.
Let me know if it works.
Reward if Useful,
Imran.
08-21-2007 10:32 AM
Hi,
When you are passing an internal table to a subroutine you need to use the keyword STRUCTURE.Please see the example below.
declare a structure of the type of internal table.If the structure exists in DDIC then you can use it itself e.g gst_itab.
perform gf_update TABLES itab.
form gf_update TABLES x_itab STRUCTURE gst_itab.
Hope it works.
Thanks,
Sandeep.