Download to excel in different tabs from bsp page

Hi all,
I have a requirement in which I have to download to xl-sheet in different tabs based on some conditions from a bsp page.
I am successful in downloading data into different tabs.
Now I had written the piece of code required to download to xl in a function module
and I am calling that function module when pressing a button in bsp page.
When I run the fm seperately its working but when I run it from bsp page its not working.But while debugging I found that the fm is being called and executed perfectly without any errors.
But the xl is not being created on our side.
Can anyone suggest me how to proceed on this.
Helpful answers will be rewarded.
Thanks,
Uga

Hi Raja,
Yes I am using ole objects.
For more clarity I am alos pasting my code.
If this is not possible then please guide how to achieve this in BSP.
*******************CODE*****************************************
include ole2incl.
data: w_cell1 type ole2_object,
w_cell2 type ole2_object.
*--- Ole data Declarations
data: h_excel type ole2_object, " Excel object
h_mapl type ole2_object, " list of workbooks
h_map type ole2_object, " workbook
h_zl type ole2_object, " cell
h_f type ole2_object, " font
gs_interior type ole2_object, " Pattern
worksheet type ole2_object,
h_cell type ole2_object,
h_cell1 type ole2_object,
range type ole2_object,
h_sheet2 type ole2_object,
h_sheet3 type ole2_object,
gs_font type ole2_object,
flg_stop(1) type c.
Internal table Declaration
data:gt_kna1 type standard table of kna1,
     gt_knvv type standard table of knvv,
     wa_kna1 type kna1,
     wa_knvv type knvv.
types: data1(1500) type c,
ty type table of data1.
data: it type ty with header line,
it_2 type ty with header line,
it_3 type ty with header line,
rec type sy-tfill,
deli(1) type c,
l_amt(18) type c.
data: begin of hex,
tab type x,
end of hex.
field-symbols: <fs> .
     constants cns_09(2) type n value 09.
assign deli to <fs> type 'X'.
hex-tab = cns_09.
<fs> = hex-tab.
data gv_sheet_name(20) type c .
SELECT kunnr name1
  INTO corresponding fields of table gt_kna1
  FROM kna1
UP TO 1000 ROWS.
SELECT kunnr vkorg
  INTO corresponding fields of table gt_knvv
  FROM knvv
UP TO 3 ROWS.
loop at gt_kna1 into wa_kna1.
concatenate  wa_kna1-kunnr  wa_kna1-name1 into it separated by deli.
append it.
clear it.
endloop.
loop at gt_knvv into wa_knvv.
concatenate wa_knvv-kunnr wa_knvv-vkorg into it_2 separated by deli.
append it_2.
clear it_2.
endloop.
if h_excel-header = space or h_excel-handle = -1.
*start Excel
create object h_excel 'EXCEL.APPLICATION'.
endif.
call method of h_excel 'Workbooks' = h_mapl.
set property of h_excel 'Visible' = 1.
*add a new workbook
call method of h_mapl 'Add' = h_map.
gv_sheet_name = 'KNA1'.
get property of h_excel 'ACTIVESHEET' = worksheet.
set property of worksheet 'Name' = gv_sheet_name .
*--Formatting the area of additional data 1 and doing the BOLD
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 50.
call method of h_excel 'Range' = h_cell
exporting
#1 = w_cell1
#2 = w_cell2.
*CALL METHOD OF gs_cells 'Select' .
get property of h_cell 'Font' = gs_font .
set property of gs_font 'Bold' = 1 .
data l_rc type i.
call method cl_gui_frontend_services=>clipboard_export
importing
data = it[]
changing
rc = l_rc
exceptions
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
others = 4.
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 1.
PERFORM err_hdl.
call method of h_excel 'Range' = range
exporting
#1 = w_cell1
#2 = w_cell2.
call method of range 'Select'.
*PERFORM err_hdl.
call method of worksheet 'Paste'.
****for second sheet**********
GV_SHEET_NAME = '2ND SHEET'.
gv_sheet_name = 'Knvv'.
get property of h_excel 'Sheets' = h_sheet2 .
call method of h_sheet2 'Add' = h_map.
set property of h_map 'Name' = gv_sheet_name .
get property of h_excel 'ACTIVESHEET' = worksheet.
*--Formatting the area of additional data 1 and doing the BOLD
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 50.
call method of h_excel 'Range' = h_cell
exporting
#1 = w_cell1
#2 = w_cell2.
get property of h_cell 'Font' = gs_font .
set property of gs_font 'Bold' = 1 .
call method cl_gui_frontend_services=>clipboard_export
importing
data = it_2[]
changing
rc = l_rc
exceptions
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
others = 4.
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 1.
PERFORM err_hdl.
call method of h_excel 'Range' = range
exporting
#1 = w_cell1
#2 = w_cell2.
call method of range 'Select'.
PERFORM err_hdl.
call method of worksheet 'Paste'.
Can you people give me inputs so that I can proceed further.
Thanks,
Uga

Similar Messages

  • Call an Function Module from BSP page to import an CSV file to internal tab

    Hi Experts,
    I am working on creating a web application in BSP which will call the function module  ALSM_EXCEL_TO_INTERNAL_TABLE.
    This function module imports an excel file into an internal table.
    Since this is the first time I am working on BSP I am not sure how to call this FM from event handler tab in BSP page.
    What I could gather from previous posts is that we need to create an attribute which should take the value of the export parameter of the function module.But I am kind of messed up on this.
    Could u guys please help ,I would be extremely grateful.Points will be assigned for sure
    Thanking in anticipation
    Ankit

    Could you please let me know how I can call an abap function module from a transformation? (from abap xslt program). I know how we can call methods of a class from the transformations, but no idea how we can call function modules. Any suggestions or a sample code snippet towards this will be very useful for me.
    Thanks,
    Shashi.

  • Download Text file to Local drive from BSP Application

    Hi Guys,
    I am new to BSP, and I am doing a BSP application in which i want to download a text file to local drive C: on click of button. For that I am having a data in Internal table and Onclick event, in model class method DO_HANDLE_EVENT i want to download text file to local machine drive.
    Can anybody provide me full code with all data declaration and all?
    Your help would be appriciable. Thanks in Advance.

    Hi Jessy ,
    You can download the file from BSP pages using the method
    CL_BSP_UTILITY=>download.
    Please follow the below mentioned steps.
    1.Convert the text to a text table ie Internal table with a line type char255 or some others.
    2.Convert the text table into a string.
    3.Convert the string to XSTRING.
    4.Download that XSTRING as text file using the method
       CL_BSP_UTILITY=>download.
    Parameters:
    OBJECT_S    - XSTRING data
    CONTENT_TYPE  =  ' application/download'
    CONTENT_DISPOSITION = 'attachment; file=test.txt'
    RESPONSE                   = runtime->server->response
    NAVIGATION                   = navigation
    OBJECT_T
    I dont have system to give a programatical explanation to u.
    If you have any doubt kindly post.
    Reward for every useful solutions..
    Best Regards
    Renga

  • How to send/set parameter from BSP page to iview

    Dear Expert,
    Can advise me how to send or set parameter from BSP page to iview ?
    http://xxx.xxx.com/irj/portal?navigationtarget=roles://pcd:portal_content/FLD.ObjetLibrary/FLD.Iviews/FLD.CRM/ET/bsppage.htm?lv_param=xxx
    I want to view my bsp page in portal but with parameter value.
    I can open my bsp page without parameter value like link below :
    http://xxx.xxx.com/irj/portal?navigationtarget=roles://pcd:portal_content/FLD.ObjetLibrary/FLD.Iviews/FLD.CRM/ET/
    Thnx & Regards,
    Pieter

    Hi,
    your BSP page get's integrated via an iFrame. So, simply speaking, it's not possible to pass an parameter back.
    But what you can try is to use the Portal DataBag component. In the BSP page, store the information you want to pass in the browser. The iView/Portal than has to check if there is a new parameter / value stored.
    SAP Help: http://help.sap.com/saphelp_nw70/helpdata/en/68/322a9261c54e51b7965f86aac3dae2/frameset.htm
    br,
    Tobias

  • Download Internal table to Excel with different Tabs -  ole2_object

    Hi All,
    I am using  ole2_object to download the data from internal table to Excel file. As per different values in sorting key, data will be downloading in different tab in same Excel file.
    In my internal table one field is of character type and some times contains number as value.
    e.g.  itab-code = ‘000002’.
    While downloading to Excel, Excel consider this value as numeric and remove the leading zero.
    Any suggestions for how to set format property as ‘Text’ for this cell, will highly appreciated.
    Sample  code -
       data: gs_excel type ole2_object,
             gs_wbooklist type ole2_object,
             gs_application type ole2_object,
             gs_wbook type ole2_object,
             gs_activesheet type ole2_object,
             gs_sheets type ole2_object,
             gs_newsheet type ole2_object,
             gs_cell type ole2_object.
       create object gs_excel 'EXCEL.APPLICATION'.
       get property of gs_excel 'workbooks' = gs_wbooklist.
       get property of gs_wbooklist 'Application' = gs_application.
       set property of gs_application 'SheetsInNewWorkbook' = 1.
       call method of gs_wbooklist 'Add' = gs_wbook.
       get property of gs_application 'ActiveSheet' = gs_activesheet.
       set property of gs_activesheet 'Name' = datasheet_name.
      call method of gs_excel 'Cells' = gs_cell exporting #1 = v_row           
                                              #2 = v_col.
      set property of gs_cell 'value' = <f>.
    GET PROPERTY OF gs_cell 'Font' = gs_Font.
    SET PROPERTY OF gs_Font 'Bold' = 1 .
    Thanks.
    Regards,
    Meenakshi.

    Hello,
    Just concatenate ' infont of the fields, which you want to treat as a text.
    Like,
    itab-code = '00002'.
    concatenate '''' itab-code  into itab-code.
    modify itab.
    You can also set the text properties of the cell by,
      SET PROPERTY OF gs_cell 'NumberFormat' = '@' .
    but, it will remove the leading zeros and set the format as text.
    Regards,
    Naimesh

  • MB51, download to excel works different for online and background.

    Hi,
    Have a question regarding excel download of MB51 in online mode against background.
    If I run MB51 online, I can download it to an excel sheet that is easy to read and work with. Each column in the report in seperate column in excel.
    If I run it in the background, try to download the spool to excel, I don't get the columns the same way as online report.
    I’ve tried changing the layout, downloading to excel, downloading to text and then dropping to excel, etc.
    Why won’t the download from a batch job work the same as online?
    Any ideas or anyway to fix?

    Hi All,
    I am also facing the same problem. When I download to Powerpoint, its getting downloaded properly and whn I download to excel, I am not able to download properly. I have 2 charts of the same report being displayd sde-by-side and under them I have a pivot table displayed in compound view. When downloaded to excel, the first chart is overlapping on top of the report in the excel.
    Can anyone suggest if we have any options?
    Thanks Shravan

  • How to call a Webdynpro view from BSP page (MVC) in a new window?

    Dear Experts,
    kindly advise how to call a webdynpro view from BSP application after performing an event (through button or hyper link).
    Regards,
    Sarat.

    Hi,
    This has been discussed many times in several forums.
    Please check the method CL_WD_UTILITIES=>CONSTRUCT_WD_URL, to create a runtime url for your WD Application and call this URL.
    Refer thread: Call Webdynpro Application from BSP Application
    Hope this will be useful!
    Regards,
    Meganadhan S

  • Unable to remove sub-tab from portal page

    Hi,
    Get the following error when trying to remove a sub-tab from one of our portal pages;
    An unexpected error occurred: User-Defined Exception (WWC-44082)
    An unexpected error occurred: User-Defined Exception (WWC-44082)
    Error while deleting page. (WWC-44130)
    An unexpected error occurred: ORA-20100:
    ORA-06512: at "PORTAL.WWSBR_STDERR", line 437
    ORA-06512: at "PORTAL.WWV_THINGDB", line 4021
    ORA-01403: no data found
    ORA-01403: no data found (WWC-44082)
    An unexpected error has occurred (WWS-32100)
    ORA-1403: ORA-01403: no data found
    ORA-01403: no data found (WWC-36000)
    Unexpected error encountered in wwsec_api.remove_group_acl (ORA-01403: no data found
    ORA-01403: no data found) (WWC-41417)
    In advanced options for the tab, 'Inherit Access Settings From The Page' is selected.
    Under page access settings, the 'From page template' option is selected.
    Any ideas?
    Cheers,
    Chris

    Please report this problem to Oracle Support. This is not normal behaviour.

  • Calling Z function module from BSP page

    hi,
      i am calling a z function module from BSP application ROS_SELF_REG ,The z function module is inside a z function group,It does not give any sytnax error..but while running BSP application ,it is going into dump saying that Z function module is not found..Any idea why this is happening???

    Hi,
    Check whether the Z function module is spelled correctly. Also try activating the whole function group and function module in se80 transaction.
    Check whether the BSP application is calling the Z FM from the correct server/client where it is available.
    Regards,
    Harish

  • Call function module from BSP page

    Hi Experts,
    I am new to ABAP and BSP as well.
    I am creating an BSP page through which I want to call an function module in R/3 which will fetch a file from the application server and place into an internal table.
    I have identified the function module.
    My questions are:
    Since I am going to have an web interface where on a button click the file should be uploaded to the intrernal table.So how do I call the function module.
    Can I use JSP and ABAP together in an BSP page.
    Thanks
    Ankit

    Hello Ankit,
    Please check the following link:
    http://help.sap.com/saphelp_47x200/helpdata/en/bd/ac1e3a0088e042e10000000a11402f/frameset.htm
    I think it will answer all your queries.
    Regards,
    Siddhesh

  • Newly downloaded Firefx and lost my tabs for tools pages etc how do i get them back

    Newly downloaded Firefox and lost my tabs top right i.e.
    Pages, tools,
    How do I get these with firefox homepage?

    Can you attach a screenshot?
    *http://en.wikipedia.org/wiki/Screenshot
    *https://support.mozilla.org/kb/how-do-i-create-screenshot-my-problem
    Use a compressed image type like PNG or JPG to save the screenshot.
    Make sure that you do not run Firefox in full screen mode (press F11 or Fn + F11 to toggle; Mac: command+Shift+F).
    *https://support.mozilla.org/kb/how-to-use-full-screen
    Make sure that toolbars like the "Navigation Toolbar" and the "Bookmarks Toolbar" are visible:
    *Firefox > Options
    *"View > Toolbars"
    *https://support.mozilla.org/kb/How+to+customize+the+toolbar
    *https://support.mozilla.org/kb/Back+and+forward+or+other+toolbar+items+are+missing
    *http://kb.mozillazine.org/Toolbar_customization

  • OLAP object connected to BW from BSP page

    i All,
    Are there any objects OLAP for bsp ?
    I want to connect BW'cube  to my BSP application but not in static mode.
    Is-it possible ?
    Best regards,
    Thierry Chiret

    Hi Chairet,
    FM to change data in a BW cube from BSP? -
    > very helpful
    Calling BW reports from BSP
    look at this forum.
    cheers,
    Bhavana

  • Open dynamic tab from remote page

    Hi!
    I have a question. We use JDeveloper 11.1.2.1.0
    We are using dynamicTabShell template for dynamic tabs managment in our application. Everything works as it should if page is using dnymicTabShell template. But...
    I would like to have a Home.jspx that would load when client logs in. Home should be a special page without dynamic tabs support. I would like to have quick links on Home.jspx that would open certain page and bounded task flow with page fragments in application. How can I achieve that? Do I have to enable URL invoke property? Problem is, we implemented custom security that checks if client has proper permissions before task flow is launched through _launchActivity* method in launcher.java. URL invokation would make security more complex.
    In fewer words: Is there's a way of opening certain tab in application from page that does not use dynamicTabShell template? Or do I have to enable URL invoke property on bounded task flows with page fragments? How can I then check permissions if task flow is reachable through URL.
    I hope I'm being clear.
    Regards, Marko

    OK, is there no other way of opening a bounded task flow with page fragments in a page (which is using dynamicTabShell template) from other page that is not using dynamicTabShell template?
    Maybe calling _launchActivity in beforePhase is completely wrong approach, because "java.lang.NullPointerException: UIComponent is null" is returned.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Stop Safari tabs from switching page

    Is there a way to stop Safari from switching the active tab when certain pages load.
    For example every-time gmail finishes loading a page it brings that tab to the forefront.
    I noticed Saft can do this but there must be another way that is free or with the terminal.
    Any ideas?

    This is a feature of the site you are visiting, not Safari per se. Usually it's achieved via a JavaScript call, so if you disable that in the Safari preferences it should stop happening. Of course, that's not too useful for other sites that really need it enabled.
    Don't forget to send feedback to the websites where this is occuring.

  • Presentation Server Download from BSP Page

    Hi,
    I am using the class cl_bsp_utility method DOWNLOAD and getting the Wait...Your request is being processed
    message.
    I have read other blogs that give an alternative solution with a 1px by 1 px iFrame.
    Also, I have seen a couple of posts say that we need to undo the <xhtmlb:protectDoubleSubmit> tag.
    I have put the event handler code on an image click and have no idea where to do this
    <xhtmlb:protectDoubleSubmit>.
    Does someone have any idea.
    Please help.

    Hi,
    I am not understanding exactly where your problem is, but you use the tag in your BSP code somewhere between the opening <HTMLB:CONTENT> and the closing </HTMLB:CONTENT>.
    BSP element <xhtmlb:protectDoubleSubmit> can be used within an HTMLB:form BSP element to prevent a user from triggering a new event until the first event has been processed on the server and a response has been sent to the browser, where it was received.
    This makes sense in particular if response times exceed a few hundred milliseconds, as in these cases users tend to press a radiobutton again to speed up the response.
    The tag itself does not trigger an event that you can capture in OnInputProcessing or in DoHandleEvent and the message shows up automatically.

Maybe you are looking for

  • How can I sync my new iPhone 4S to calendar, contacts, and photos on my MacBook?

    Just bought my first iPhone after 2 years as an Android user. My 2008 MacBook would never talk to the Android, but now - they tell me - I can backup my phone onto my computer and share contacts, calendar and photos with the computer. I've plugged the

  • Chart of Accounts Upload

    Hi , I am working on upload of Chart of Accounts. Here I have to upload the Group Chart of Accounts and then the Operational Chart of Accounts( company code level ). Can you please suggest a detailed right approach to do it  ? I am currently  using t

  • How to setup SMTP server  in PC so as to send mails using JavaMail

    Hi, From forums i got it cleared that we can use JavaMail to send emails. I also got two sample codes about getting it done. But in the code its asks address of the host of SMTP server. I dont have any SMTP server. But i am writing a Library Applicat

  • Auto payment is availabe for interface or API?

    Dear all I got some problem on auto payment. Is it possible to pay invoices automatically by interface or API? Thanks. Best Regards Elton

  • Changing applet parameters with Javascript

    Is it possible to have an applet read a param value which has been changed with Javascript after the applet loads? I've tried changing the param value in this way, but the applet doesn't read the new value. It reads the default value in the HTML when