05-29-2008 6:41 AM
Can someone please help.
I'm using the FM 'REUSE_ALV_GRID_DISPLAY'. The alv gets created and the field catolog apparently works cause the columns have their names. The ALV has got the exact quantity of rows as the populated internal table, but the info does not get displayed. I've debugged this forever and cannot see what I should do differently. The FM receives the table with all the info in it. It passes it to the different calls within itself, but still does not display the table.
The code looks like this.
DATA: BEGIN OF itab_struct,
custn TYPE kna1-name1, "Customer name
cust TYPE vbak-kunnr, "Customer number
plant TYPE vbap-werks, "Plant
type TYPE vbak-auart, "Sales Order type
sales_no TYPE vbap-vbeln, "Sales Order number
so_date TYPE string, "Sales Order Date created
so_time TYPE string, "Sales Order Entry time
dl_no TYPE vbfa-vbeln, "Goods issue number
dl_date TYPE string, "Goods issue date created
dl_time TYPE string, "Goods issue time created
tot_time TYPE string, "Total time spent
so_av TYPE string, "Sales Order average
cust_av TYPE string, "Average by customer
av_time TYPE string, "Average time spent
END OF itab_struct.
DATA: itab LIKE TABLE OF itab_struct WITH HEADER LINE.
... and then I populate the table.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = i_event.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_pgm
i_structure_name = 'itab_struct'
it_events = i_event[]
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = wa_fcat[]
i_bypassing_buffer = 'X'
is_layout = printtab_layout
is_print = print
i_save = save
TABLES
t_outtab = itab[].
05-29-2008 6:48 AM
Hi
Just check out the below code and see the required solution accordingly.
report zalvcall.
type-pools:slis.
data:inttab type standard table of zemptab1 with header line ,
int_tab type standard table of zemptab2 with header line,
in_tab type standard table of zemptab2 with header line.
data:fieldcat type slis_t_fieldcat_alv with header line,
fieldcat1 type slis_t_fieldcat_alv with header line.
select * from zemptab1 into corresponding fields of table inttab.
select * from zemptab2 into corresponding fields of table int_tab.
perform buildfieldcat.
perform displayfieldcat.
form buildfieldcat.
fieldcat-fieldname = 'ID'.
fieldcat-seltext_m = 'EMPID'.
append fieldcat to fieldcat.
fieldcat-fieldname = 'NAME'.
fieldcat-seltext_m = 'EMPNAME'.
append fieldcat to fieldcat.
fieldcat-fieldname = 'QUALIFICATION'.
fieldcat-seltext_m = 'QUAL'.
append fieldcat to fieldcat.
fieldcat-fieldname = 'CITY'.
fieldcat-seltext_m = 'CITY'.
append fieldcat to fieldcat.
fieldcat-fieldname = 'AGE'.
fieldcat-seltext_m = 'AGE'.
append fieldcat to fieldcat.
endform. "buildfileldcat
form displayfieldcat .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
i_callback_user_command = 'USECOMMAND'
it_fieldcat = fieldcat[]
tables
t_outtab = int_tab.
if sy-subrc <> 0.
endif.
endform. "displayfieldcat
form usecommand using r_ucomm like sy-ucomm rs_selfield type
slis_selfield .
case r_ucomm.
when '&IC1'.
read table int_tab index
rs_selfield-tabindex.
if sy-subrc eq 0.
"loop at int_tab where id eq rs_selfield.
in_tab-zempid = int_tab-zempid.
in_tab-dcode = int_tab-dcode.
*
in_tab-desig = int_tab-desig.
*
in_tab-exp = int_tab-exp.
append in_tab.
endif.
endcase.
" endloop.
clear fieldcat.
refresh fieldcat.
perform build_fieldcat.
perform display_fieldcat.
endform. "USECOMMAND
form build_fieldcat.
fieldcat-fieldname = 'DCODE'.
fieldcat-seltext_m = 'Desigcode'.
append fieldcat.
fieldcat-fieldname = 'ID'.
fieldcat-seltext_m = 'EMPID'.
append fieldcat to fieldcat.
fieldcat-fieldname = 'DESIG'.
fieldcat-seltext_m = 'Designation'.
append fieldcat to fieldcat.
fieldcat-fieldname = 'EXP'.
fieldcat-seltext_m = 'EXPERIENCE'.
append fieldcat to fieldcat.
endform. "build_fieldcat
form display_fieldcat.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
it_fieldcat = fieldcat[]
tables
t_outtab = in_tab
exceptions
program_error = 1
others = 2.
endform. "display_fieldcat
05-29-2008 7:07 AM
Hi,
Please remove i_structure_name = 'itab_struct' , when you are calling REUSE_ALV_GRID_DISPLAY and try.
Here is the sample simple code to create ALV.
Regards,
Venkat.O
DATA: BEGIN OF i_mard OCCURS 0,
matnr LIKE mard-matnr,
werks LIKE mard-werks,
lgort LIKE mard-lgort,
pstat LIKE mard-pstat,
END OF i_mard.
TYPE-POOLS:slis.
DATA:i_fieldcat TYPE slis_t_fieldcat_alv.
SELECT matnr
werks
lgort
pstat
FROM mard
INTO CORRESPONDING FIELDS OF TABLE i_mard
UP TO 100 ROWS.
"Use function module create Fieldcat.
DATA:
l_program TYPE sy-repid VALUE sy-repid.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = l_program
i_internal_tabname = 'I_MARD'
i_inclname = l_program
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = i_fieldcat.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_program
it_fieldcat = i_fieldcat
TABLES
t_outtab = i_mard.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
05-29-2008 8:07 AM
Hi Teresa,
In FM REUSE_ALV_GRID_DISPLAY, u have given i_structure_name = 'itab_struc'.
create a zstructure in se11 with the required fields of itab_struc.
also dont give structure name in small letters. Give it in caps
i.e i_structure_name = 'ZSTRUCTURE'.
Try this and get back to me incase of any queries.
Dont forget to reward points if found useful.
Thanks,
Satyesh
06-04-2008 12:46 PM
Hey guys,
Thanx for your replies. But it seems my problem was with the detail of my field catalogue. Didn't know it is case sensitive for one.
Thanx again.