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

FM or Program to process multiple *.ccd files

Former Member
0 Likes
1,413

Hi All ...

Is there any Function Module or program to Pick multiple *.ccd files from a folder and process them in to SAP ECC ???

Thanks in advance ...

Regards ,

Sijin K P.

Edited by: SIJIN K P on Jul 27, 2011 1:34 PM

1 ACCEPTED SOLUTION
Read only

former_member209703
Active Contributor
0 Likes
1,356

Use this static method:

CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG

Regards

11 REPLIES 11
Read only

former_member209703
Active Contributor
0 Likes
1,357

Use this static method:

CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG

Regards

Read only

0 Likes
1,356

In case you need to filter the Directory files by a given extension, you can use the following method:

CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES

Read only

0 Likes
1,356

Hi Jose ,

Thanks for your reply ..

My requirement is to create one report and this will run in background and it should pick multiple files from the given folder and process it to SAP . But here if i use the above method how it is possible to make the file selection automatically ..ie if suppose 5 files are there in the folder it should pick five files and process all of them. ..

Regards ,

Sijin K P.

Read only

0 Likes
1,356

Then you can use this method: CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES, specifying the directory path in which the files are located, as well as the filtering criteria, and once you have the internal table with all the files you have to upload, then call GUI_UPLOAD, as many times as you need.

Read only

0 Likes
1,356

You cannot access files on the presentation server in the background mode.

Read only

0 Likes
1,356

Hi Jose ,

Will this metthod work for Files in application server ..??

Regards,

Sijin KP.

Read only

0 Likes
1,356

Use FM EPS2_GET_DIRECTORY_LISTING to the list of files on Application server directory. This FM works great in both foreground and background.

Read only

0 Likes
1,356

Hi rumhat ,

Thanks for your reply ..

Tested this FM . But i am not able to read multiple file name using this . Please correct me if i am wrong ..

CALL FUNCTION 'EPS2_GET_DIRECTORY_LISTING'

EXPORTING

iv_dir_name = '/usr/sap/ED5/DVEBMGS00/work'

*

FILE_MASK = '*.txt'

IMPORTING

DIR_NAME = lv_dir

    • FILE_COUNTER =

    • ERROR_COUNTER =

tables

dir_list = lit_table.

    • EXCEPTIONS

    • INVALID_EPS_SUBDIR = 1

    • SAPGPARAM_FAILED = 2

    • BUILD_DIRECTORY_FAILED = 3

    • NO_AUTHORIZATION = 4

    • READ_DIRECTORY_FAILED = 5

    • TOO_MANY_READ_ERRORS = 6

    • EMPTY_DIRECTORY_LIST = 7

    • OTHERS = 8

  • .

  • IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

There are multile .txt files in ' usr/sap/ED5/DVEBMGS00/work' directory . But in lit_table contains only one entry ie last file .

Regards ,

Sijin K P.

Read only

0 Likes
1,356

Pass value '.' to parameter filemask to get all the available files in the application server directory and then process the necessary files.

Cheers,

Rupesh

Edited by: rumhat on Jul 28, 2011 8:09 AM

Read only

0 Likes
1,356

Hi Rupesh ,

Thanks for reply...

Is there any keyword to filter respective file extension ( .txt , .ccd etc ) from table or do we need to loop the table and check each records ..??

Is there any FM to upload a file in to an archive folder in application server .

I have to move the file to archive folder after the competition of file process.

Regards ,

Sijin KP

Read only

0 Likes
1,356

I did it by looping through the internal table and filtering files accordingly.

As far as moving files across application server is considered, you can do it by using external system command(SM69).

For Host OS -

1. UNIX - Use command "mv" (works great in both foreground & background mode)

2. Windows - Use command "move" (not sure if it works in background mode)

An alternate way is to use Dataset handling technique -

1. OPEN DATASET

2. READ DATASET

3. TRANSFER to dest_file

4. DELETE source_file

I know this is cumbersome, but it surely does works.

Cheers,

Rupesh