cancel
Showing results for 
Search instead for 
Did you mean: 

HOw to download a file in background without user intervention?

Former Member
0 Kudos
446

Hello people,

A few hours ago I asked a couple of guys how to download a file to html. For that I am most thankful, and as mentioned this is a two part question, my other question is about how to proccess downloading the html in background and to automatically send it to a folder or other path. Without any user intervention.

Example, I run a long report to be downloaded in background. The lets say the next day, I can get the file in a folder. Thanks guys take care!

View Entire Topic
jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Here is the sample code.

data: ifields type table of w3fields with header line.

data: ihtml type table of w3html with header line.

data itab type standard table of pa0001.

select * into corresponding fields of table itab

from pa0001 up to 100 rows.

call function 'WWW_ITAB_TO_HTML'

EXPORTING

  • TABLE_ATTRIBUTES = 'BORDER=1'

  • TABLE_HEADER =

ALL_FIELDS = 'X'

tables

html = ihtml

fields = ifields

  • ROW_HEADER =

itable = itab

.

  • Local variable Declaration

DATA l_msg(60) TYPE c.

  • Opening the file for output in text mode

OPEN DATASET '/sapio/outbound/html.txt' FOR OUTPUT

IN TEXT MODE ENCODING DEFAULT MESSAGE l_msg.

IF sy-subrc NE 0.

MESSAGE s000 WITH 'Error in opening file for output'.

LEAVE LIST-PROCESSING.

ENDIF.

LOOP AT ihtml .

TRANSFER ihtml TO '/sapio/outbound/html.txt'.

ENDLOOP.

  • Closing the file

CLOSE DATASET '/sapio/outbound/html.txt'.

IF sy-subrc NE 0.

MESSAGE s000 with 'Error in closing file'.

LEAVE LIST-PROCESSING.

ENDIF.

Since you want to download in background,you cannot download in presentation server.SO you have to download in application server.

Kindly reward points if it helps.

Message was edited by: Jayanthi Jayaraman

Former Member
0 Kudos

HI,

Use

OPEN DATASET FOR OUPUT

&

CLOSE DATASET



here is the sample code for the same

OPEN DATASET P_PATH FOR OUTPUT IN TEXT MODE.



IF SY-SUBRC <> 0.
MESSAGE E039(ZK) WITH
'ƒ_ƒEƒ“ƒ[ƒh‚ŃGƒ‰[‚ª”­¶‚µ‚Ü‚µ‚½B'.
ENDIF.

LOOP AT PR_TBL.


PERFORM ZYIR070_TRANSFER_DATASET USING 'C'
P_PATH
PR_TBL SY-INDEX.

ENDLOOP.



CLOSE DATASET P_PATH.

Regards,

Santosh

Message was edited by: Santosh Kumar Patha