on 11-18-2014 3:01 AM
Hi ,
I am trying to implement export to excel functionality as mentioned in the below given wiki.
Download data from web ui to Excel and PPT - CRM - SCN Wiki
but when I click on the button then nothing happens in Web UI. Could you please help me and let me know if I am missing anything.
Thanks & Regards,
Kumar Gaurav
Hey Kumar,
I have a requirement to call UI5 app from button of BSP component.
So, could you please direct me the right path?
Thanks,
Devashish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Below is the code I have written in .htm page:
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="thtmlb" prefix="thtmlb" %>
<%@extension name="chtmlb" prefix="chtmlb" %>
<%@extension name="bsp" prefix="bsp" %>
<%
data: lv_xml type string.
DATA : lv_visible_row_count type i value 10.
lv_xml = controller->CONFIGURATION_DESCR->GET_CONFIG_DATA( ).
data: lv_iterator type ref to CL_CRM_TPMOE_ADSEARE_ITERATOR2.
create object lv_iterator
exporting
ir_context_node = advancedsearchresult
iv_mass_approve_flag = controller->GV_CUCOTRADE->mass_approve_flag.
lv_visible_row_count = controller->GET_VISIBLE_ROW_COUNT( ).
if lv_visible_row_count is initial or lv_visible_row_count = 0.
lv_visible_row_count = controller->GET_VISIBLE_ROW_COUNT( ).
endif.
%>
<%--<thtmlb:tray height = "100%"
id = "RPC">
<thtmlb:trayBody> --%>
<chtmlb:tableExtension tableId = "Table"
layout = "FIXED" >
<chtmlb:configCellerator id = "theCellerator"
actions = "<%= controller->gt_button %>"
actionsMaxInRow = "10"
iterator2 = "<%= lv_iterator %>"
table = "//ADVANCEDSEARCHRESULT/table"
usage = "SEARCHRESULT"
selectionMode = "MULTI"
onRowSelection = "select"
tableLayout = "FIXED"
selectedRowIndexTable = "<%= ADVANCEDSEARCHRESULT->SELECTION_TAB %>"
scrollRowCount = "20"
hasExpander = " "
horizontalScrolling = "TRUE"
expandedObjectIndexTable = "<%= controller->GT_EXPANDALL %>"
visibleRowCount = "<%= lv_visible_row_count %>"
isExpanded = "FROMREQUEST"
downloadToExcel = "TRUE" />
</chtmlb:tableExtension>
<%--****RPC Mass change Upload and download buttons --GAP043--%>
<% DATA: v_vkorg TYPE VKORG,
lv_org TYPE VKORG.
CALL METHOD zcl_crm_webui_org_data_helper=>get_active_sales_org
IMPORTING
ev_vkorg = v_vkorg.
SELECT SINGLE SALESORG from zvt_rpcmasschang INTO lv_org WHERE salesorg eq v_vkorg.
if sy-subrc eq 0.
%>
<%-- CLEAR i_button.--%>
<BR>
<thtmlb:button id = "RPCDownload"
design = "EMPHASIZED"
text = "RPC Download"
enabled = "TRUE"
onClientClick = "javascript:dwnToExcel( );" />
<%--<bsp:htmlbEvent name = "namedown"
id = "iddown"
onClick = "serverEvent"
p1 = "p1"
p2 = "p2"
p3 = "p3" />--%>
<script language="javascript">
<%--var button = document.getElementById("RPCDownload");
button.focus();
button.click();--%>
function dwnToExcel( )
{
var Excel, Workbook;
var count=1;
Excel = NEW ActiveXObject("Excel.Application");
Workbook = Excel.Workbooks.Add();
Workbook.ActiveSheet.Cells(1,1).Value = "Product ID";
Workbook.ActiveSheet.Cells(1,2).Value = "SoldToParty";
Workbook.ActiveSheet.Cells(1,3).Value = "Condition Value";
Workbook.ActiveSheet.Cells(1,4).Value = "Currency";
Workbook.ActiveSheet.Cells(1,5).Value = "Valid from";
Workbook.ActiveSheet.Cells(1,6).Value = "ValidTo";
Workbook.ActiveSheet.Range("A1:F1").Interior.ColorIndex = 43;
Workbook.ActiveSheet.Range("A1:F6").Borders(7).LineStyle = 2;
Workbook.ActiveSheet.Range("A1:F6").Borders(8).LineStyle = 2;
Workbook.ActiveSheet.Range("A1:F6").Borders(9).LineStyle = 2;
Workbook.ActiveSheet.Range("A1:F6").Borders(10).LineStyle = 2;
Workbook.ActiveSheet.Range("A1:F6").Font.Size = 10;
Workbook.ActiveSheet.Cells(1,1).Value = "<%= '50' %>";
Workbook.ActiveSheet.Cells(2,2).Value = "<%= '60' %>";
Workbook.ActiveSheet.Cells(3,3).Value = "<%= '70' %>";
Workbook.ActiveSheet.Cells(4,4).Value = "<%= '80' %>";
Workbook.ActiveSheet.Cells(5,5).Value = "<%= '90' %>";
Workbook.ActiveSheet.Cells(6,6).Value = "<%= '100' %>";
Excel.Visible = "true";
}
</Script>
<% endif.
%>
<%--</thtmlb:trayBody>
</thtmlb:tray>--%>
<%
CLEAR controller->GT_EXPANDALL.
%>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Kumar,
In SAP CRM onClick event is for trigger the sap crm event.
to trigger the event from java script we have to mention the event name onClientClick = 'eventname'
then only event will be triggered.
make sure that your javascript code does not contain any syntax error. otherwise the event will be not be triggered.
you can check javascript code errors in
User | Count |
---|---|
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.