‎2005 Sep 28 5:04 PM
Hello guys!
In my program I am using REUSE_ALV_GRID_DISPLAY function and the table i pass to it contains data (5 rows: run it on debug mode). However, after execution, the 5 rows of the table are displayed in the ALV but empty.
The code i'm using in this program works fine with another case.
Could anyone help me with this?
Thanks a lot
Hajar
‎2005 Sep 28 7:13 PM
My result_tab is loaded somewhere else, i'm sure that it's filled with data and that the wa_result_tab is also filled. I used the type string just to try with it after that I tried using another structure that its elements have the same types as the ones in the table but it didn't work.
‎2005 Sep 28 5:06 PM
have u prepared the catalog data for the fields used and passed it to the FM - REUSE_ALV_GRID_DISPLAY
Regards
swanand
‎2005 Sep 28 5:07 PM
‎2005 Sep 28 5:10 PM
hi,
u need to build a field catalogue internal table for all ur fields used in the display.
code
form add_field_to_catalogue using x_col_pos
x_fieldname
x_tabname
x_key
x_reptext
x_rollname
x_lowercase
x_outputlen.
----
wa_fieldcatalog-col_pos = x_col_pos.
wa_fieldcatalog-fieldname = x_fieldname.
wa_fieldcatalog-tabname = x_tabname.
wa_fieldcatalog-key = x_key.
wa_fieldcatalog-reptext = x_reptext.
wa_fieldcatalog-dd_roll = x_rollname.
wa_fieldcatalog-lowercase = x_lowercase.
wa_fieldcatalog-outputlen = x_outputlen.
append wa_fieldcatalog to t_fieldcatalog.
endform.
Regards
Swanand
‎2005 Sep 28 5:09 PM
Hi hajar,
check whether you are passing internal table or not and check in debug mode whether records are shown in your internal table or not
CALL function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_bypassing_buffer = 'X'
* i_buffer_active = ' '
i_callback_program = g_repid
* i_callback_pf_status_set = g_status_set
i_callback_user_command = g_user_command
i_structure_name = 'WA'
is_layout = gs_layout
it_fieldcat = lt_fieldcat
i_save = g_save
is_print = gs_print
is_variant = gs_variant
* it_events = gt_events[]
i_grid_title = list_title
colwidth_optimize = 'X' "optimale Spaltenbreite
IMPORTING
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = gs_exit_caused_by_user
TABLES
t_outtab = <b>itab</b>
EXCEPTIONS
program_error = 1
others = 2.or give your code.
reward points for helpfull answers and close the thread if your question is solved.
regards,
venu.
‎2005 Sep 28 5:36 PM
To clarify more here is my code:
TYPE-POOLS: slis. "ALV Declarations
types : begin of wa,
pernr type string,
nachn type string,
vorna type string,
libattes type string,
datdem type string,
datdep type string,
statdem type string,
delivre type string,
modlivr type string,
user type string,
end of wa.
data: wa_result_tab TYPE STANDARD TABLE OF wa INITIAL SIZE 0,
wa_result TYPE wa.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Check function code
CASE r_ucomm.
WHEN '&IC1'.
Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'Mat.'.
Read data table, using index of row user clicked on
READ TABLE result_tab INTO result_struct INDEX rs_selfield-tabindex.
Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD result_struct-pernr.
Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ZTRIAL' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
*&----
-
*
*& Form BUILD_FIELDCATALOG
*&----
-
*
Build Fieldcatalog for ALV Report
*----
-
*
FORM build_fieldcatalog.
fieldcatalog-fieldname = 'Mat.'.
fieldcatalog-seltext_m = 'Matricule de l agent'.
fieldcatalog-col_pos = 0.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'Nom'.
fieldcatalog-seltext_m = 'Nom de l agent'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'Prénom'.
fieldcatalog-seltext_m = 'Prénom de l agent'.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'Attestation'.
fieldcatalog-seltext_m = 'Type d attestation'.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'Date de demande'.
fieldcatalog-seltext_m = 'Date de demande de l attestation'.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'Date de traitement'.
fieldcatalog-seltext_m = 'Date de traitement de l attestation'.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'Statut'.
fieldcatalog-seltext_m = 'Statut de l attestation'.
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'Délivré par'.
fieldcatalog-seltext_m = 'Service émetteur'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
*fieldcatalog-datatype = 'CURR'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'Mode de réception'.
fieldcatalog-seltext_m = 'Mode de réception'.
fieldcatalog-col_pos = 8.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'Gestionnaire'.
fieldcatalog-seltext_m = 'Code du gestionnaire qui'.
fieldcatalog-col_pos = 9.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
*&----
-
*
*& Form BUILD_LAYOUT
*&----
-
*
Build layout for ALV grid report
*----
-
*
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
ENDFORM. " BUILD_LAYOUT
*&----
-
*
*& Form DISPLAY_ALV_REPORT
*&----
-
*
Display report using ALV grid
*----
-
*
FORM display_alv_report.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
TABLES
t_outtab = wa_result_tab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DISPLAY_ALV_REPORT
*&----
*
*& Form DATA_RETRIEVAL
*&----
*
Retrieve data form EKPO table and populate itab it_ekko
*----
*
FORM data_retrieval.
loop at result_tab into result_struct.
wa_result-pernr = result_struct-pernr.
wa_result-nachn = result_struct-nachn.
wa_result-vorna = result_struct-vorna.
wa_result-libattes = result_struct-libattes.
wa_result-datdem = result_struct-datdem.
wa_result-datdep = result_struct-datdep.
wa_result-statdem = result_struct-statdem.
wa_result-delivre = result_struct-delivre.
wa_result-modlivr = result_struct-modlivr.
wa_result-user = result_struct-user.
append wa_result to wa_result_tab.
endloop.
ENDFORM. " DATA_RETRIEVAL
When i run this code i get an ALV containing 5 empty rows (my table contain 5 full rows)
thanks a lot for your help
‎2005 Sep 28 6:33 PM
Hi
Your catalog table is wrong, look at your internal table:
types : begin of wa,
pernr type string,
nachn type string,
vorna type string,
libattes type string,
datdem type string,
datdep type string,
statdem type string,
delivre type string,
modlivr type string,
user type string,
end of wa.
data: wa_result_tab TYPE STANDARD TABLE OF wa INITIAL SIZE 0,
Now see the code you have wroten to build catalog:
fieldcatalog-fieldname = 'Mat.'.
fieldcatalog-seltext_m = 'Matricule de l agent'.
fieldcatalog-col_pos = 0.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'Nom'.
fieldcatalog-seltext_m = 'Nom de l agent'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NACHN'.
fieldcatalog-seltext_m = 'Prénom de l agent'.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
......
But where field Mat. is? or Prénom? and so...
You have to insert the technical name of field in the field fieldname:
so
fieldcatalog-fieldname = 'PERNR'.
fieldcatalog-seltext_m = 'Matricule de l agent'.
fieldcatalog-col_pos = 0.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
...........
Max
Message was edited by: max bianchi
‎2005 Sep 28 6:21 PM
in fieldcatalogue build form specify the data type and length of the field.
Regards
Swanand
‎2005 Sep 28 6:53 PM
thanks a lot for your help. I used technical names in my field catalogue but i still get empty ALV.
any other suggestions???
Your help is really appreciated.
Hajar
‎2005 Sep 28 7:01 PM
Hi
This is your routine to fill wa_result_tab, but where do you load result_tab?
FORM data_retrieval.
loop at result_tab into result_struct.
wa_result-pernr = result_struct-pernr.
wa_result-nachn = result_struct-nachn.
wa_result-vorna = result_struct-vorna.
wa_result-libattes = result_struct-libattes.
wa_result-datdem = result_struct-datdem.
wa_result-datdep = result_struct-datdep.
wa_result-statdem = result_struct-statdem.
wa_result-delivre = result_struct-delivre.
wa_result-modlivr = result_struct-modlivr.
wa_result-user = result_struct-user.
append wa_result to wa_result_tab.
endloop.
ENDFORM. " DATA_RETRIEVAL
Why do you use type STRING for define your table?
Max
Message was edited by: max bianchi
‎2005 Sep 28 7:13 PM
My result_tab is loaded somewhere else, i'm sure that it's filled with data and that the wa_result_tab is also filled. I used the type string just to try with it after that I tried using another structure that its elements have the same types as the ones in the table but it didn't work.
‎2005 Sep 28 7:19 PM
Hi
I've never used a field type string for alv, so i don't know if it can be some problem.
So try to define the fields of your table like the dictionary fields
data : begin of wa_result_tab occurs 0,
pernr like <table>-pernr,
end of wa_result_tab.
and use this fm to load catalog:
REUSE_ALV_FIELDCATALOG_MERGE
Max
Message was edited by: max bianchi
‎2005 Sep 28 7:27 PM
‎2005 Sep 28 8:04 PM