FIle path in Screen Programming
Hi I am new to screen programming.
My program would pick a file from desktop and process it.
I am a bit confused how would I give the file path. Should it be a input/output field??
I want something like,
PARAMETERS: filename TYPE text255 OBLIGATORY.
ANy suggestions.
Ster.
Hi,
Try this code ..
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_FILE LIKE RLGRAP-FILENAME.
SELECTION-SCREEN: END OF BLOCK B1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
field_name = p_file
CHANGING
file_name = p_file.
DATA : lv_file TYPE string.
IF P_FILE IS NOT INITIAL.
lv_file = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
DAT_MODE = ' '
tables
data_tab = LT_ITAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
Regards,
Saran
Similar Messages
-
Assign Logical file name for the physical file path through Program
Hi all,
I am having a physical file which is getting generated dynamically. It is having the date and time stamp in its name which is added at runtime.
Now I need to assign a logical file name for the physical file path through the program.
Is there any FM or any other method to assign the same.
GauravI think it is not possible. becuase the date & time added at runtime. so if you check the table PATH you can find filename and their definitions
a® -
File path problem in background job spool
Hello ,
i have probelm in file path of the background job in spool.
i have selection screen
Radiobutton : p_local
parameter: path1.
Radibutton: p_applicatioserver
parameter: path2.
if i keep program in background job, it will alwas take second option.
Now user selected first option and executed job in abckground. File stored in the spplication server with corect file path name. (path2)
But when i go to sm37 entered job name and checked the spool, it gives me the file path name path1. but i need the file path1 in the background spool. my question whether i need to change the file path name in program or whether i have to change the setting
Regards,
zubFirst of all, local is not an option in background job; you can only save to the apps server, and your program should take that into consideration by checking for sy-batch = 'X', for example. You should be checking in your at selection-screen to be sure the user has not chosen local path and file and background job.
-
How to give dynamic file path in the selection screen
Hi All,
How to give dynamic file path f4 functionality to user on the selection so that he can browse for the path in the presentation serve? I believe there is one fun module is there for this purpose I am not getting that
Please help me in this regard.
Thanks&Regards
MaheshHI,
check this program.
<b>report ZWA_TEST2.
PARAMETERS: a(100) default 'PRESS F4'.
data: filet type table of FILE_TABLE.
data: wa type file_table.
data: count type i.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR a.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
CHANGING
FILE_TABLE = filet
RC = count .
loop at filet into wa.
a = wa-FILENAME.
endloop.</b>
Regards,
HRA -
How to give the application server file path in the module pool programming
Hi,
Could somebody help me how to provide the application server file path in module pool programming once the logo is uploaded to sap system.
For eg I have imported a logo name owens into sap system by using transaction se78; now I need to call the path in the below url,
if container2 is initial.
CREATE OBJECT CONTAINER2
EXPORTING
CONTAINER_NAME = 'PICTURE_CONTAINER2'.
CREATE OBJECT PICTURE2
EXPORTING
PARENT = CONTAINER2.
CALL METHOD PICTURE2->SET_DISPLAY_MODE
EXPORTING
DISPLAY_MODE = CL_GUI_PICTURE=>display_mode_fit_center
EXCEPTIONS
ERROR = 1.
CALL METHOD PICTURE2->LOAD_PICTURE_FROM_URL
EXPORTING
URL = " ? "
EXCEPTIONS
ERROR = 1
Others = 2.
endif.
Thanks in advance
Deepuhi Deepu,
Use FM '/SAPDMC/LSM_F4_FRONTEND_FILE' for fetching the data from the application server path/presentation server path
Regards,
Santosh -
File path error in same screen.
hey guys,
I want to check my file path validation and display error in same screen itself.
I used my GUI_UPLOAD method in START OF SELECTION. to read the file.
If error it displays error in some other plain screen.
I know AT selection screen will allow me to display in same screen.
But is the way of using GUI_UPLOAD method in AT selection screen is advisable?
or else please give me alternate way.
ambichanHi
You can use in AT Selection screen
data result.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_EXIST
EXPORTING
FILE = 'C:\test.txt'
RECEIVING
RESULT =
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
WRONG_PARAMETER = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
the return parameter will be "X" if file exists else it will be blank.
Cheers -
F4 help for file path in selection screen.
Hi there,
I defined one parameter p_path for file path using RLGRAP-FILENAME. I have not got F4 for this. How to solve this problem, can anybody pls help.
Regards,
Naseer.Hi,
refer to the following code:
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_pc.
DATA: it_tab TYPE filetable,
wf_subrc TYPE i.
DATA: wf_pcfile LIKE rlgrap-filename.
DATA: wf_filter TYPE string,
wf_dir TYPE string,
wf_title TYPE string,
wf_ext TYPE string.
* if p_ml = 'X'. "Manula Load - PC File
wf_title = text-012. "Window title
wf_ext = '.TXT'. "Extension of the file
wf_filter = 'Text Files (*.TXT)|*.TXT'. "File Type
wf_dir = wf_pcfile. "Directory
*Adds a GUI-Supported Feature
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = wf_title
default_extension = wf_ext
file_filter = wf_filter
initial_directory = wf_dir
CHANGING
file_table = it_tab
rc = wf_subrc.
Hope this helps.
<REMOVED BY MODERATOR>
Regards,
Sipra
Edited by: Alvaro Tejada Galindo on Jan 31, 2008 9:48 AM -
Physical file path on the selection screen from AL11 Tcode
Hi All,
Please let me know some body how do we give only physical file path(only directory not the file names) on the selection screen?I need to see when I press F4 only the physical file directories of the application server.
Thanks in advance.
MaheshHi,
This FM will be helpful.....
F4_dxfilename_toprecursion
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
* EXPORTING
* I_LOCATION_FLAG = ' '
* I_SERVER = '?'
* I_PATH =
* FILEMASK = '*.*'
* FILEOPERATION = 'R'
* IMPORTING
* O_LOCATION_FLAG =
* O_SERVER =
* O_PATH =
* ABEND_FLAG =
* EXCEPTIONS
* RFC_ERROR = 1
* ERROR_WITH_GUI = 2
* OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Mdi.Deeba Najam. -
Browse the File path selection in the selection screen
I want to give the user the option to browse his/her desktop and selct a file path and windows name by clicking on a drop down.
How do I do that?
Thank you in advancehi ,
there are so many function modules which will provide F4 Help for the path.
Suppose you have given a parameter name path.
You have to use these FMs in the event
AT SELECTION-SCREEN ON VALUE-REQUEST FOR path.
Example :
data : C_FNH_MASK TYPE DXFIELDS-FILEMASK VALUE '.',
SEARCH_DIR TYPE DXFIELDS-LONGPATH VALUE '/SAPGLOBAL/USERS',
FILE_PATH LIKE DXFIELDS-LONGPATH.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR path.
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
I_LOCATION_FLAG = 'P'
I_SERVER = ' '
I_PATH = SEARCH_DIR
FILEMASK = C_FNH_MASK
FILEOPERATION = 'R'
IMPORTING
O_PATH = PATH
EXCEPTIONS
RFC_ERROR = 1
OTHERS = 2.
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
I_LOCATION_FLAG = 'A'
I_SERVER = ' '
I_PATH = SEARCH_DIR
FILEMASK = C_FNH_MASK
FILEOPERATION = 'R'
IMPORTING
O_PATH = FILE_PATH
EXCEPTIONS
RFC_ERROR = 1
OTHERS = 2.
If you remove 'P' and put 'A', then it is used for application server F4 help.
you have F4_FILENAMEand F4_FILENAME_SERVER for presentation and application servers respectively
Reward points if helpful.
Thanks and Regards. -
XSD for the input file for GTS offline screening program
Hi Friends,
We are running some performance tests for our current project to evaluate how much time the offline screening program (report "/SAPSLL/SPL_OFFLINE_SCREENING") takes in GTS. This report expects the customers in an XML format - would you know where I can get the definition of this expected XML format (e.g. the XSD for this input file)?
Can some one help me to provide response XML definition of what GTS generates for the SPL check ?
Thanks,
Sudheer.Hi Sudheer,
please follwow the steps:
1. Prepare an XML file with Adress data
-> you can create a simple excel file that has to be converted into an
XML-file. See also the GTS documentation http://help.sap.
com/saphelp_gts72/helpdata/en/b1/8dc5c62c885046ab71fdcddc6ad2c2/frameset
.htm.
2. Upload the local file to GTS for SPL Screening
3. Examine the SPL screening results in GTS
4. Save the results in Audit trail and&or in local file
Best regards,
Christin -
C Programming: How can we get the filesystem name for a given file-path?
C Programming: How can we get the filesystem name for a given file-path?
Say I have a filepath=/mnt1/file1
Using some OS API like stat, can I get the Filesystem /mnt ?
Thanks in advance,
-VEnter the command up to the point of entering the file path and add a space, then drag the file into the terminal window. It will fill out the path.
If you need to go further into the contents of the Application package, you can continue with /Contents...
Another way is to start typing and then hit Tab to auto-complete. It will stop where it can't determine the next letter.
So, type /App tab and it will fill in /Applications. Type a / and start with the name of the app, then tab and it should complete. Continue till you have the correct path.
Spaces will be replaced with \<space>, so, App Store would end up as /Applications/App\ Store.app -
Create logical file path and read it in main program
Hello Experts,
My requirement is, I have to read files from application server.
File path/ Directory is different in different system (systid). i have to read all files starting with (xyz*) from mentioned directory.
This path i must define in logical path.
Following are the steps i followed.
1) In FILE (TCODE) i have created a logical path and assigned a physical path to it.
2) I have created logical file ( I am not sure about this, as i dont have to create logical file, i just need to read file from above path starting with xyz*, but FM FILE_GET_NAME requires logical file name so i have created it).
3) I will pass logical file name to FM FILE_GET_NAME and recieve physical file path(with file name which i can ignore).
these all steps i found on SDN. but its not working.
FM FILE_GET_NAME is always returning same file path ( Not even close to what i have defined ).
I can not read data from Table path as it will return physical path as it is, but i need it replaced with system id.
Any suggestion will be really helpful.
Thanks in Advance.
Regards,
AmarHi Amar,
one difficulty defining physical path name is to know the right Syntax group.
For example if you habe OS Linux, you need Syntax Group UNIX here. In Table OPSYSTEM you can see, which OS (OPSYS) needs which FILESYS (Syntax Group).
If you always get a wrong physical path, this may be caused ba a wrong choice of the Syntax Group. Only the correct one will lead to the correct path.
Regards,
Klaus -
Difference between logical file path and physical file path
Hi,
Can anyone tell me why logical file path is required and why physical file path is required? What exactly is the difference bet them?
Thanks in advance.
Regards,
PS.Hi,
The function module FILE_GET_NAME convert a logical path into its corresponding physical path.
The advantage of using logical pathes within your applications is obivous:
If you need to change the physical path you just adjust it within transaction FILE yet no changes are required to your application.
http://help.sap.com/saphelp_erp2005vp/helpdata/en/25/ab3a57df3b11d189fc0000e829fbbd/frameset.htm
The file names that you use in ABAP statements for processing files are physical names. This means that they must be syntactically correct filenames for the operating system under which your R/3 System is running. Once you have created a file from an ABAP program with a particular name and path, you can find the same file using the same name and path at operating system level.
Since the naming conventions for files and paths differ from operating system to operating system, ABAP programs are only portable from one operating system to another if you use the tools described below.
To make programs portable, the R/3 System has a concept of logical filenames and paths. These are linked to physical files and paths. The links are created in special tables, which you can maintain according to your own requirements. In an ABAP program, you can then use the function module FILE_GET_NAME to generate a physical filename from a logical one.
Maintaining platform-independent filenames is part of Customizing. For a full description, choose Tools ® Business Engineer ® Customizing, followed by
Implement. projects ® SAP Reference IMG. On the next screen, choose Basis Components System Administration ® Platform-independent File Names.
For a more detailed description of the function module FILE_GET_NAME, enter its name on the initial screen of the Function Builder and choose Goto Documentation. On the next screen, choose Function module doc.
Another way of maintaining platform-independent filenames is to use the Transaction FILE. The following sections provide an overview of the transaction.
To create a logical filename, choose Logical filename definition, client-independent from the Navigation group box in Transaction FILE, then choose New entries. You define logical filenames
You can either define a logical filename and link it to a logical path (as displayed here), or you can enter the full physical filename in the Physical file field. In the latter case, the logical filename is only valid for one operating system. The rules for entering the complete physical filename are the same as for the definition of the physical path for the logical file. To display further information and a list of reserved words, choose Help.
If you link a logical path to a logical file, the logical file is valid for all syntax groups that have been maintained for that logical path. The filename specified under Physical file replaces the reserved word in the physical paths that are assigned to the logical path. To make the name independent of the operating system, use names that begin with a letter, contain up to 8 letters, and do not contain special characters.
Save your changes.
regards,
Omkar. -
Diff between logical and physical file path
Hi ,
Could you please explain difference between logical and physical file path's and their importance in ABAP.
Thanks and regards,
shylaHi
The function module FILE_GET_NAME convert a logical path into its corresponding physical path.
The advantage of using logical pathes within your applications is obivous:
If you need to change the physical path you just adjust it within transaction FILE yet no changes are required to your application.
http://help.sap.com/saphelp_erp2005vp/helpdata/en/25/ab3a57df3b11d189fc0000e829fbbd/frameset.htm
The file names that you use in ABAP statements for processing files are physical names. This means that they must be syntactically correct filenames for the operating system under which your R/3 System is running. Once you have created a file from an ABAP program with a particular name and path, you can find the same file using the same name and path at operating system level.
Since the naming conventions for files and paths differ from operating system to operating system, ABAP programs are only portable from one operating system to another if you use the tools described below.
To make programs portable, the R/3 System has a concept of logical filenames and paths. These are linked to physical files and paths. The links are created in special tables, which you can maintain according to your own requirements. In an ABAP program, you can then use the function module FILE_GET_NAME to generate a physical filename from a logical one.
Maintaining platform-independent filenames is part of Customizing. For a full description, choose Tools ® Business Engineer ® Customizing, followed by
Implement. projects ® SAP Reference IMG. On the next screen, choose Basis Components System Administration ® Platform-independent File Names.
For a more detailed description of the function module FILE_GET_NAME, enter its name on the initial screen of the Function Builder and choose Goto Documentation. On the next screen, choose Function module doc.
Another way of maintaining platform-independent filenames is to use the Transaction FILE. The following sections provide an overview of the transaction.
To create a logical filename, choose Logical filename definition, client-independent from the Navigation group box in Transaction FILE, then choose New entries. You define logical filenames
You can either define a logical filename and link it to a logical path (as displayed here), or you can enter the full physical filename in the Physical file field. In the latter case, the logical filename is only valid for one operating system. The rules for entering the complete physical filename are the same as for the definition of the physical path for the logical file. To display further information and a list of reserved words, choose Help.
If you link a logical path to a logical file, the logical file is valid for all syntax groups that have been maintained for that logical path. The filename specified under Physical file replaces the reserved word in the physical paths that are assigned to the logical path. To make the name independent of the operating system, use names that begin with a letter, contain up to 8 letters, and do not contain special characters.
Save your changes. -
Hi Gyes,
In selection screen i will enter <b>logical file path</b>.After executing this program i want <b>physical file path for that particular logical file path</b>(input).Is there any function module is there.
Thanks and regards,
Suresh.hello,
Use the function Module
Call function FILE_GET_NAME
CLIENT 200
LOGICAL_FILENAME <enter your logical file name>
OPERATING_SYSTEM WINDOWS NT
PARAMETER_1
PARAMETER_2
PARAMETER_3
USE_PRESENTATION_SERVER
WITH_FILE_EXTENSION
USE_BUFFER
ELEMINATE_BLANKS X
Reward points if helps.
Thanks,
Krishna
Maybe you are looking for
-
My imported music only appears in playlist and not my music library
Hello, I have recently reinstalled itunes on my PC. I am trying to import my music into itunes but it is appearing as a playlist and not in the music folder (i.e. I have 100's of playlists listed on the left playlist pane but nothing is appearing in
-
How to avoid The "mandatory error" during the AutoSubmit ?
Hi, I have an af:table with 5 columns. All of them have an inputText mandatory in it. Theses inputText have the property "autosubmit=true". An other component of the form has a partialTrigger on theses inputText. When i populate one inputText and cli
-
Requirement of keeping the Path field BLANK of HTTP_AAE Channel in NW PO 7.31
Hi , We are in a phase of migrating Interfaces from PI 7.1 to PO 7.31(Java Only). For one of the Interface in PI 7.1 there is a RFC Destination for vendor communication through HTTPS connectivity : Target-Host: IP Address Post: value Path Prefix: Bl
-
Error processing WSDL document
Hi All I'm trying to run a WebService deployed in JBoss. When i run the web service i get an error : javax.servlet.ServletException: Error processing WSDL document: java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhos
-
Red frames in Adobe Premiere after rendering
Hi! I have a big problem since some months. After rendering .MTS files out of my Canon Leghria HFS in Premiere CS6 there appear red frames from time to time. This is also an issue after exporting them in Adobe Media Encoder. I already contacted Adobe