07-22-2010 8:49 AM
Dear experts,
How can i pass the name of P_TAB in from fieldcat_init ?.
i call the method of an object(ob) of class .
If i call debugger on p_tab in form fieldcat_init ,i can see the data.
But how to assign it
wa_fieldcat-tabname = P_TAB.
I tried this but gives me dump.
CALL METHOD OB->printalv( exporting alv_data = t_excel ).
method printalv.
perform printing tables alv_data.
endmethod.
form printing tables p_tab like t_excel.
# PERFORM fieldcat_init tables p_tab USING gt_fieldcat .
PERFORM eventtab_build USING gt_events[].
PERFORM comment_build USING gt_list_top_of_page[].
PERFORM disp_rep tables p_tab.
endform.
FORM fieldcat_init tables p_tab USING p_gt_fieldcat .
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = P_TAB.
wa_fieldcat-seltext_m = text-001 .
wa_fieldcat-outputlen = 18.
wa_fieldcat-emphasize = 'C410'.
APPEND wa_fieldcat TO it_fieldcat.
ENDFORM.
Line with # needs clarification.
Edited by: aditya sharma on Jul 22, 2010 9:49 AM
07-22-2010 9:00 AM
Hi Aditya,
You described your "p_tab" in TABLES section
describe your form like that :
FORM fieldcat_init USING p_tab p_gt_fieldcat .
ENDFORM.
and give the name of your table to this subroutine
not the table itself :
PERFORM fieldcat_init USING 'ITAB' p_gt_fieldcat.
wrong : PERFORM fieldcat_init USING ITAB p_gt_fieldcat.
I hope it helps.
07-22-2010 9:32 AM
07-22-2010 9:44 AM
Hi,
Look at the way you append fieldcat:
APPEND wa_fieldcat TO it_fieldcat.
please try to append right subroutine parameter
07-22-2010 9:53 AM
I did by decalring thing as follows
alv_tab like (type of p_tab)
append lines of p_tab to alv_tab.
then talking only for ALV_TAB.