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

dynamic name Flat file reading.

Former Member
0 Likes
1,126

Hi all,

my client wants to schedule a BDC program for daily running.

But the file name is changed daily eventhough path is fixed.

can this be done.

can we read dynamic file from local system.

thanks in advance

Vikash.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,082

Hello,

Although the path remains the same and the filename changes, is there any common pattern in the name of the file?

for eg..

..../ abc_20090416.txt, etc

If the name of file is dynamic based on either the current date or current time, we can handle these dynamic files in our program. But if the name of the file changes altogther handling it wont be possible. think about some common pattern for filename.

Hope i am clear.

Regards,

Mansi.

Hi all,

my client wants to schedule a BDC program for daily running.

But the file name is changed daily eventhough path is fixed.

can this be done.

can we read dynamic file from local system.

thanks in advance

Vikash.

7 REPLIES 7
Read only

Former Member
0 Likes
1,083

Hello,

Although the path remains the same and the filename changes, is there any common pattern in the name of the file?

for eg..

..../ abc_20090416.txt, etc

If the name of file is dynamic based on either the current date or current time, we can handle these dynamic files in our program. But if the name of the file changes altogther handling it wont be possible. think about some common pattern for filename.

Hope i am clear.

Regards,

Mansi.

Read only

0 Likes
1,082

Hi ,

yes the file has the name pattern "SAP Forex Upload_10042009.xls" the dates will keep on changing..

with warm regards.

vikash

Read only

0 Likes
1,082

yes. so u can at initialissation for the paramter which takes the filepath name you can set to synamic filename as below


data : p_filename  type RSVAR-FILEPATH.
initialization.

concatenate '/....SAP Forex Upload_' sy-datum+06(02) sy-datum+04(02) sy-datum+00(04) into p_filename.

Read only

Former Member
0 Likes
1,082

Hi Vikas,

It can be done, just make some rule for the file name, like filename will be always the system date,

so as u know the path just u need to concatenate the system date with the file path and u can pass to the gui_upload FM to upload the file for the BDC.

Hope u get my point.

Amresh.

Read only

0 Likes
1,082

Hi Amresh,

Can u elaborate the solution.

the excel file is having a fixed pattern name that is "ddmmyyyy.xls"

what i need to concatenate .

currently i have put file path as parameter.

can u give me any sample code so that it ll be easy for me to understand.

Thanks in advance

Vikash

Read only

0 Likes
1,082

in the initialization event...

concatenate p_path sy-datum '.xls' into p_path.

and use this p_path in gui_upload or open dataset... to read the file...

or you can provide a p_date type d in the selection screen and concatenate p_path p_date '.xls' into p_path.

Read only

Former Member
0 Likes
1,082

hi,

yes it is possible, make sure that u r file name pattern and input file pattern should be same. in such a way that make the file name it is easy to handle.