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: 

To get top-of-page in alv list

Former Member
0 Kudos

How get top-of-page using reuse_alv_list_display ?

How to get checkbox into that top-of-page ? And how to access that checkbox whether it is checked or not ? And if checked to get into next step of program promptly ?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI,

see this code.u can find the check box status in the variable val



DATA:check VALUE 'X'.
data:val.
data:itab LIKE mara occurs 0.

SELECT * from mara into table itab up to 20 rows.

TYPE-POOLS:slis.

data:eve type slis_t_event  .
data: ls_event type slis_alv_event.

  call function 'REUSE_ALV_EVENTS_GET'
   exporting
     i_list_type           = 0
   importing
     et_events             = eve[].

  read table eve with key name =  'TOP_OF_PAGE'
              into ls_event.
  move 'TOP_OF_PAGE' to ls_event-form.
  APPEND ls_event to eve.

  read table eve with key name =  'USER_COMMAND'
              into ls_event.
  move 'UCOMM' to ls_event-form.
  APPEND ls_event to eve.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
 EXPORTING
   I_CALLBACK_PROGRAM             = SY-REPID
   I_STRUCTURE_NAME               = 'MARA'
   IT_EVENTS                      = eve[]
  TABLES
    T_OUTTAB                       = itab.

FORM TOP_OF_PAGE.
  WRITE: check AS CHECKBOX HOTSPOT ON.
ENDFORM.

form ucomm using r_ucomm like sy-ucomm
      rs_selfield type slis_selfield.
*  case r_ucomm.
*    when '&IC1'.
*      READ: LINE 1 FIELD VALUE check.
*  endcase.
  GET CURSOR FIELD check VALUE val.
*  write:/ val.
endform.

rgds,

bharat.

7 REPLIES 7

Former Member
0 Kudos

Reward points..

dhruv_shah3
Active Contributor
0 Kudos

Hi,

How to add list heading like top-of-page in ABAP lists?

[http://www.sapfans.com/forums/viewtopic.php?t=58775]

[http://www.sapfans.com/forums/viewtopic.php?t=60550]

[http://www.sapfans.com/forums/viewtopic.php?t=16629]



*---------------------------------------------------------------------*
* FORM ALV_TOP_OF_PAGE *
*---------------------------------------------------------------------*
FORM alv_top_of_page.
 
DATA: l_title(100).
DATA: l_recs TYPE i,
l_recs_c(10),
l_exdate(10),
l_stext(80),
l_svalue(80),
l_index LIKE sy-tabix,
l_count TYPE i.
CLEAR: i_list_comments[].
 
 
WRITE sy-datum TO l_exdate.
 
l_title = sy-title.
DESCRIBE TABLE gt_output LINES l_recs.
l_recs_c = l_recs.
 
w_list_comments-typ = 'H'. " H=Header, S=Selection, A=Action
w_list_comments-key = ''.
w_list_comments-info = l_title.
APPEND w_list_comments TO i_list_comments.
 
 
w_list_comments-typ = 'A'. " H = Header, S = Selection, A = Action
w_list_comments-key = ''.
CONCATENATE text-td1 l_exdate INTO w_list_comments-info
SEPARATED BY space.
APPEND w_list_comments TO i_list_comments.
 
w_list_comments-typ = 'A'. " H = Header, S = Selection, A = Action
w_list_comments-key = ''.
 
CONCATENATE text-td2 l_recs_c INTO w_list_comments-info
SEPARATED BY space.
APPEND w_list_comments TO i_list_comments.
 
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
* i_logo = ''
it_list_commentary = i_list_comments.
 
ENDFORM. "alv_top_of_page


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* i_background_id = 'SIWB_WALLPAPER'
i_callback_program = w_repid
i_callback_html_top_of_page = w_html_top_of_page
* i_structure_name = 'TRDIR'
i_default = 'X'
i_save = 'A'
is_variant = w_variant
is_layout = w_layout
i_callback_user_command = w_callback_ucomm
it_fieldcat = i_fieldcat_alv
it_events = i_events
it_event_exit = i_event_exit
it_excluding = i_excluding
is_print = w_print
TABLES
t_outtab = gt_output.

[;

HTH

Regards

Dhruv Shah

Former Member
0 Kudos

In parameter I_CALLBACK_TOP_OF_PAGE you must put the name of TOP-OF-PAGE form.

Then you must code the TOP-OF-PAGE FORM.

In FM REUSE_ALV_GRID_DISPLAY.

REUSE_ALV_GRID_DISPLAY.

.

I_CALLBACK_TOP_OF_PAGE = 'TOP'.

You must create a FORM with the name that you put in I_CALLBACK_TOP_OF_PAGE.

FORM TOP.

Put code of TOP-OF-PAGE here.

ENDFORM.

Former Member
0 Kudos

Hi,

Refer the sample code.

DATA: lt_event TYPE slis_t_event, "for capturing top-of-page event

ls_event TYPE slis_alv_event,

l_repid TYPE sy-repid,

lt_sort TYPE slis_t_sortinfo_alv,

ls_sort TYPE slis_sortinfo_alv.

*Get all possible events

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = lt_event

EXCEPTIONS

list_type_wrong = 0

OTHERS = 0.

  • Specify events used in selection screen

READ TABLE lt_event WITH KEY name = slis_ev_top_of_page

INTO ls_event.

IF sy-subrc = 0.

ls_event-form = 'TOP_OF_PAGE'.

MODIFY lt_event FROM ls_event INDEX sy-tabix.

CLEAR ls_event.

ENDIF.

FORM top_of_page . "#EC CALLED

DATA: lt_top_of_page TYPE slis_t_listheader,

ls_line TYPE slis_listheader ,

l_text TYPE vtxtk ,

l_name1 TYPE name1 .

  • Kopfinfo: Typ S

CLEAR ls_line.

ls_line-typ = 'S'.

ls_line-key = text-t17.

ls_line-info = p_vkorg.

SELECT SINGLE vtext INTO l_text

FROM tvkot

WHERE spras EQ sy-langu

AND vkorg EQ p_vkorg .

IF sy-subrc EQ 0 .

CONCATENATE p_vkorg '(' l_text ')' INTO ls_line-info

SEPARATED BY space..

ENDIF.

APPEND ls_line TO lt_top_of_page.

ls_line-key = text-t18.

ls_line-info = p_werks.

SELECT SINGLE name1 INTO l_name1

FROM t001w

WHERE werks EQ p_werks.

IF sy-subrc EQ 0 .

CONCATENATE p_werks '(' l_name1 ')' INTO ls_line-info

SEPARATED BY space .

ENDIF.

APPEND ls_line TO lt_top_of_page.

  • To display the items at top of the page

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = lt_top_of_page.

Reward if helpful.

Regards,

Ramya

Former Member
0 Kudos

Hi,

                  • Declare events table

Data : I_events type slis_t_event,

W_events like line of I_events.

**********Build events table

W_events-name = ‘TOP_OF_PAGE’.

W_events-form = ‘TOPOF_PAGE’.----àattaching subroutine

Append w_events to I_events.

********Create subroutine …

Form topof_page.

Write ‘This is Top of Page ‘.

WRITE xy AS CHECKBOX.

Endform.

Then this thru REUSE_ALV_LIST_DISPLAY.

Thanks,

Venkat.O

Former Member
0 Kudos

HI,

see this code.u can find the check box status in the variable val



DATA:check VALUE 'X'.
data:val.
data:itab LIKE mara occurs 0.

SELECT * from mara into table itab up to 20 rows.

TYPE-POOLS:slis.

data:eve type slis_t_event  .
data: ls_event type slis_alv_event.

  call function 'REUSE_ALV_EVENTS_GET'
   exporting
     i_list_type           = 0
   importing
     et_events             = eve[].

  read table eve with key name =  'TOP_OF_PAGE'
              into ls_event.
  move 'TOP_OF_PAGE' to ls_event-form.
  APPEND ls_event to eve.

  read table eve with key name =  'USER_COMMAND'
              into ls_event.
  move 'UCOMM' to ls_event-form.
  APPEND ls_event to eve.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
 EXPORTING
   I_CALLBACK_PROGRAM             = SY-REPID
   I_STRUCTURE_NAME               = 'MARA'
   IT_EVENTS                      = eve[]
  TABLES
    T_OUTTAB                       = itab.

FORM TOP_OF_PAGE.
  WRITE: check AS CHECKBOX HOTSPOT ON.
ENDFORM.

form ucomm using r_ucomm like sy-ucomm
      rs_selfield type slis_selfield.
*  case r_ucomm.
*    when '&IC1'.
*      READ: LINE 1 FIELD VALUE check.
*  endcase.
  GET CURSOR FIELD check VALUE val.
*  write:/ val.
endform.

rgds,

bharat.

Former Member
0 Kudos

hai Anirban Datta,

REPORT YBALV_FULLSCREEN_DEMO NO STANDARD PAGE HEADING.

*"General Data

TYPE-POOLS: SLIS.

DATA: BEGIN OF GT_OUTTAB OCCURS 0.

INCLUDE STRUCTURE SFLIGHT.

DATA: END OF GT_OUTTAB,

GS_LAYOUT TYPE SLIS_LAYOUT_ALV,

G_EXIT_CAUSED_BY_CALLER,

GS_EXIT_CAUSED_BY_USER TYPE SLIS_EXIT_BY_USER,

G_REPID LIKE SY-REPID.

*"Callback

DATA:

GT_EVENTS TYPE SLIS_T_EVENT,

GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,

G_STATUS_SET TYPE SLIS_FORMNAME VALUE 'PF_STATUS_SET',

G_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND',

G_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',

G_TOP_OF_LIST TYPE SLIS_FORMNAME VALUE 'TOP_OF_LIST',

G_END_OF_LIST TYPE SLIS_FORMNAME VALUE 'END_OF_LIST'.

*"Variants

DATA: GS_VARIANT LIKE DISVARIANT,

G_SAVE.

INITIALIZATION.

G_REPID = SY-REPID.

PERFORM LAYOUT_INIT USING GS_LAYOUT.

PERFORM EVENTTAB_BUILD USING GT_EVENTS[].

GS_VARIANT-REPORT = G_REPID.

G_SAVE = 'A'.

START-OF-SELECTION.

*"Data Selection

PERFORM SELECT_DATA TABLES GT_OUTTAB.

END-OF-SELECTION.

*"List Header for Top-Of-Page

PERFORM COMMENT_BUILD USING GT_LIST_TOP_OF_PAGE[].

*"Display List

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_BACKGROUND_ID = 'ALV_BACKGROUND'

i_buffer_active = 'X'

I_CALLBACK_PROGRAM = G_REPID

I_STRUCTURE_NAME = 'SFLIGHT'

IS_LAYOUT = GS_LAYOUT

I_SAVE = G_SAVE

IS_VARIANT = GS_VARIANT

IT_EVENTS = GT_EVENTS[]

  • I_SCREEN_START_COLUMN = 0 "Use coordinates for

  • I_SCREEN_START_LINE = 0 "display as dialog box

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

IMPORTING

E_EXIT_CAUSED_BY_CALLER = G_EXIT_CAUSED_BY_CALLER

ES_EXIT_CAUSED_BY_USER = GS_EXIT_CAUSED_BY_USER

TABLES

T_OUTTAB = GT_OUTTAB

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF SY-SUBRC = 0.

IF G_EXIT_CAUSED_BY_CALLER = 'X'.

*" Forced Exit by calling program

*" <do_something>.

ELSE.

*" User left list via F3, F12 or F15

IF GS_EXIT_CAUSED_BY_USER-BACK = 'X'. "F3

*" <do_something>.

ELSE.

IF GS_EXIT_CAUSED_BY_USER-EXIT = 'X'. "F15

*" <do_something>.

ELSE.

IF GS_EXIT_CAUSED_BY_USER-CANCEL = 'X'. "F12

*" <do_something>.

ELSE.

*" should not occur!

*" <do_Abnormal_End>.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ELSE.

*"Fatal error callin ALV

  • MESSAGE AXXX(XY) WITH ...

ENDIF.

*"Form routines

"

FORM SELECT_DATA TABLES RT_OUTTAB LIKE GT_OUTTAB[].

*"- Selection of data to be displayed

SELECT * FROM SFLIGHT INTO CORRESPONDING FIELDS

OF TABLE RT_OUTTAB

UP TO 00030 ROWS.

ENDFORM.

FORM LAYOUT_INIT USING RS_LAYOUT TYPE SLIS_LAYOUT_ALV.

*"Build layout for list display

RS_LAYOUT-DETAIL_POPUP = 'X'.

ENDFORM.

FORM EVENTTAB_BUILD USING RT_EVENTS TYPE SLIS_T_EVENT.

*"Registration of events to happen during list display

DATA: LS_EVENT TYPE SLIS_ALV_EVENT.

*

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = RT_EVENTS.

READ TABLE RT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE

INTO LS_EVENT.

IF SY-SUBRC = 0.

MOVE G_TOP_OF_PAGE TO LS_EVENT-FORM.

APPEND LS_EVENT TO RT_EVENTS.

ENDIF.

ENDFORM.

FORM TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

I_LOGO = 'ENJOYSAP_LOGO'

IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.

ENDFORM .

FORM COMMENT_BUILD USING LT_TOP_OF_PAGE TYPE

SLIS_T_LISTHEADER.

DATA: LS_LINE TYPE SLIS_LISTHEADER.

*

  • LIST HEADING LINE: TYPE H

CLEAR LS_LINE.

LS_LINE-TYP = 'H'.

  • LS_LINE-KEY: NOT USED FOR THIS TYPE

LS_LINE-INFO = TEXT-100.

APPEND LS_LINE TO LT_TOP_OF_PAGE.

  • STATUS LINE: TYPE S

CLEAR LS_LINE.

LS_LINE-TYP = 'S'.

LS_LINE-KEY = TEXT-101.

LS_LINE-INFO = TEXT-102.

APPEND LS_LINE TO LT_TOP_OF_PAGE.

LS_LINE-KEY = TEXT-103.

LS_LINE-INFO = TEXT-104.

APPEND LS_LINE TO LT_TOP_OF_PAGE.

  • ACTION LINE: TYPE A

CLEAR LS_LINE.

LS_LINE-TYP = 'A'.

  • LS_LINE-KEY: NOT USED FOR THIS TYPE

LS_LINE-INFO = TEXT-105.

APPEND LS_LINE TO LT_TOP_OF_PAGE.

ENDFORM.

Regards.

Eshwar.