Application Development 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: 

local file in background mode

Former Member
0 Kudos

Hi experts,

Is it possible to upload data from local drive(presentation server) to sap in background mode.

As I know ,in the background mode we can upload files from application server only.

but here my functional consultant saying they did upload data from local drive to sap in background mode.

please suggest.

thanks in advance.

sastry.

1 ACCEPTED SOLUTION

Former Member

hey,

Yes it can be made possible,

The only way to access files in a background job is to have them on the application server and opened via OPEN DATASET or similar.

*--Local Variables

DATA : l_file TYPE string,

l_line TYPE string,

l_index TYPE sy-tabix.

*--Clear

CLEAR : l_file.

l_file = p_ipfile.

*--Read the data from application server file.

OPEN DATASET l_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc NE 0.

*--Error in opening file

MESSAGE i368(00) WITH text-005.

ENDIF.

*--Get all the records from the specified location.

DO.

READ DATASET l_file INTO l_line.

IF sy-subrc NE 0.

EXIT.

ELSE.

SPLIT l_line AT cl_abap_char_utilities=>horizontal_tab

INTO st_ipfile-vbeln

st_ipfile-posnr

st_ipfile-edatu

st_ipfile-wmeng.

APPEND st_ipfile TO it_ipfile.

ENDIF.

ENDDO.

Regards,

Midhun Abraham

Edited by: Midhun Abraham on Oct 8, 2008 4:36 AM

14 REPLIES 14

Former Member

hey,

Yes it can be made possible,

The only way to access files in a background job is to have them on the application server and opened via OPEN DATASET or similar.

*--Local Variables

DATA : l_file TYPE string,

l_line TYPE string,

l_index TYPE sy-tabix.

*--Clear

CLEAR : l_file.

l_file = p_ipfile.

*--Read the data from application server file.

OPEN DATASET l_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc NE 0.

*--Error in opening file

MESSAGE i368(00) WITH text-005.

ENDIF.

*--Get all the records from the specified location.

DO.

READ DATASET l_file INTO l_line.

IF sy-subrc NE 0.

EXIT.

ELSE.

SPLIT l_line AT cl_abap_char_utilities=>horizontal_tab

INTO st_ipfile-vbeln

st_ipfile-posnr

st_ipfile-edatu

st_ipfile-wmeng.

APPEND st_ipfile TO it_ipfile.

ENDIF.

ENDDO.

Regards,

Midhun Abraham

Edited by: Midhun Abraham on Oct 8, 2008 4:36 AM

0 Kudos

Hi Midhun ,

Thanks for your reply,

I know that the files placed on application server can be accessed in back ground mode .,

but my question is ,is it possible to access files present in the local drives in the background mode?

please confirm.

sastry.

0 Kudos

0 Kudos

Hi Aparna,

Thankss for your reply.

I wanted to know is there any other way to accesss presentation server files in background mode .

0 Kudos

Hi

There is no way u can access files on presentation server or desktop using Background mode..

We tried for weeks, but it did not work.

So, storing it in the application server and then processing it is the only option.

Regards,

Vishwa.

0 Kudos

hi vishwa,

thanks for your response.

can you tell me how to store excel file on the application server.

sastry.

0 Kudos

Hi

Check Midhun's Answer..It is already there.

Regards,

Vishwa.

0 Kudos

Hi Aparna,

I got problems in creating rfc as mentioned in the document.

can you suggest the steps how to upload presentation server file in background .

sastry.

0 Kudos

Hi Sastry,

Were you able to find a solution to the same? I am at a point where the program needs to upload a file from the presentation server.

The only way by which I can achieve this is by transferring the fle from the presentation server to the application server and reading it from there.

However I am unable to proceed with the transfer of file from the presentation to the application server

I have tried using these two Function Modules. None of them seem to be working

ARCHIVFILE_CLIENT_TO_SERVER

FTP_SERVER_TO_R3

Any pointers towards how you achieved this would be helpful.

Thanks and Best Regards,

Puja.

0 Kudos

Hi,

You can only read the file from application server in background. There is no way to read the file from presentation or desktop in background.

Also, to read the excel file from application server, you can save it as CSV file and then while reading the file use SPLIT command to store in the internal table.

Finally, you can use FTP command to FTP from your desktop to application server only if there are proper connections and accesses.

There are standard programs, to read the file from desktop and transfer to application server and vice versa. You can use these programs only if you have proper access.

Once you have the access, you need to still run this program manually and then schedule the job to run the actual step.

Hope this helps.

Regards,

Bharati

0 Kudos

Hi,

Yes, You fix file path in code and place a flat file in same path and shedule it in background.

Regards

Md.MahaboobKhan

Former Member
0 Kudos

Hi,

In background there is no support to read the file from presentation server or desktop.in background u can read the files from application server only.

Note that if ur file is in XL format (on application server), you will have to save it as CSV file.

abdul_hakim
Active Contributor
0 Kudos

No it is not at all possible to read the files in presentation server in background mode.

Regards,

Hakim

Former Member
0 Kudos

Hi,

you can read the file from application server in background. There is no way to read the file from presentation or desktop in background.

and read the excel file from application server, you can save it as CSV file and then while reading the file use SPLIT command to store in the internal table.

Regards,

Madhu