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

How can I execute program after using F4_Filename function?

Former Member
0 Likes
1,515

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.

1 ACCEPTED SOLUTION
Read only

Manohar2u
Active Contributor
0 Likes
1,219

Write start of selection after F4 FM.

Regds

Manohar

7 REPLIES 7
Read only

Manohar2u
Active Contributor
0 Likes
1,220

Write start of selection after F4 FM.

Regds

Manohar

Read only

Former Member
0 Likes
1,219

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

Read only

Former Member
0 Likes
1,219

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

Read only

Former Member
0 Likes
1,219

Hi arkadiusz,

1. simple

2.

<b>start-of-selection.</b>

f_name = p_file.

write:/ f_name.

regards,

amit m.

Read only

Former Member
0 Likes
1,219
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.
Read only

Former Member
0 Likes
1,219

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.

Read only

Former Member
0 Likes
1,219

Thanks all ! It's working now.

I didn't notice this line in the example