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

CALL 'C_DIR_READ_NEXT'

shrinivasan
Explorer
0 Likes
5,879

HI

I have 15 flat files and I uploaded into application layer inbox folder for processing the file.

I have maintained 15 file names in my Z program.

While reading this FM

CALL 'C_DIR_READ_START'
ID 'DIR' FIELD gv_path1
ID 'FILE' FIELD gv_fmask
ID 'ERRNO' FIELD file-errno
ID 'ERRMSG' FIELD file-errmsg.

*--Select files 1 by 1
CALL 'C_DIR_READ_NEXT'
ID 'TYPE' FIELD file-type
ID 'NAME' FIELD file-name
ID 'LEN' FIELD file-len
ID 'OWNER' FIELD file-owner
ID 'MTIME' FIELD file-mtime
ID 'MODE' FIELD file-mode
ID 'ERRNO' FIELD file-errno
ID 'ERRMSG' FIELD file-errmsg.

Ex: In my scenario

i have maintained 15 file names in select options but i uploaded only 10 files in the app layer(al11).

Here.FM CALL 'C_DIR_READ_NEXT' check the file name in sequence.if any file is not available then it will not be picking other available file in the sequence.

How to skip this error and load the available file in AL11 layer.

Thanks in advance.

Shrini

HI

I have 15 flat files and I uploaded into application layer inbox folder for processing the file.

I have maintained 15 file names in my Z program.

While reading this FM

CALL 'C_DIR_READ_START'
ID 'DIR' FIELD gv_path1
ID 'FILE' FIELD gv_fmask
ID 'ERRNO' FIELD file-errno
ID 'ERRMSG' FIELD file-errmsg.

*--Select files 1 by 1
CALL 'C_DIR_READ_NEXT'
ID 'TYPE' FIELD file-type
ID 'NAME' FIELD file-name
ID 'LEN' FIELD file-len
ID 'OWNER' FIELD file-owner
ID 'MTIME' FIELD file-mtime
ID 'MODE' FIELD file-mode
ID 'ERRNO' FIELD file-errno
ID 'ERRMSG' FIELD file-errmsg.

Ex: In my scenario

i have maintained 15 file names in select options but i uploaded only 10 files in the app layer(al11).

Here.FM CALL 'C_DIR_READ_NEXT' check the file name in sequence.if any file is not available then it will not be picking other available file in the sequence.

How to skip this error and load the available file in AL11 layer.

Thanks in advance.

Shrini

2 REPLIES 2
Read only

nabheetscn
SAP Champion
SAP Champion
3,261

Shrini one simple question if the files are available on application server AL11 why don't you use OPEN DATASET? Calling C functions is not the right approach. Any reason for using these special functions

Nabheet

Read only

0 Likes
3,259

Hi Shrini,

Look into FMs of Function Group EPSF.
I would suggest FM EPS_FTP_LS. With this FM you can read a folder and then build your logic with the return given.

Some hints:

  • If you use SM37 to tets take care of DIRECTORY parameter; it's case sensitive... test with a real program or change properly in debug more. SM37 will change to uppercase.
  • This FM allows you to use long file names, other FM can limit this to 40 or 75 chars and sometimes it's not enough.
  • It can be use for RFC conn., but in case you want a LOCAL run, just set RFC_DESTINATION = NONE.

Regards,
Alfonso.