2016 Mar 19 8:05 PM
Hi friends,
I'm doing simple alv I dont know where i have made mistake in my program below.
Issue is ListHeader is not displaying marked in bold.
Please correct my coding it will helpful.
REPORT zreport_013 NO STANDARD PAGE HEADING.
TYPE-pools:slis.
TABLES:kna1.
TYPES: BEGIN OF ty_vbak,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
ernam TYPE vbak-ernam,
netwr TYPE vbak-netwr,
END OF ty_vbak.
DATA: t_vbak TYPE ty_vbak OCCURS 1,
w_vbak TYPE ty_vbak.
DATA: t_fcat TYPE slis_t_fieldcat_alv,
w_fcat TYPE slis_fieldcat_alv,
w_layout TYPE slis_layout_alv,
t_event TYPE slis_t_event,
w_event TYPE slis_alv_event,
t_comment TYPE slis_t_listheader,
w_comment TYPE slis_listheader.
DATA: prgm like sy-repid.
PARAMETERS: custno TYPE kna1-kunnr.
SELECT vbeln
erdat
ernam
netwr FROM vbak INTO TABLE t_vbak WHERE kunnr = custno.
w_fcat-col_pos = 1.
w_fcat-fieldname = 'vbeln'.
w_fcat-seltext_m = 'Document no.'.
APPEND w_fcat TO t_fcat.
w_fcat-col_pos = 2.
w_fcat-fieldname = 'erdat'.
w_fcat-seltext_m = 'Doc created date'.
APPEND w_fcat TO t_fcat.
w_fcat-col_pos = 3.
w_fcat-fieldname = 'ernam'.
w_fcat-seltext_m = 'Doc created by'.
APPEND w_fcat TO t_fcat.
w_fcat-col_pos = 4.
w_fcat-fieldname = 'netwr'.
w_fcat-seltext_m = 'Net value'.
APPEND w_fcat TO t_fcat.
w_event-name = 'TOP_OF_PAGE'.
w_event-form = 'sub'.
APPEND w_event TO t_event.
w_comment-typ = 'H'.
w_comment-info = 'List the order'.
APPEND w_comment TO t_comment.
w_layout-colwidth_optimize = 'X'.
*WRITE:/'test'.
prgm = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = prgm
is_layout = w_layout
it_fieldcat = t_fcat
it_events = t_event
TABLES
t_outtab = t_vbak
.
***sub not getting call.
FORM sub.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_comment
* I_LOGO =
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
.
ENDFORM.
Thanks in advance,
sudarshan
2016 Mar 19 9:04 PM
Specify the name of the subroutine (and also the fields in the field catalog) in upper case:
w_event-form = 'SUB'.
BR,
Gábor
2016 Mar 19 9:04 PM
Specify the name of the subroutine (and also the fields in the field catalog) in upper case:
w_event-form = 'SUB'.
BR,
Gábor
2016 Mar 20 11:53 AM
Hi,
unfortunately, the subroutibe SUB has no good name and it is your secret at what time (event) you want it called. If you need it for the top-of-page
I_CALLBACK_TOP_OF_PAGE parameter can be used.
Regards Clemens
P.S. There are so many sample programs B*ALV*
2016 Mar 21 8:37 AM
Hi,
I tried executing your code, it showed up dump. Then I realised that
1.Field names should be in capital case. Ex : w_fcat-fieldname = 'VBELN'.
2.Even name should also in capital case Ex : w_event-form = 'SUB'.
Please make these changes and you can see the ALV output with top_of page coming from your form SUB.
Hint: Please do a initial search in the forum before initiating a thread.
Hope this is helpful.
Regards
Pallavi
2016 Mar 22 6:43 AM