Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Program not calling subroutine

sudarshan_d29
Active Participant
0 Kudos
212

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos
174

Specify the name of the subroutine (and also the fields in the field catalog) in upper case:

w_event-form = 'SUB'.


BR,

Gábor

4 REPLIES 4

Former Member
0 Kudos
175

Specify the name of the subroutine (and also the fields in the field catalog) in upper case:

w_event-form = 'SUB'.


BR,

Gábor

Clemenss
Active Contributor
0 Kudos
174

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*

Former Member
0 Kudos
174

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

sudarshan_d29
Active Participant
0 Kudos
174

Hi friends,

Thanks a lot for your support.

regards,

sudarshan