cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CRM Web UI dowlonad excel from view set

Former Member
0 Kudos

Hello Experts,

I have a requirement in SAP CRM Web UI like, download data from view set into excel.In my view set, I have many views with table data.Now from all Views data should be download to excel with workbooks, here each view data should be in one workbook.Standard excel dowload functionality is downloading only first view from that view set.

Can you please suggest me here to achieve this functionality?

Thanks in Advance!

Regards,

Kiran

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Kiran,

Use static variables [Tables], or GDC or Component Usage.

Ucan use any logic for getting data from diffrent components.

and all the data put in one internal table create one button[Download ] in to Viewset and In event : EH_ONDOWNLOAD write the logic to fech the data and make the data into EXcel format [some standard clases are there for the logic,search it ], go to View set.Htm File create File path setting code,

please find attached for refference, that is for upload same for down load also.

thanks,

venkat.

Former Member
0 Kudos

Hello Venkatesh,

Thank you for response.It is useful information.

Regards,

Kiran

ceedee666
Active Contributor
0 Kudos

Hi Kiran,

if I understand you correctly you have a view set consisting of a set of different views, each one containing a table. Now you want to implement some functionality to download each of the tables into a different sheet in an excel work book.

In order to implement this you'll have to create some custom functionality. The standard excel download only works for one table at a time (the reason is, that it is a functionality implemented on the table level, therefore there is no way to download data from other views).

I would suggest trying the following path:

  1. have a look at the abap2xlsx project (abap2xlsx - ABAP Development - SCN Wiki). Its a very useful tool to create custom excel download. 
  2. Implement a custom method in each of the view controllers of the involved views to return the table data of each view
  3. Implement a custom action in the viewset that
    1. reads the data of each involved view
    2. exports the data of each view to excel using e.g. abap2xlsx

Hope this helps,

Christian

Former Member
0 Kudos

Hello Christian,

Yes, That is my exact requirement.

Let me try as you suggested.

Thank you very much!

Regards,

kiran

Former Member
0 Kudos

Hello Christian,

Here one more difficulty is , all my views(in View Set) are from different component and I am using component usage to get that views and place it in my view set.

can you please suggest me how can I get that views data in to my component? is this possible through custom method in the view controller.

Thanks in Advance!

Regards,

Kiran

ceedee666
Active Contributor
0 Kudos

Hi Kiran,

in the case of dynamic component usages you could, for example, us the component controllers  GET_COMPONENT_USAGE method to get the component usages. The use the method GET_CONTEXT_NODE to get a specific context node for each component. Next you could check if the context node implements a certain custom interface that you use to get the data.

If you want to build this fully dynamic you could use GET_RUNTIME_REPOSITORY of the component controller and get the runtime repository and read the used components via GET_CMP_USAGE_LIST.

Christian

Former Member
0 Kudos

Hello Christian,

Thank you for suggestion.I think,  I am not using dynamic component usage,because I have created  usages under "Component Usages".

Regards,

Kiran

corrine_guan
Employee
Employee
0 Kudos

Hello Kiran,


As you said 'Standard excel dowload functionality is downloading only first view from that view set'. Do you mean there is a viewset which contains several views? I want to know the steps of how to get this viewset in standard so that we can know how to achieve your requirement.

Best Regards, Corrine

Former Member
0 Kudos

Hello Corrine,

you would like to know about creating view set? or excel download functionality for view set?

Regards,

Kiran

corrine_guan
Employee
Employee
0 Kudos

Hi, Kiran,

You said 'Standard excel dowload functionality is downloading only first view from that view set', I just want to know how you find this. There must be some sample for it. Is this sample created by yourself? or you find it from some CRM standard overviewset? If it is from CRM standard viewset, which one is it?

Best Regards, Corrine

Former Member
0 Kudos

Hello Corrine,

This is custom view set.When I created my view set ,by default I got one excel download button on the right corner of the view set.This downloads only first view table data among different views form that work set.

I did not handled this functionality.I am looking for that logic too, where it has been written.So that I can customize that as per my requirement.

Regards,

Kiran

Former Member
0 Kudos

Go to every view.htm file make this property as downloadToExcel  = "TRUE", then when you click excel icon on the view it will down load to excel sheet for each view, how many views are there that many excel files will create.

if you want to create all the views data in one excel file.

then u have to create one button [ Down load to Excel ] in view set, write your own logic to fetch all views data into one internal table and download that data into Excel file.