‎2006 Jun 08 1:03 PM
Hi all,
I'm a new user on the forum. I've been working with ABAP and SAP for a few weeks. I wrote a program for importing data from excel file to SAP using BDC. During searching this forum I found information about F4_Filename function which allows users to browse the disc for a file. I'd like to add this function to my program. I have a parameter for a file name but this is an ordinary static string field. When I added the code which I found in the message on this forum the rest of program doesn't execute.
This is simple program for example:
REPORT Z_TEST8_AB.
DATA f_name TYPE STRING.
PARAMETERS p_file like rlgrap-filename DEFAULT 'c:\test.xls'.
f_name = p_file.
write:/ f_name.
This program works correctly. There is a field for parameter. I can change the default name for a file.
After all, I can run the program (F8) and rest of the code is executed. The field for parameter dissapears from the screen and the file name is displayed. ( command write)
-
Now I added a function F4_Filename
REPORT Z_TEST8_AB.
DATA f_name TYPE STRING.
PARAMETERS p_file like rlgrap-filename DEFAULT 'c:\test.xls'.
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
program_name = syst-repid
dynpro_number = syst-dynnr
field_name = 'p_file'
importing
file_name = p_file.
f_name = p_file.
write:/ f_name.
I can browse a computer for a file now but after selecting the file I can't run the rest of the code. When I click on the icon or press key F8 the field for parameter doesn't dissapier and the command write is not executed.
What do I do wrong?
Could anyone suggest me a solution? How can I executed the code after using this function?
Thanks in advance.
Regards,
Arek.
‎2006 Jun 08 1:04 PM
‎2006 Jun 08 1:04 PM
‎2006 Jun 08 1:06 PM
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
program_name = syst-repid
dynpro_number = syst-dynnr
field_name = 'p_file'
importing
file_name = p_file.
<b>start-of-selection.</b>
f_name = p_file.
write:/ f_name.
Make the high lighted change.
Regards,
Ravi
‎2006 Jun 08 1:06 PM
Hi,
Since u have not written start-of-selection the whole code is considered under
at selection-screen on value-request for p_file.
write start-of-selection before write statement
Sreedhar
‎2006 Jun 08 1:07 PM
Hi arkadiusz,
1. simple
2.
<b>start-of-selection.</b>
f_name = p_file.
write:/ f_name.
regards,
amit m.
‎2006 Jun 08 1:08 PM
REPORT Z_TEST8_AB.
DATA f_name TYPE STRING.
PARAMETERS p_file like rlgrap-filename DEFAULT 'c:test.xls'.
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
program_name = syst-repid
dynpro_number = syst-dynnr
field_name = 'p_file'
importing
file_name = p_file.
start-of-selection.
f_name = p_file.
write:/ f_name.
‎2006 Jun 08 1:08 PM
Modified code :
REPORT Z_TEST8_AB.
DATA f_name TYPE STRING.
PARAMETERS p_file like rlgrap-filename DEFAULT 'c:test.xls'.
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
program_name = syst-repid
dynpro_number = syst-dynnr
field_name = 'p_file'
importing
file_name = p_file.
START-OF-SELECTION.
f_name = p_file.
write:/ f_name.
‎2006 Jun 08 1:15 PM
Thanks all ! It's working now.
I didn't notice this line in the example