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

weird problem in alv

Former Member
0 Likes
848

friends,

i have this weird problem, i am using the below code,

the code is working fine in the debugging, but when run it is only showing the topofpage, which contains all the input parameters, there are several input parametrs, so it takes more than a page,

where-in if i comment out the EVE[] in the alv mode,

it is finely showing the display, but the input parameters, which constitute the topofpage, is not displayed,

any clues please.

thank you.

9 REPLIES 9
Read only

Former Member
0 Likes
818

sorry, this is the code::

READ TABLE EVE WITH KEY NAME = 'TOP_OF_PAGE'.

EVE-FORM = 'TOPOFPAGE'.

MODIFY EVE TRANSPORTING FORM WHERE NAME = 'TOP_OF_PAGE'.

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

IS_LAYOUT = layo

IT_FIELDCAT = FCAT

IT_SORT = P_SORT[]

IT_EVENTS = EVE[]

I_TABNAME_HEADER = 'HEAD'

I_TABNAME_ITEM = 'T_DET'

IS_KEYINFO = kinfo

TABLES

T_OUTTAB_HEADER = head[]

T_OUTTAB_ITEM = t_det[]

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

Edited by: sanjana on Mar 3, 2008 6:34 PM

Read only

Former Member
0 Likes
818

Hi,

Please paste your code.

Thanks,

Sriram Ponna

Read only

Former Member
0 Likes
818

some one please help,

what i think is, if i can arrage the top of page to cover only first half of the page, so that we can scroll first half for the top of page, and seconf half for the alv display,

can some one help me, is there any way , i can restrict the topofpage only till half the page.

thank you

Read only

0 Likes
818

please help

Read only

Former Member
0 Likes
818

hi sanjana,

top-of-page may be like top_of_page not like top-of-page.

here i am using the events with a simple report .

check it ....

&----


*& Report ZPR_02

*&

&----


*&

*&

&----


REPORT ZPR_02.

TYPE-POOLS: SLIS.

TABLES: MARA.

DATA: BEGIN OF IT_MARA OCCURS 0,

MATNR LIKE MARA-MATNR,

MTART LIKE MARA-MTART,

MATKL LIKE MARA-MATKL,

END OF IT_MARA.

DATA: IT_FIELD_CAT TYPE SLIS_T_FIELDCAT_ALV,

WA_FIELD_CAT TYPE SLIS_FIELDCAT_ALV,

IT_EVENTS TYPE SLIS_T_EVENT,

WA_EVENTS TYPE SLIS_ALV_EVENT,

IT_HEADER TYPE SLIS_T_LISTHEADER,

WA_HEADER TYPE SLIS_LISTHEADER.

SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.

START-OF-SELECTION.

PERFORM GET_DATA.

PERFORM BUILD_FIELD_CAT.

PERFORM GET_EVENTS.

PERFORM DISPLAY_DATA.

&----


*& Form get_data

&----


  • text

----


FORM GET_DATA .

SELECT MATNR

MTART

MATKL

FROM MARA

INTO TABLE IT_MARA

WHERE MATNR IN S_MATNR.

ENDFORM. " get_data

&----


*& Form build_field_cat

&----


  • text

----


FORM BUILD_FIELD_CAT .

CLEAR WA_FIELD_CAT.

WA_FIELD_CAT-COL_POS = 1.

WA_FIELD_CAT-FIELDNAME = 'MATNR'.

WA_FIELD_CAT-SELTEXT_L = 'Material Number'.

APPEND WA_FIELD_CAT TO IT_FIELD_CAT.

WA_FIELD_CAT-COL_POS = 2.

WA_FIELD_CAT-FIELDNAME = 'MTART'.

WA_FIELD_CAT-SELTEXT_L = 'Material Type'.

APPEND WA_FIELD_CAT TO IT_FIELD_CAT.

WA_FIELD_CAT-COL_POS = 3.

WA_FIELD_CAT-FIELDNAME = 'MATKL'.

WA_FIELD_CAT-SELTEXT_L = 'Material Group'.

APPEND WA_FIELD_CAT TO IT_FIELD_CAT.

ENDFORM. " build_field_cat

&----


*& Form display_data

&----


  • text

----


FORM DISPLAY_DATA .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

IT_FIELDCAT = IT_FIELD_CAT

IT_EVENTS = IT_EVENTS

TABLES

T_OUTTAB = IT_MARA.

ENDFORM. " display_data

&----


*& Form get_events

&----


  • text

----


FORM GET_EVENTS .

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

  • EXPORTING

  • I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = IT_EVENTS .

READ TABLE IT_EVENTS INTO WA_EVENTS

WITH KEY NAME = SLIS_EV_TOP_OF_PAGE.

IF SY-SUBRC = 0.

WA_EVENTS-FORM = 'TOP_OF_PAGE'.

MODIFY IT_EVENTS FROM WA_EVENTS INDEX SY-TABIX.

ENDIF.

ENDFORM. " get_events

&----


*& Form top_of_page

&----


  • text

----


FORM TOP_OF_PAGE.

WA_HEADER-TYP = 'H'.

WA_HEADER-INFO = 'Material Data'.

APPEND WA_HEADER TO IT_HEADER.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = IT_HEADER

  • I_LOGO = I_LOGO

  • I_END_OF_LIST_GRID = I_END_OF_LIST_GRID

  • I_ALV_FORM = I_ALV_FORM

.

ENDFORM. "top_of_page

reward points if useful,

venkat.

Read only

Former Member
0 Likes
818

HERE IS another example using the top-of-page

report ztest.

type-pools slis.

data: begin of i_alv occurs 0,

matnr type mara-matnr,

meins like mara-meins,

mtart like mara-mtart,

pstat like mara-pstat,

end of i_alv.

  • Miscellanous Data Declarations

data: fieldcat type slis_t_fieldcat_alv,

events type slis_t_event,

list_top_of_page type slis_t_listheader,

top_of_page type slis_formname value 'TOP_OF_PAGE'.

start-of-selection.

perform initialization.

perform get_data.

perform call_alv.

end-of-selection.

***********************************************************************

  • Form Initialization

***********************************************************************

form initialization.

clear i_alv. refresh i_alv.

perform eventtab_build using events[].

endform.

***********************************************************************

  • Form Get_Data

***********************************************************************

form get_data.

select matnr

meins

mtart

pstat

into table i_alv

from mara up to 100 rows.

endform.

***********************************************************************

  • CALL_ALV

***********************************************************************

form call_alv.

data: variant type disvariant.

data: repid type sy-repid.

repid = sy-repid.

variant-report = sy-repid.

variant-username = sy-uname.

perform build_field_catalog.

perform comment_build using list_top_of_page[].

  • Call ABAP List Viewer (ALV)

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

it_fieldcat = fieldcat

i_callback_program = repid

is_variant = variant

it_events = events[]

i_save = 'U'

tables

t_outtab = i_alv.

endform.

***********************************************************************

  • EVENTTAB_BUILD

***********************************************************************

form eventtab_build using events type slis_t_event.

  • Registration of events to happen during list display

data: tmp_event type slis_alv_event.

call function 'REUSE_ALV_EVENTS_GET'

exporting

i_list_type = 0

importing

et_events = events.

read table events with key name = slis_ev_top_of_page

into tmp_event.

if sy-subrc = 0.

move top_of_page to tmp_event-form.

append tmp_event to events.

endif.

endform.

***********************************************************************

  • BUILD_FIELD_CATALOG

***********************************************************************

form build_field_catalog.

clear: fieldcat. refresh: fieldcat.

data: tmp_fc type slis_fieldcat_alv.

tmp_fc-reptext_ddic = 'Material'.

tmp_fc-fieldname = 'MATNR'.

append tmp_fc to fieldcat.

tmp_fc-reptext_ddic = 'Industry sector'.

tmp_fc-fieldname = 'MEINS'.

tmp_fc-outputlen = 18.

append tmp_fc to fieldcat.

tmp_fc-reptext_ddic = 'Material type'.

tmp_fc-fieldname = 'MTART'.

append tmp_fc to fieldcat.

tmp_fc-reptext_ddic = 'Materialstatus'.

tmp_fc-fieldname = 'PSTAT'.

append tmp_fc to fieldcat.

endform.

***********************************************************************

  • COMMENT_BUILD

***********************************************************************

form comment_build using list_top_of_page type

slis_t_listheader.

data: tmp_line type slis_listheader.

clear tmp_line.

tmp_line-typ = 'H'.

tmp_line-info = 'Here is a line of text'.

append tmp_line to list_top_of_page.

clear tmp_line.

tmp_line-typ = 'S'.

tmp_line-key = 'Key1'.

tmp_line-info = 'Here is a value'.

append tmp_line to list_top_of_page.

clear tmp_line.

tmp_line-typ = 'A'.

tmp_line-key = 'Key2'.

tmp_line-info = 'Here is another value'.

append tmp_line to list_top_of_page.

endform.

***********************************************************************

  • TOP_OF_PAGE

***********************************************************************

form top_of_page.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

i_logo = 'ENJOYSAP_LOGO'

it_list_commentary = list_top_of_page.

endform.

regards,

venkat.

Read only

Clemenss
Active Contributor
0 Likes
818

Hi Sanjana,

if the top-of-page exceeds one page, you get into trouble. Try the end_of_list event - it may be as long as required.

Regards,

Clemens

Read only

Former Member
0 Likes
818

HI CLEMENS,

yours is agood idea,

but the alv display is also too long that, it is occupying the whole page,

i tried this end-of-page event,

but at hte end there is nothing displayed.

is there any way i restrict either the alv display or top of page.

Read only

0 Likes
818

Hi sanjana,

what I recommended is END_OF_LIST not end_of_page. end_of_page is repeated on every page, END_OF_LIST appears just once after all pages have been output. Thus there is an unlimited length that may cover several pages.

If you used a grid control, you have to switch to print preview to see how the list is like.

Regards,

Clemens