Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem with ALV block list events

Dear All:

Here's the actual working code. I wanted to have 2 different headings for the alv lists. However the result shows the 2 headings look the same. I know the event call timing might not be right. But I really can't tell what's wrong with this. Can anyone help?

thanks in advance.

-


REPORT ZTEST2.

type-pools: slis.

data : NUM type I,

begin of str,

client like mara-mandt,

mat like mara-matnr,

end of str,

tab like standard table of str.

data :wa2 type slis_alv_event ,

tab2 like standard table of wa2,

wa1 type slis_layout_alv,

wa type line of slis_t_fieldcat_alv,

tab1 like standard table of wa.

wa-reptext_ddic = 'Client Num'.

wa-fieldname = 'CLIENT'.

wa-tabname = 'TAB'.

wa-ref_fieldname = 'MANDT'.

wa-ref_tabname = 'MARA'.

wa-seltext_l = 'CLIENT'.

append wa to tab1.

wa-reptext_ddic = 'Mat Number'.

wa-fieldname = 'MAT'.

wa-tabname = 'TAB'.

wa-ref_fieldname = 'MATNR'.

wa-ref_tabname = 'MARA'.

wa-seltext_l = 'MATERIAL'.

append wa to tab1.

wa2-NAME = SLIS_EV_TOP_OF_PAGE.

wa2-FORM = 'WRITE_TOP_PAGE'.

APPEND wa2 TO tab2.

select mandt matnr up to 30 rows from mara into table tab.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

EXPORTING

I_CALLBACK_PROGRAM = sy-cprog

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • IT_EXCLUDING =

.

NUM = 1.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

IS_LAYOUT = wa1

IT_FIELDCAT = tab1

I_TABNAME = 'TAB'

IT_EVENTS = tab2

  • IT_SORT =

  • I_TEXT = ' '

TABLES

T_OUTTAB = tab

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

NUM = 2.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

IS_LAYOUT = wa1

IT_FIELDCAT = tab1

I_TABNAME = 'TAB'

IT_EVENTS = tab2

  • IT_SORT =

  • I_TEXT = ' '

TABLES

T_OUTTAB = tab

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

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

WRITE: / ,

/ 'TABLE NUMBER :', NUM.

ENDFORM.

Tags:
replied

Hi Jim,

remove

NUM = 2. part and do this..

FORM WRITE_TOP_PAGE.
WRITE: / ,
/ 'TABLE NUMBER :', NUM.
<b>NUM = NUM + 1.</b>
ENDFORM.

regards

satesh

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question