Application Development and Automation 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: 
Read only

block alv

Former Member
0 Likes
1,448

I developed the following Block ALV. In the output i am getting a blank screen. Please let me know what's wrong in the code.


report  zfieldcatalog                           .

type-pools: slis.

data : w_fcat1 type slis_fieldcat_alv,
       w_fcat2 type slis_fieldcat_alv,
       w_fcat3 type slis_fieldcat_alv,
       w_events type slis_alv_event,
       flayout type slis_layout_alv.


data : t_fcat1 type slis_t_fieldcat_alv,
       t_fcat2 type slis_t_fieldcat_alv,
       t_fcat3 type slis_t_fieldcat_alv,
       t_kna1 type kna1 occurs 1,
       t_vbak type vbak occurs 1,
       t_vbap type vbap occurs 1,

       t_events1 type slis_t_event,
       t_events2 type slis_t_event,
       t_events3 type slis_t_event.

w_events-name ='TOP-OF-PAGE'.
w_events-form ='TOP1'.
append w_events to t_events1.

w_events-name ='TOP-OF-PAGE'.
w_events-form = 'TOP2'.
append w_events to t_events2.

w_events-name = 'TOP-OF-PAGE'.
w_events-form = 'TOP3'.
append w_events to t_events3.


select * from kna1 into table t_kna1 up to 5 rows.
select * from vbak into table t_vbak up to 5 rows.
select * from vbap into table t_vbap up to 5 rows.

perform top1.
perform top2.
perform top3.
perform get_data.

call function 'REUSE_ALV_BLOCK_LIST_INIT'
  exporting
    i_callback_program             = sy-repid
*          I_CALLBACK_PF_STATUS_SET       = ' '
*          I_CALLBACK_USER_COMMAND        = ' '
*          IT_EXCLUDING                   =
          .


call function 'REUSE_ALV_BLOCK_LIST_APPEND'
  exporting
    is_layout                        = flayout
    it_fieldcat                      = t_fcat1
    i_tabname                        = 't_kna1'
    it_events                        = t_events1
*       IT_SORT                          =
*       I_TEXT                           = ' '
  tables
    t_outtab                         = t_kna1
*     EXCEPTIONS
*       PROGRAM_ERROR                    = 1
*       MAXIMUM_OF_APPENDS_REACHED       = 2
*       OTHERS                           = 3
          .
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_BLOCK_LIST_APPEND'
  exporting
    is_layout                        = flayout
    it_fieldcat                      = t_fcat2
    i_tabname                        = 't_vbak'
    it_events                        = t_events2
*       IT_SORT                          =
*       I_TEXT                           = ' '
  tables
    t_outtab                         = t_vbak
*     EXCEPTIONS
*       PROGRAM_ERROR                    = 1
*       MAXIMUM_OF_APPENDS_REACHED       = 2
*       OTHERS                           = 3
          .
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_BLOCK_LIST_APPEND'
  exporting
    is_layout                        = flayout
    it_fieldcat                      = t_fcat3
    i_tabname                        = 't_vbap'
    it_events                        = t_events3
*       IT_SORT                          =
*       I_TEXT                           = ' '
  tables
    t_outtab                         = t_vbap.
*     EXCEPTIONS
*       PROGRAM_ERROR                    = 1
*       MAXIMUM_OF_APPENDS_REACHED       = 2
*       OTHERS                           = 3
          .
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_BLOCK_LIST_DISPLAY'
*exporting
*          I_INTERFACE_CHECK             = ' '
*          IS_PRINT                      =
*          I_SCREEN_START_COLUMN         = 0
*          I_SCREEN_START_LINE           = 0
*          I_SCREEN_END_COLUMN           = 0
*          I_SCREEN_END_LINE             = 0
*        IMPORTING
*          E_EXIT_CAUSED_BY_CALLER       =
*          ES_EXIT_CAUSED_BY_USER        =
*        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.

*&--------------------------------------------------------------------*
*&      Form  top1
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form top1.
  write: / 'customer information list'.
endform.                                                    "top1

*&--------------------------------------------------------------------*
*&      Form  top2
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form top2.
  write:/ 'sales order information list'.
endform.                                                    "top2


*&--------------------------------------------------------------------*
*&      Form  top3
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form top3.
  write:/ 'sales item list'.
endform.                                                    "top3

*&--------------------------------------------------------------------*
*&      Form  get_data
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form get_data.

  w_fcat1-col_pos = 1.
  w_fcat1-fieldname = 'kunnr'.
  w_fcat1-seltext_m = 'customer number'.
  w_fcat1-tabname = 't_kna1'.
  append w_fcat1 to t_fcat1.

  w_fcat1-col_pos = 2.
  w_fcat1-fieldname = 'name1'.
  w_fcat1-seltext_m = 'customer name'.
  w_fcat1-tabname = 't_kna1'.
  append w_fcat1 to t_fcat1.

  w_fcat1-col_pos = 3.
  w_fcat1-fieldname = 'land1'.
  w_fcat1-seltext_m = 'country'.
  w_fcat1-tabname = 't_kna1'.
  append w_fcat1 to t_fcat1.

  w_fcat2-col_pos = 1.
  w_fcat2-fieldname = 'vbeln'.
  w_fcat2-seltext_m = 'order number'.
  w_fcat2-tabname = 't_vbak'.
  append w_fcat2 to t_fcat2.

  w_fcat2-col_pos = 2.
  w_fcat2-fieldname = 'erdat'.
  w_fcat2-seltext_m = 'order date'.
  w_fcat2-tabname = 't_vbak'.
  append w_fcat2 to t_fcat2.

  w_fcat2-col_pos = 3.
  w_fcat2-fieldname = 'netwr'.
  w_fcat2-seltext_m = 'order value'.
  w_fcat2-tabname = 't_vbak'.
  append w_fcat2 to t_fcat2.

  w_fcat3-col_pos = 1.
  w_fcat3-fieldname = 'posnr'.
  w_fcat3-seltext_m = 'order item '.
  w_fcat3-tabname = 't_vbap'.
  append w_fcat3 to t_fcat3.

  w_fcat3-col_pos = 2.
  w_fcat3-fieldname = 'arktx'.
  w_fcat3-seltext_m = 'item description'.
  w_fcat3-tabname = 't_vbap'.
  append w_fcat3 to t_fcat3.

  w_fcat3-col_pos = 3.
  w_fcat3-fieldname = 'werks'.
  w_fcat3-seltext_m = 'plant'.
  w_fcat3-tabname = 't_vbap'.
  append w_fcat3 to t_fcat3.

endform.                                                    "get_data

I developed the following Block ALV. In the output i am getting a blank screen. Please let me know what's wrong in the code.


report  zfieldcatalog                           .

type-pools: slis.

data : w_fcat1 type slis_fieldcat_alv,
       w_fcat2 type slis_fieldcat_alv,
       w_fcat3 type slis_fieldcat_alv,
       w_events type slis_alv_event,
       flayout type slis_layout_alv.


data : t_fcat1 type slis_t_fieldcat_alv,
       t_fcat2 type slis_t_fieldcat_alv,
       t_fcat3 type slis_t_fieldcat_alv,
       t_kna1 type kna1 occurs 1,
       t_vbak type vbak occurs 1,
       t_vbap type vbap occurs 1,

       t_events1 type slis_t_event,
       t_events2 type slis_t_event,
       t_events3 type slis_t_event.

w_events-name ='TOP-OF-PAGE'.
w_events-form ='TOP1'.
append w_events to t_events1.

w_events-name ='TOP-OF-PAGE'.
w_events-form = 'TOP2'.
append w_events to t_events2.

w_events-name = 'TOP-OF-PAGE'.
w_events-form = 'TOP3'.
append w_events to t_events3.


select * from kna1 into table t_kna1 up to 5 rows.
select * from vbak into table t_vbak up to 5 rows.
select * from vbap into table t_vbap up to 5 rows.

perform top1.
perform top2.
perform top3.
perform get_data.

call function 'REUSE_ALV_BLOCK_LIST_INIT'
  exporting
    i_callback_program             = sy-repid
*          I_CALLBACK_PF_STATUS_SET       = ' '
*          I_CALLBACK_USER_COMMAND        = ' '
*          IT_EXCLUDING                   =
          .


call function 'REUSE_ALV_BLOCK_LIST_APPEND'
  exporting
    is_layout                        = flayout
    it_fieldcat                      = t_fcat1
    i_tabname                        = 't_kna1'
    it_events                        = t_events1
*       IT_SORT                          =
*       I_TEXT                           = ' '
  tables
    t_outtab                         = t_kna1
*     EXCEPTIONS
*       PROGRAM_ERROR                    = 1
*       MAXIMUM_OF_APPENDS_REACHED       = 2
*       OTHERS                           = 3
          .
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_BLOCK_LIST_APPEND'
  exporting
    is_layout                        = flayout
    it_fieldcat                      = t_fcat2
    i_tabname                        = 't_vbak'
    it_events                        = t_events2
*       IT_SORT                          =
*       I_TEXT                           = ' '
  tables
    t_outtab                         = t_vbak
*     EXCEPTIONS
*       PROGRAM_ERROR                    = 1
*       MAXIMUM_OF_APPENDS_REACHED       = 2
*       OTHERS                           = 3
          .
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_BLOCK_LIST_APPEND'
  exporting
    is_layout                        = flayout
    it_fieldcat                      = t_fcat3
    i_tabname                        = 't_vbap'
    it_events                        = t_events3
*       IT_SORT                          =
*       I_TEXT                           = ' '
  tables
    t_outtab                         = t_vbap.
*     EXCEPTIONS
*       PROGRAM_ERROR                    = 1
*       MAXIMUM_OF_APPENDS_REACHED       = 2
*       OTHERS                           = 3
          .
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_BLOCK_LIST_DISPLAY'
*exporting
*          I_INTERFACE_CHECK             = ' '
*          IS_PRINT                      =
*          I_SCREEN_START_COLUMN         = 0
*          I_SCREEN_START_LINE           = 0
*          I_SCREEN_END_COLUMN           = 0
*          I_SCREEN_END_LINE             = 0
*        IMPORTING
*          E_EXIT_CAUSED_BY_CALLER       =
*          ES_EXIT_CAUSED_BY_USER        =
*        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.

*&--------------------------------------------------------------------*
*&      Form  top1
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form top1.
  write: / 'customer information list'.
endform.                                                    "top1

*&--------------------------------------------------------------------*
*&      Form  top2
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form top2.
  write:/ 'sales order information list'.
endform.                                                    "top2


*&--------------------------------------------------------------------*
*&      Form  top3
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form top3.
  write:/ 'sales item list'.
endform.                                                    "top3

*&--------------------------------------------------------------------*
*&      Form  get_data
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form get_data.

  w_fcat1-col_pos = 1.
  w_fcat1-fieldname = 'kunnr'.
  w_fcat1-seltext_m = 'customer number'.
  w_fcat1-tabname = 't_kna1'.
  append w_fcat1 to t_fcat1.

  w_fcat1-col_pos = 2.
  w_fcat1-fieldname = 'name1'.
  w_fcat1-seltext_m = 'customer name'.
  w_fcat1-tabname = 't_kna1'.
  append w_fcat1 to t_fcat1.

  w_fcat1-col_pos = 3.
  w_fcat1-fieldname = 'land1'.
  w_fcat1-seltext_m = 'country'.
  w_fcat1-tabname = 't_kna1'.
  append w_fcat1 to t_fcat1.

  w_fcat2-col_pos = 1.
  w_fcat2-fieldname = 'vbeln'.
  w_fcat2-seltext_m = 'order number'.
  w_fcat2-tabname = 't_vbak'.
  append w_fcat2 to t_fcat2.

  w_fcat2-col_pos = 2.
  w_fcat2-fieldname = 'erdat'.
  w_fcat2-seltext_m = 'order date'.
  w_fcat2-tabname = 't_vbak'.
  append w_fcat2 to t_fcat2.

  w_fcat2-col_pos = 3.
  w_fcat2-fieldname = 'netwr'.
  w_fcat2-seltext_m = 'order value'.
  w_fcat2-tabname = 't_vbak'.
  append w_fcat2 to t_fcat2.

  w_fcat3-col_pos = 1.
  w_fcat3-fieldname = 'posnr'.
  w_fcat3-seltext_m = 'order item '.
  w_fcat3-tabname = 't_vbap'.
  append w_fcat3 to t_fcat3.

  w_fcat3-col_pos = 2.
  w_fcat3-fieldname = 'arktx'.
  w_fcat3-seltext_m = 'item description'.
  w_fcat3-tabname = 't_vbap'.
  append w_fcat3 to t_fcat3.

  w_fcat3-col_pos = 3.
  w_fcat3-fieldname = 'werks'.
  w_fcat3-seltext_m = 'plant'.
  w_fcat3-tabname = 't_vbap'.
  append w_fcat3 to t_fcat3.

endform.                                                    "get_data

12 REPLIES 12
Read only

Former Member
0 Likes
1,411

Hi,

First thing is you cannot pass lower case letters while passing internal table names. You have to pass Capital letters to the ALV function modules. And another thing is why are you building field catalog manually. pass the internal table name to the function module REUSE_ALV_FIELDCATALOG_MERGE. after doing these changes try executing the program.

thanks,

sksingh

Read only

0 Likes
1,411

Still getting the same error

Read only

0 Likes
1,411

Complete working program is as follows.



report zrich_0001.

type-pools: slis.

data : w_fcat1 type slis_fieldcat_alv,
       w_fcat2 type slis_fieldcat_alv,
       w_fcat3 type slis_fieldcat_alv,
       w_events type slis_alv_event,
       flayout type slis_layout_alv.


data : t_fcat1 type slis_t_fieldcat_alv,
       t_fcat2 type slis_t_fieldcat_alv,
       t_fcat3 type slis_t_fieldcat_alv,
       t_kna1 type kna1 occurs 1,
       t_vbak type vbak occurs 1,
       t_vbap type vbap occurs 1,

       t_events1 type slis_t_event,
       t_events2 type slis_t_event,
       t_events3 type slis_t_event.

w_events-name ='TOP_OF_PAGE'.
w_events-form ='TOP1'.
append w_events to t_events1.

w_events-name ='TOP_OF_PAGE'.
w_events-form = 'TOP2'.
append w_events to t_events2.

w_events-name = 'TOP_OF_PAGE'.
w_events-form = 'TOP3'.
append w_events to t_events3.


select * from kna1 into table t_kna1 up to 5 rows.
select * from vbak into table t_vbak up to 5 rows.
select * from vbap into table t_vbap up to 5 rows.

*perform top1.
*perform top2.
*perform top3.
perform get_data.

data: repid type sy-repid.

repid = sy-repid.

call function 'REUSE_ALV_BLOCK_LIST_INIT'
  exporting
    i_callback_program             = repid
*          I_CALLBACK_PF_STATUS_SET       = ' '
*          I_CALLBACK_USER_COMMAND        = ' '
*          IT_EXCLUDING                   =
          .


call function 'REUSE_ALV_BLOCK_LIST_APPEND'
  exporting
    is_layout                        = flayout
    it_fieldcat                      = t_fcat1
    i_tabname                        = 't_kna1'
    it_events                        = t_events1
*       IT_SORT                          =
*       I_TEXT                           = ' '
  tables
    t_outtab                         = t_kna1
*     EXCEPTIONS
*       PROGRAM_ERROR                    = 1
*       MAXIMUM_OF_APPENDS_REACHED       = 2
*       OTHERS                           = 3
          .
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_BLOCK_LIST_APPEND'
  exporting
    is_layout                        = flayout
    it_fieldcat                      = t_fcat2
    i_tabname                        = 't_vbak'
    it_events                        = t_events2
*       IT_SORT                          =
*       I_TEXT                           = ' '
  tables
    t_outtab                         = t_vbak
*     EXCEPTIONS
*       PROGRAM_ERROR                    = 1
*       MAXIMUM_OF_APPENDS_REACHED       = 2
*       OTHERS                           = 3
          .
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_BLOCK_LIST_APPEND'
  exporting
    is_layout                        = flayout
    it_fieldcat                      = t_fcat3
    i_tabname                        = 't_vbap'
    it_events                        = t_events3
*       IT_SORT                          =
*       I_TEXT                           = ' '
  tables
    t_outtab                         = t_vbap.
*     EXCEPTIONS
*       PROGRAM_ERROR                    = 1
*       MAXIMUM_OF_APPENDS_REACHED       = 2
*       OTHERS                           = 3
.
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_BLOCK_LIST_DISPLAY'
*exporting
*          I_INTERFACE_CHECK             = ' '
*          IS_PRINT                      =
*          I_SCREEN_START_COLUMN         = 0
*          I_SCREEN_START_LINE           = 0
*          I_SCREEN_END_COLUMN           = 0
*          I_SCREEN_END_LINE             = 0
*        IMPORTING
*          E_EXIT_CAUSED_BY_CALLER       =
*          ES_EXIT_CAUSED_BY_USER        =
*        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.

*&--------------------------------------------------------------------*
*&      Form  top1
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form top1.
  write: / 'customer information list'.
endform.                                                    "top1

*&--------------------------------------------------------------------*
*&      Form  top2
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form top2.
  write:/ 'sales order information list'.
endform.                                                    "top2


*&--------------------------------------------------------------------*
*&      Form  top3
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form top3.
  write:/ 'sales item list'.
endform.                                                    "top3

*&--------------------------------------------------------------------*
*&      Form  get_data
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form get_data.

  w_fcat1-col_pos = 1.
  w_fcat1-fieldname = 'KUNNR'.
  w_fcat1-seltext_m = 'customer number'.
  w_fcat1-tabname = 'T_KNA1'.
  append w_fcat1 to t_fcat1.

  w_fcat1-col_pos = 2.
  w_fcat1-fieldname = 'NAME1'.
  w_fcat1-seltext_m = 'customer name'.
  w_fcat1-tabname = 'T_KNA1'.
  append w_fcat1 to t_fcat1.

  w_fcat1-col_pos = 3.
  w_fcat1-fieldname = 'LAND1'.
  w_fcat1-seltext_m = 'country'.
  w_fcat1-tabname = 'T_KNA1'.
  append w_fcat1 to t_fcat1.




  w_fcat2-col_pos = 1.
  w_fcat2-fieldname = 'VBELN'.
  w_fcat2-seltext_m = 'order number'.
  w_fcat2-tabname = 'T_VBAK'.
  append w_fcat2 to t_fcat2.

  w_fcat2-col_pos = 2.
  w_fcat2-fieldname = 'ERDAT'.
  w_fcat2-seltext_m = 'order date'.
  w_fcat2-tabname = 'T_VBAK'..
  append w_fcat2 to t_fcat2.

  w_fcat2-col_pos = 3.
  w_fcat2-fieldname = 'NETWR'.
  w_fcat2-seltext_m = 'order value'.
  w_fcat2-tabname = 'T_VBAK'.
  append w_fcat2 to t_fcat2.





  w_fcat3-col_pos = 1.
  w_fcat3-fieldname = 'POSNR'.
  w_fcat3-seltext_m = 'order item '.
  w_fcat3-tabname = 'T_VBAP'..
  append w_fcat3 to t_fcat3.

  w_fcat3-col_pos = 2.
  w_fcat3-fieldname = 'ARKTX'.
  w_fcat3-seltext_m = 'item description'.
  w_fcat3-tabname = 'T_VBAP'..
  append w_fcat3 to t_fcat3.

  w_fcat3-col_pos = 3.
  w_fcat3-fieldname = 'WERKS'.
  w_fcat3-seltext_m = 'plant'.
  w_fcat3-tabname = 'T_VBAP'..
  append w_fcat3 to t_fcat3.

endform.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,411

See the example program - BALVBT01

I see you pass internal table as small letter

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,411

Please change your events table like so.

w_events-name ='TOP_OF_PAGE'.    "<- Underscores instead of hyphens
w_events-form ='TOP1'.
append w_events to t_events1.

w_events-name ='TOP_OF_PAGE'.   "<- Underscores instead of hyphens
w_events-form = 'TOP2'.
append w_events to t_events2.

w_events-name = 'TOP_OF_PAGE'.   "<- Underscores instead of hyphens
w_events-form = 'TOP3'.
append w_events to t_events3.

Regards,

Rich Heilman

Read only

0 Likes
1,411

Also, make these changes.



select * from kna1 into table t_kna1 up to 5 rows.
select * from vbak into table t_vbak up to 5 rows.
select * from vbap into table t_vbap up to 5 rows.

*perform top1.    "<- Comment out
*perform top2.   "<- Comment out
*perform top3.   "<- Comment out
perform get_data.

data: repid type sy-repid.      "<- INSERT
repid = sy-repid.                  "<- INSERT
 
call function 'REUSE_ALV_BLOCK_LIST_INIT'
  exporting
    i_callback_program             = repid                    "<- CHANGE
*          I_CALLBACK_PF_STATUS_SET       = ' '
*          I_CALLBACK_USER_COMMAND        = ' '
*          IT_EXCLUDING                   =
          .

And as mentioned, change any lower case variables in the field cats to upper case.

Regards,

Rich Heilman

Message was edited by:

Rich Heilman

Read only

0 Likes
1,411

Thanks Rich.

Now in the output I am able to see the blocks but no data.

Read only

0 Likes
1,411

Please change internal table from t_kna1 into uppercase T_KNA1

call function 'REUSE_ALV_BLOCK_LIST_APPEND'

exporting

  • is_layout = flayout

it_fieldcat = t_fcat1

i_tabname = 'T_KNA1'

it_events = t_events1

  • IT_SORT =

  • I_TEXT = ' '

tables

t_outtab = t_kna1

EXCEPTIONS

PROGRAM_ERROR = 1

MAXIMUM_OF_APPENDS_REACHED = 2

OTHERS = 3

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

Read only

0 Likes
1,411

Changed to uppercase and still getting the same error

Read only

0 Likes
1,411

See the example and do compare :

report ztest_ytt.

type-pools :slis.

data : begin of wa,

matnr type matnr,

end of wa,

ta like standard table of wa.

data : begin of wa1,

maktx type makt-maktx,

end of wa1,

ta1 like standard table of wa1.

data : flevent type SLIS_T_EVENT,

wa_flevent type line of SLIS_T_EVENT,

wa_layout type SLIS_LAYOUT_ALV.

data : t_fldcat type SLIS_T_FIELDCAT_ALV,

wa_fldcat type line of SLIS_T_FIELDCAT_ALV.

data : t_fldcat1 type SLIS_T_FIELDCAT_ALV,

wa_fldcat1 type line of SLIS_T_FIELDCAT_ALV.

wa_fldcat-fieldname = 'MATNR'.

wa_fldcat-tabname = 'TA'.

append wa_fldcat to t_fldcat.

wa_fldcat1-fieldname = 'MAKTX'.

wa_fldcat1-tabname = 'TA1'.

wa_fldcat1-ref_fieldname = 'MAKTX'.

wa_fldcat1-ref_tabname = 'MAKT'.

append wa_fldcat1 to t_fldcat1.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

EXPORTING

I_CALLBACK_PROGRAM = sy-cprog

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • IT_EXCLUDING =

.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 2

IMPORTING

ET_EVENTS = flevent

  • EXCEPTIONS

  • LIST_TYPE_WRONG = 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.

read table flevent into wa_flevent with key = 'TOP_OF_LIST'.

wa_flevent-form = 'WRITE_IT'.

modify flevent from wa_flevent index sy-tabix transporting

form.

select matnr up to 10 rows from mara into table ta.

select maktx up to 20 rows from makt into table ta1.

wa_layout-zebra = ' '.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

IS_LAYOUT = wa_layout

IT_FIELDCAT = t_fldcat

I_TABNAME = 'TA'

IT_EVENTS = flevent

  • IT_SORT =

  • I_TEXT = ' '

TABLES

T_OUTTAB = ta

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • MAXIMUM_OF_APPENDS_REACHED = 2

  • OTHERS = 3

.

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_BLOCK_LIST_APPEND'

EXPORTING

IS_LAYOUT = wa_layout

IT_FIELDCAT = t_fldcat1

I_TABNAME = 'TA1'

IT_EVENTS = flevent

  • IT_SORT =

  • I_TEXT = ' '

TABLES

T_OUTTAB = ta1

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • MAXIMUM_OF_APPENDS_REACHED = 2

  • OTHERS = 3

.

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_BLOCK_LIST_DISPLAY'

  • EXPORTING

  • I_INTERFACE_CHECK = ' '

  • IS_PRINT =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

  • 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.

form write_it.

write : / 'THIS IS IT'.

endform.

Reward Points if it is helpful

Thanks

Seshu

Read only

0 Likes
1,411

IF there is no data, then I have to say that there is no data in your client, as the complete working program which I have posted above works great in my system. Check that you have actual data in that client for those tables, if not you may have to run in another client in that system.

Regards,

RIch Heilman

Read only

0 Likes
1,411

Also, make sure that the field name and table name in your field catalog are uppercase, this could be the reason why you see no data as well.

  w_fcat1-col_pos = 1.
  w_fcat1-fieldname = 'KUNNR'.            "<--- UPPER CASE
  w_fcat1-seltext_m = 'customer number'.
  w_fcat1-tabname = 'T_KNA1'.              "<--- UPPER CASE
  append w_fcat1 to t_fcat1.

Make sure you do this for all entires of your field cat.

Regards,

RIch Heilman