Expose Saved Views on Web
<body>
<p align=”center”><u><b><font face=”Verdana” size=”6″>Custom Saved Views</font></b></u></p>
<table align=”center” border=”0″>
<tr></tr></table>
<p><font face=”Verdana”>User: <u><b><%= sy-uname%></b></u></font></p>
<table border=1 width=”75%” cellspacing=”1″ cellpadding=”1″ style=”border-collapse: collapse; border-color: #000000″>
<tr>
<td bgcolor=”#C0C0C0″ align=center>
<b> <font face=”Verdana” size=”2″>#</font> </b>
</td>
<td bgcolor=”#C0C0C0″ align=center>
<b> <font face=”Verdana” size=”2″>Technical Name</font> </b>
</td>
<td bgcolor=”#C0C0C0″ align=center>
<b> <font face=”Verdana” size=”2″>Description</font> </b>
</td>
</tr>
<%
data: wa_view type ZVIEWDETAILS.
loop at zviewde into wa_view.
%>
<tr>
<td align=center width=”10%”>
<font face=”Verdana” size=”2″>
<%= sy-tabix%>
</font>
</td>
<td style=”padding-left:15px”>
<a onclick=”showview(‘<%= wa_view-viewid%>’,'<%= zhostname%>’)” href=”” title=”Open the View ‘<%= wa_view-TXTLG%>'”>
<font face=”Verdana” size=”2″>
<%= wa_view-VIEWID%>
</font>
</a>
</td>
<td style=”padding-left:15px”>
<font face=”Verdana” size=”2″>
<%= wa_view-TXTLG%>
</font>
</td>
</tr>
<%
endloop.
%>
</table>
<p><font face=”Verdana” size=”2″>Note: Click on the Technical Name to Open the View</font></p>
</body>
</html></textarea><br/><br/>Then go to the Events Tab and go to OnInitialization and copy this code into the OnInitialization option</p><p> </p><p><textarea cols=”50″ rows=”20″>
*Select the saved views relevant for the user logged in
SELECT c~viewid c~infocube c~OWNER p~TXTLG
INTO corresponding fields of table zviewde
FROM RSZWVIEW AS c
INNER JOIN RSZWOBJTXT AS p ON p~OBJID = c~VIEWID
WHERE c~OWNER = sy-uname
AND c~OBJVERS = 'A'.
*Avoid exposing the actual server details if you have a Load balancer and *Dispatcher in place
select single HOST from HTTPURLLOC into zhostname.
if zhostname is INITIAL.
CALL FUNCTION 'TH_GET_VIRT_HOST_DATA'
EXPORTING
PROTOCOL = 1
VIRT_IDX = 0
* LOCAL = 1
IMPORTING
HOSTNAME = zserver
PORT = zport
* EXCEPTIONS
* NOT_FOUND = 1
* INTERNAL_ERROR = 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.
concatenate zserver
':'
zport into zhostname.
endif.
Activate and Execute the BSP and if you have any saved views against your name you should be able to see them here
<img width='"#C0C0C0" align=center>
<b> <font face="Verdana" size="2">Description</font> </b>
</td>
</tr>
<%
data: wa_view type ZVIEWDETAILS.
loop at zviewde into wa_view.
%>
<tr>
<td align=center width="10%">
<font face="Verdana" size="2">
<%= sy-tabix%>
</font>
</td>
<td style="padding-left:15px">
<a onclick="showview('<%= wa_view-viewid%>','<%= zhostname%>')" href="" title="Open the View '<%= wa_view-TXTLG%>'">
<font face="Verdana" size="2">
<%= wa_view-VIEWID%>
</font>
</a>
</td>
<td style="padding-left:15px">
<font face="Verdana" size="2">
<%= wa_view-TXTLG%>
</font>
</td>
</tr>
<%
endloop.
%>
</table>
<p><font face="Verdana" size="2">Note: Click on the Technical Name to Open the View</font></p>
</body>
</html></textarea><br/><br/>Then go to the Events Tab and go to OnInitialization and copy this code into the OnInitialization option</p><p> </p><p><textarea cols="50" rows="20">
*Select the saved views relevant for the user logged in
SELECT cviewid cinfocube cOWNER pTXTLG
INTO corresponding fields of table zviewde
FROM RSZWVIEW AS c
INNER JOIN RSZWOBJTXT AS p ON pOBJID = cVIEWID
WHERE c~OWNER = sy-uname
AND c~OBJVERS = ‘A’.
*Avoid exposing the actual server details if you have a Load balancer and *Dispatcher in place
select single HOST from HTTPURLLOC into zhostname.
if zhostname is INITIAL.
CALL FUNCTION ‘TH_GET_VIRT_HOST_DATA’
EXPORTING
PROTOCOL = 1
VIRT_IDX = 0
-
LOCAL = 1
IMPORTING
HOSTNAME = zserver
PORT = zport
-
EXCEPTIONS
-
NOT_FOUND = 1
-
INTERNAL_ERROR = 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.
concatenate zserver
‘:’
zport into zhostname.
endif.
Activate and Execute the BSP and if you have any saved views against your name you should be able to see them here
‘ /></body>