cancel
Showing results for 
Search instead for 
Did you mean: 

download data from WDY to desktop

Former Member
0 Kudos

hi,

I am trying to dwn a itab data from the WDY application through a button using the below code:

DATA lo_nd_cn_table TYPE REF TO if_wd_context_node.

DATA lo_el_cn_table TYPE REF TO if_wd_context_element.

DATA text TYPE string.

DATA xtext TYPE xstring.

DATA ls_cn_table TYPE wd_this->element_node_1.

DATA it_table TYPE wd_this->elements_node_1.

DATA wa_table TYPE wd_this->element_node_1.

  • navigate from <CONTEXT> to <CN_TABLE> via lead selection

lo_nd_cn_table = wd_context->get_child_node( name = wd_this->wdctx_node_1 ).

lo_nd_cn_table->get_static_attributes_table( IMPORTING table = it_table ).

LOOP AT it_table INTO wa_table.

CONCATENATE text

wa_table-matnr

wa_table-date

cl_abap_char_utilities=>newline INTO text SEPARATED BY

cl_abap_char_utilities=>horizontal_tab.

ENDLOOP.

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

EXPORTING

text = text

IMPORTING

buffer = xtext.

CALL METHOD cl_wd_runtime_services=>attach_file_to_response

EXPORTING

i_filename = 'C:\Desktop\Vipin\FS\WDYNEW.txt'

i_content = xtext

i_mime_type = 'TXT'

i_in_new_window = abap_true

i_inplace = abap_true.

but thru this code,I only see the data in a web page through a popup,its not saved on my system.

if I am trying to use it for excel format i.e xls format,nothing is displayed,the popup comes & disappers immediately,the pop up with data only appers for TXT format.

pls tell me how to solve this.I want to save the data

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Remove

i_in_new_window = abap_true

i_inplace = abap_true.

in the method call and try again.

Former Member
0 Kudos

Hi Vipin,

when you set i_inplace = abap_false you might store your content in a text file.

Best regards,

Andreas

Former Member
0 Kudos

Hi,

I observed one thing,I am getting the popup for saving the file,but in that case if & move to the downlaod action irrespective of no data in my table.

I have 3 views,1 for uplaod,2nd for data display in table & than 3rd view triggers on download button of 2nd view & ask for user action yes/no.if no back to view 2 & if yes than DOWNLAOD the data.

I found that,if I have no data in 2 view table & I got for downlaod button,than clicks YES on 3 view I am getting the popup for data save on my PC.If there is data on 2nd view,its do show this popup from 3rd view.

Pls tell me what is this error & how to solve this,why this data is imcompatible.

regds

vipin

Former Member
0 Kudos

Hi,

Let me re-iterate

You have 3 views

1. Upload

2. Display

3. Confirmation for D/L (when clicked in View 2)

What i dint get it how the current behaviour is....

You say that there is a pop-up being shown to download the file ? What happens after the download ?

Please a little more info on this.

Former Member
0 Kudos

Hi

See I have 3 view,1st to upload data than 2nd for data display with button for download which take to 3rd view for confirmation for YES/No,if NO than back to view 2nd,if YES than it will download the data.

So I have make the blank run of the application,with no data,than it shows me the pop up for download,but if there is data in view 2,it not shows the pop up & finishes the download action immediately,after allowing the IE pop up at the top,where it is suppose to display a full big pop up to specify the location & take confirmation for save.

I hope now req clear.

I am just wondering,why its showing the pop up to save when there is no data in 2nd view.

redgs

Former Member
0 Kudos

Hi.. it does not matter if u have data or not it continues with its execution.

But, tell me what is ur exact problem.

And, did u try removing the 2 parameters from ur method call like i mentioned in my previous reply

Regards,

Pramod

Former Member
0 Kudos

hi,

I have removed the abap_true statements from my code,my prob is only this that if I have data on my 2nd view,it doesn't prompt me for save,if I have no data,it gives me the prompt for save on PC.I am just not able to understand why this happening.

1 more thing I observed,if i try to clk more than 3-4 times for YES on 3rd view, if i have data on my 2 view,than it does the SAVE operation,but where it has to do for the very 1st time only,as user will not use this application like this,where as if the 2nd view is not with any data & i clk YES on 3rd view,on very 1st clk its give me the prompt for save,where this has to be reverse.

r u clr with the problem.

Former Member
0 Kudos

Hi,

You should use SAP business doc service ( BDS ) to save documents in any desired format and retrive it back when needed.

It is working fine for me in my WD application. Whatever file format you will upload, you can get it back. So if you want to save data in Excel format, you need to upload it in Excel format only.

Refer this blog for clear understanding

[ doc handling|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/6817%3Fpage%3Dlast] [original link is broken] [original link is broken] [original link is broken];

Regards

Vishal Kapoor