04-24-2007 5:44 PM
I am getting a problem with logo in interactive reports. When i drill down the interactive report and when i come back to the first report the logo is displayed twice. Again if i drilled down and come back to the first report the logo is displayed thrice. Here is my code.
****************************************************
REPORT ZBPMYALVINTERACTIVE1 no standard page heading line-count 32(2).
TYPE-POOLS: SLIS.
tables: kna1,vbak,vbap.
select-options : cust for kna1-kunnr.
types: begin of t_kna1,
kunnr type kunnr,
name1 type name1,
ort01 type ort01,
land1 type land1,
end of t_kna1.
types: begin of t_vbak,
vbeln type vbeln,
netwr type netwr,
end of t_vbak.
types: begin of t_vbap,
posnr type posnr,
matnr type matnr,
end of t_vbap.
data: i_kna1 type standard table of t_kna1 initial size 100,
w_kna1 type t_kna1,
i_vbak type standard table of t_vbak initial size 100,
w_vbak type t_vbak,
i_vbap type standard table of t_vbap initial size 100,
w_vbap type t_vbak.
data: repid like sy-repid.
data: w_fcat1 type slis_fieldcat_alv,
t_fcat1 type slis_t_fieldcat_alv,
w_fcat2 type slis_fieldcat_alv,
t_fcat2 type slis_t_fieldcat_alv,
w_fcat3 type slis_fieldcat_alv,
t_fcat3 type slis_t_fieldcat_alv.
data: t_events type slis_t_event,
s_events type slis_alv_event,
it_header type slis_t_listheader.
perform getdata.
repid = sy-repid.
select kunnr land1 name1 ort01 from kna1 into table i_kna1 where
kunnr in cust.
*
*CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid "vivek
I_callback_user_command = 'USER_COMMAND' "vivek
IT_FIELDCAT = t_fcat1
IT_EVENTS = t_events
TABLES
T_OUTTAB = i_kna1.
*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_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND '
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = 'Hindusthan Motors limited'
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = t_fcat1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = t_events
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_kna1
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.
*CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = header
I_LOGO = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID =
.
&----
*& Form getdata
&----
text
----
--> p1 text
<-- p2 text
----
FORM getdata .
w_fcat1-fieldname = 'KUNNR'.
w_fcat1-outputlen = 7.
w_fcat1-seltext_m = 'Customer'.
append w_fcat1 to t_fcat1.
clear w_fcat1.
w_fcat1-fieldname = 'LAND1'.
w_fcat1-outputlen = 10.
w_fcat1-seltext_m = 'Country'.
append w_fcat1 to t_fcat1.
clear w_fcat1.
w_fcat1-fieldname = 'NAME1'.
w_fcat1-outputlen = 10.
w_fcat1-seltext_m = 'Name'.
append w_fcat1 to t_fcat1.
clear w_fcat1.
w_fcat1-fieldname = 'ORT01'.
w_fcat1-outputlen = 25.
w_fcat1-seltext_m = 'City'.
append w_fcat1 to t_fcat1.
clear w_fcat1.
w_fcat2-fieldname = 'VBELN'.
w_fcat2-seltext_m = 'Order No'.
append w_fcat2 to t_fcat2.
clear w_fcat2.
w_fcat2-fieldname = 'NETWR'.
w_fcat2-seltext_m = 'Net Order Value'.
append w_fcat2 to t_fcat2.
clear w_fcat2.
w_fcat3-fieldname = 'POSNR'.
w_fcat3-outputlen = 20.
w_fcat3-seltext_m = 'Sales Document'.
append w_fcat3 to t_fcat3.
clear w_fcat3.
w_fcat3-fieldname = 'MATNR'.
w_fcat3-outputlen = 20.
w_fcat3-seltext_m = 'Material Number'.
append w_fcat3 to t_fcat3.
clear w_fcat3.
*--- Vivek Begin of comments
s_events-name = 'user_command'.
s_events-form = 'val'.
append s_events to t_events.
*--- Vivek End of comments
*--- Vivek Begin of insertion
s_events-name = slis_ev_user_command.
s_events-name = 'USER_COMMAND'.
APPEND s_events TO t_events.
*--- Vivek End of insertion
ENDFORM. " getdata
&----
*& Form val
&----
text
----
--> p1 text
<-- p2 text
----
FORM user_command using command like sy-ucomm "vivek
sel type slis_selfield .
*FORM val using user_command like sy-ucomm "vivek
sel type slis_selfield .
data: cus(10) type n.
if sel-fieldname = 'KUNNR'.
cus = sel-value.
select vbeln netwr from vbak into table i_vbak where kunnr = cus.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
I_callback_user_command = 'USER_COMMAND1'
IT_FIELDCAT = t_fcat2
IT_EVENTS = t_events
TABLES
T_OUTTAB = i_vbak.
ENDIF.
*CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'repid'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = t_fcat2
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = t_events
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_vbak
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.
*
ENDFORM.
*
FORM user_command1 using command like sy-ucomm "vivek
sel type slis_selfield .
data: sal(10) type n.
if sel-fieldname = 'VBELN'.
sal = sel-value.
select posnr matnr from vbap into table i_vbap where vbeln = sal.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
IT_FIELDCAT = t_fcat3
IT_EVENTS = t_events
TABLES
T_OUTTAB = i_vbap.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
I_BACKGROUND_ID = 'Image '
I_GRID_TITLE = 'This is the Third Grid'
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = t_fcat3
IT_EVENTS = t_events
I_SCREEN_START_COLUMN = 10
I_SCREEN_START_LINE = 5
I_SCREEN_END_COLUMN = 20
I_SCREEN_END_LINE = 5
TABLES
T_OUTTAB = i_vbap
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.
ENDIF.
ENDFORM. " val
FORM TOP_OF_PAGE.
data: ls_line type slis_listheader.
ls_line-typ = 'H'.
ls_line-info = 'Your Insurance'.
append ls_line to it_header.
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = 'ORLANDO '.
append ls_line to it_header.
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = 'U.S.A'.
append ls_line to it_header.
clear ls_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = it_header
I_LOGO = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID =
ENDFORM.
*********************************************************************************
I think the problem is with topofpage event which is firing every time when i come back to first report.
Can any one suggest how to fix the error?
04-24-2007 5:47 PM
Hi,
Try using REFRESH it_header in the TOP_OF_PAGE subroutine..Changes marked in bold..
FORM TOP_OF_PAGE.
<b>REFRESH: it_header.</b>
data: ls_line type slis_listheader.
ls_line-typ = 'H'.
ls_line-info = 'Your Insurance'.
append ls_line to it_header.
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = 'ORLANDO '.
append ls_line to it_header.
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = 'U.S.A'.
append ls_line to it_header.
clear ls_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = it_header
I_LOGO = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID =
ENDFORM.
Thanks,
Naren
04-24-2007 5:47 PM
Hi,
Try using REFRESH it_header in the TOP_OF_PAGE subroutine..Changes marked in bold..
FORM TOP_OF_PAGE.
<b>REFRESH: it_header.</b>
data: ls_line type slis_listheader.
ls_line-typ = 'H'.
ls_line-info = 'Your Insurance'.
append ls_line to it_header.
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = 'ORLANDO '.
append ls_line to it_header.
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = 'U.S.A'.
append ls_line to it_header.
clear ls_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = it_header
I_LOGO = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID =
ENDFORM.
Thanks,
Naren
04-24-2007 5:51 PM
Hi
Set a flag when you come back.
say initially flag = 1.
if sy-ucomm = 'BACK'.
flag = 2.
endif.
and before calling this function.
check flag.
if flag = 1.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = it_header
I_LOGO = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID =
endif.
this will eliminate the repitations...
reward if this helps.
regards,
Aabhas
04-24-2007 8:25 PM
Hi,
Check the following link:
It contain sample program of logo in alv report.
Regards,
Bhaskar