Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

uploading file to application server

rajeshkumar_kaveti
Participant
0 Likes
1,947

I need to upload a file to application server every 1 hour. And i have to automate this. How do i do it.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,812

Hi Rajesh,

Let us know where the source data is residing? Accordingly, we can give a solution.

All FMs which require user interaction like selecting a file etc..will not work in background...

Regards,

Raj

Hi Rajesh,

Let us know where the source data is residing? Accordingly, we can give a solution.

All FMs which require user interaction like selecting a file etc..will not work in background...

Regards,

Raj

15 REPLIES 15
Read only

hymavathi_oruganti
Active Contributor
0 Likes
1,812

1.if from front end of presentation server

not possible to schedule in background.

2. IF FROM INTERNAL TABLE

write a program,

use OPEN DATASET <DSET> FOR OUTPUT.

transfer DATASET <DEST>.

CLOSE DATASET <DESET>.

u can schedule the program in background in SA38/SE36

to run for every 1 hr.

Message was edited by: Hymavathi Oruganti

Read only

0 Likes
1,812

or use sm36

Read only

0 Likes
1,812

Hi ,

Use <b>SM36</b> to schedule a job..

gui_* will not work in background..

you can use only

open dataset

..

regards

satesh

Read only

Former Member
0 Likes
1,812

Hi Rajesh,

Try Program RC1TCG3Z.

Hope it helps...

Lokesh

pls. reward appropriate points

Message was edited by: Lokesh Aggarwal

Read only

Former Member
0 Likes
1,812
CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    FILENAME                      =  filnam
   FILETYPE                      = 'ASC'
   HAS_FIELD_SEPARATOR           = 'X'
  TABLES
    DATA_TAB                      = record
          .
open dataset dataset for output in text mode encoding DEFAULT.
loop at record.
transfer record to dataset.
endloop.
close dataset dataset.

Attach a transaction code to this program and you schedule this program to run every 1 hour with Basis...

<b>If you are to upload the file in Background mode GUI_* functions will not work.</b>Then you might have to think of other alternatives...

Regards,

Wenceslaus.

Read only

Former Member
0 Likes
1,812

Hi Rajesh,

If you mean uploading a file from a frontend to the application server using a job: it is not possible to do this, as there is no connection to your front end in the background.

The file must be in a location you have access to from the background (like a file server). You could use FTP then to copy the file to the application server.

Regards,

John.

Read only

Former Member
0 Likes
1,812

<b>data to Application server</b>

open dataset p_fleunx for output in text mode.

loop at fltab.

transfer fltab to p_fleunx.

endloop.

close dataset p_fleunx.

set the program in background to trigger every one hour

==================================

<b>To read data from App server.</b>

open dataset p_fleunx for input in text mode.

if sy-subrc ne 0.

write: / 'Process will be aborted.'.

exit.

endif.

  • Load internal table

do.

read dataset p_fleunx into fltab.

if sy-subrc ne 0.

exit.

endif.

append fltab.

enddo.

Read only

Former Member
0 Likes
1,812

Hi Rajesh,

U can Schedule your job to run in background for every one hour and u can use the dataset commands

OPEN <DataSetName>

and then looping through the internal table u can transfer the data from workarea to dataset using

TRANSFER <FName> to <DataSetName>

and close the dataset after the endloop using

CLOSE <DataSetName>.

Regards,

Phani

Read only

0 Likes
1,812

Thanks to all of you for responding with useful solutions

Here i observed 2 options.

1. using open dataset: In scheduling i canntot use GUI_* . So what is the alternative for me.

2. Using FTP: Please elobarate me on using FTP.

Read only

0 Likes
1,812

Hi,

For 2: Performing FTP Commands From ABAP

/people/thomas.jung3/blog/2004/11/15/performing-ftp-commands-from-abap

Best Regards,

Anjali

Read only

Former Member
0 Likes
1,812

Hi,

Try this piece of code.

CALL FUNCTION 'FILE_GET_NAME'
       EXPORTING
            LOGICAL_FILENAME = P_INFILE
       IMPORTING
            FILE_NAME        = INPUTFILE
       EXCEPTIONS
            FILE_NOT_FOUND   = 1
            OTHERS           = 2.
  IF SY-SUBRC NE 0.
    MESSAGE E899 WITH text-064 P_INFILE text-065.
  ENDIF.

* Open the inputfile for reading in text mode
  OPEN DATASET INPUTFILE FOR INPUT IN TEXT MODE.

  IF SY-SUBRC NE 0.
    MESSAGE E899 WITH text-066 INPUTFILE text-067.
  ENDIF.

  DO.
    READ DATASET INPUTFILE INTO TEXT2 . "LENGTH LENG.

    MOVE TEXT2 TO I_MATCONV.
    APPEND I_MATCONV.

    IF SY-SUBRC <> 0.
      EXIT.
    ENDIF.
  ENDDO.

  CLOSE DATASET INPUTFILE.

Regards,

Gayathri

Read only

Former Member
0 Likes
1,813

Hi Rajesh,

Let us know where the source data is residing? Accordingly, we can give a solution.

All FMs which require user interaction like selecting a file etc..will not work in background...

Regards,

Raj

Read only

0 Likes
1,812

Dear Rajasekhar,

source data is in front end in excel sheet.

Thanks

Read only

0 Likes
1,812

Hi Rajesh,

If the source file is in the front end, it wont help.

You need to upload the file to your application server using CG3Z or CG3Y.

Otherwise you can save the filename in your presentation server as a variant and then upload it.

See for reference.

Regards,

Wenceslaus.

Read only

Former Member
0 Likes
1,812

Hi Rajesh,

One way of handling this situation is,

1. Try getting the source data into a file on application server instead of frontend.

2. Use Open dataset, transfer and close dataset stmnts as suggested by all for your requirement.

Regards,

Raj