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

File access in Conversion Program

Former Member
0 Likes
665

Hi all,

I have a scenario where in i get access to a file from application server. This file is sent every 30 min to the application server from a Non-SAP server.

The further processing with that file is done in background which again happens every 15 min in SAP.

I have the following question:-

1. How do i make sure that all the contents of the file have been downloaded in the Application Server,before taking it for further processing.

Regards,

Neo.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
635

For processing the application server, i assume that some program is in place.

It must be opening the file for reading.

So, if the file is still not downloaded fully, the opening of the file would result in a sy-subrc <> 0.

So, you need to process only if sy-subrc = 0.

Regards,

Ravi

4 REPLIES 4
Read only

Former Member
0 Likes
636

For processing the application server, i assume that some program is in place.

It must be opening the file for reading.

So, if the file is still not downloaded fully, the opening of the file would result in a sy-subrc <> 0.

So, you need to process only if sy-subrc = 0.

Regards,

Ravi

Read only

0 Likes
635

Thanks for your reply.

I am using Open Dataset for opening of the file.

But are you sure that if the file is not downloaded fully. Open Dataset will result in sy-subrc <> 0.

Regards,

Neo.

Read only

0 Likes
635

The open dataset statement will be successful unless the external application has a way to prevent opening by SAP. In UNIX this can be done by only allowing read access to the file owner (chmod command). The external system could then open up the access once the download is complete.

Another option is to have the external system generate an empty file after creating the data file. The presence of this file would indicate to SAP that the data file is ready for loading.

Read only

Former Member
0 Likes
635

Hi,

use below logic

open dataset filein for input in text mode.

if sy-subrc eq 0.

DO.

READ DATASET FILEIN INTO ITAB.

IF SY-SUBRC NE 0.

EXIT.

ENDIF.

APPEND ITAB.

CLEAR ITAB.

ENDDO.

else.

message e000 'Error opening file'.

ENDIF.

Regards

amole