‎2008 Jun 27 5:31 AM
I have written the code for application server file path validation.
DATA : l_fname TYPE filename-fileintern." type c.
DATA : l_filpath TYPE filename-fileintern,
l_filname(40) TYPE c.
PARAMETER : p_sucfil LIKE rfpdo-rfbifile OBLIGATORY. " rlgrap-filename
AT SELECTION-SCREEN ON p_sucfil.
l_fname = p_sucfil.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
CLIENT = SY-MANDT
logical_filename = l_fname
OPERATING_SYSTEM = SY-OPSYS
PARAMETER_1 = ' '
PARAMETER_2 = ' '
PARAMETER_3 = ' '
USE_PRESENTATION_SERVER = ' '
WITH_FILE_EXTENSION = 'X'
USE_BUFFER = ' '
ELEMINATE_BLANKS = 'X'
IMPORTING
EMERGENCY_FLAG =
FILE_FORMAT =
FILE_NAME = l_filpath
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2
.
IF sy-subrc <> 0.
message 'Invalid file name' type 'E'.
ENDIF.
But always i will get Invalid file name.
Y is it so.
pls help me.
‎2008 Jun 27 5:41 AM
Hi,
Is a file with that name present on the address you are passing to
CALL FUNCTION 'FILE_GET_NAME'
Regards,
Nikhil
Edited by: Nikhil A Chitre on Jun 27, 2008 2:41 PM
‎2008 Jun 27 5:43 AM
Hi Nikil,
Yes, the fileptha i am passing is present on applicatin server
‎2008 Jun 27 5:49 AM
well Pointed out by Chandra Shekar.
you seem to be checking If Sy-Subrc = 0.
for message display.
Check your code.
Regards,
Nikhil
‎2008 Jun 27 5:54 AM
Hi Nikhil,
I am checking for
sy-subrc <> 0.
FM return sy-subrc eq 1.
I does not know y.
File path is correct and file exist on application server
‎2008 Jun 27 5:55 AM
‎2008 Jun 27 5:57 AM
‎2008 Jun 27 5:58 AM
Hi Praveen,
I could not get you. What do you mean by SY-SUBRC 0. Is it EQ to zero of NE 0.
Make sure that it is either EQ or NE. Here it must be NE, as per your code.
If it is SY-SUBRC NE 0, it does not give the message.
Let me know, what happened.
Hope this helps you.
Any queries, get back to me.
Regards,
Chandra Sekhar
Edited by: Chandrasekhar Gandla on Jun 27, 2008 6:59 AM
‎2008 Jun 27 5:45 AM
Hi Praveen,
Check condition for issuing the message.
If it IF SY-SUBRC EQ 0, change it to IF SY-SUBRC NE 0.
That means you are issuing error message when it is successful.
If thats not the issue, let me know.
Hope this helps you. Reward points if satisfied.
Any queries, get back to me.
Regards,
Chandra Sekhar
Edited by: Chandrasekhar Gandla on Jun 27, 2008 6:46 AM
‎2008 Jun 27 5:48 AM
‎2008 Jun 27 6:00 AM
FM FILE_GET_NAME Assigns the Physical File Name Using a Logical File Name. And mapping between Logical File Name and Physical File Name is maintained in transaction FILE.May be the logical file name u r giving as input against it no Physical File is not maintained in tran. FILE. Pl. check.
Regards,
Joy.
‎2008 Jun 27 6:12 AM
Hi Chandrashekar / Joyjit,
Sy-SUBRC NE 0.
Joyjit,
I checked in FILE Tcode.
Logical file name in thei tcode TMP is also maintained.
still ia m agetting this error.
One more thing, if file doesn't exists. i may give us error right.
What can we do for this.
‎2008 Jun 27 6:26 AM
Hi Praveen,
First thing is application server file is case sensitive. So declare ur selection screen parameter with Addition LOWER CASE.
PARAMETER : p_sucfil LIKE rfpdo-rfbifile OBLIGATORY LOWER CASE.
Second use FM PFL_CHECK_OS_FILE_EXISTENCE which perfectly working fine for application server file validation. Here also file name is case sensitive. Check this FM in SE37 by giving ur file name and check the check box Lower case. Revert if it is not clear.
Thanks,
Vinod.
‎2008 Jun 27 6:26 AM
So u mean to say in File tran. TMP is ur logical file name and /tmp/zptest01.txt is ur physical file name..right?
And as input u r giving TMP but u r getting error from FM FILE_GET_NAME.
Pl. confirm.
Regards,
Joy.
‎2008 Jun 27 7:08 AM
Hi Vinod,
This Fm PFL_CHECK_OS_FILE_EXISTENCE is working fine.
You mean to say that when user provides file path on selection screen. File should be present already in the path that user provided on selection screen.
and Chandrashekar,
In import
FILE_NAME = l_fname.
Still i am getting error.
‎2008 Jun 27 7:31 AM
Praveen,
I have checked ur code and I found that if i give a logical file name from
tran. FILE under folder 'Logical file name definition, cross client' then ur code works. Pl. check.
Regards,
Joy.
DATA : l_fname TYPE filename-fileintern." type c.
DATA : l_filpath TYPE filename-fileintern,
l_filname(40) TYPE c.
PARAMETER : p_sucfil LIKE rfpdo-rfbifile OBLIGATORY. " rlgrap-filename
AT SELECTION-SCREEN ON p_sucfil.
l_fname = p_sucfil.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
logical_filename = l_fname
operating_system = sy-opsys
with_file_extension = 'X'
IMPORTING
file_name = l_filpath
EXCEPTIONS
file_not_found = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE 'Invalid file name' TYPE 'E'.
ENDIF.
‎2008 Jun 27 7:36 AM
Hi Joyjit,
If logical file path doesnot exists in FILE tcode,
then i need to create that.
its long process to get created.
I am using now Open dataset for the same.
‎2008 Jun 27 7:55 AM
Hi Praveen,
Yes u r exactly right. That is the purpose of doing validation right???.
Do it like this.
AT SELECTION-SCREEN ON p_...
Call the FM i mentioned.
If the return flag IS INITIAL then raise an error message saying file does not exist. Also u can provide search help for file as mentioned by others in the event
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_...
Hope this is clear now.
Thanks,
Vinod.
‎2008 Jun 27 8:13 AM
Hi Vinod,
This sounds to be good.
Thnkx for the needful help.
Again I am having one more problem.
I have written program to send emails using SO_DOCUMENT_SEND_API1.
and after this I am submitting email sending initial program
SUBMIT rsconn1.
But if there is any error in sending a mail to email address i am getting Dilaog box. It should not appear for me.
another thing. How to take the status of emails sent to users.
And display the status for each user.
‎2008 Jun 27 10:52 AM
Hi Praveen,
What dialog box u r getting? Is it some other program or related to ur current post? Did u uncommented exceptions of the Mail sending FM? Also the report name is RSCONN01.
Submit this report only if sy-subrc of mail sending FM is zero.
Status of the mails u can check in transaction SOST and table SOOS.
SOOS table will be updated accordingly like recieved date and time etc.
Thanks,
Vinod.
‎2008 Jun 27 2:39 PM
Hi Venkat,
If I am also doing th same as u told.
But I am bit confused how to take the status of each email sent to the user.
I have to capture all the errors if email is failed.
I am using SOES. to capture the status of each email sent.
But I am not getting proper messages.
Pls help me.
‎2008 Jun 27 6:39 AM
Hi Praveen,
Look at the FILE_NAME = l_filpath, you are passing in IMPORT parameters.
I think it must be ' l_fname' , in which you have the path.
Hope this helps you.
Any queries, get back to me.
Regards,
Chandra Sekhar
‎2008 Jun 27 7:05 AM
Hi ur problem can be a bit reduced using f4 help for the application server input path
Use the function module '/SAPDMC/LSM_F4_SERVER_FILE' for F4 help for
Application server files. you need to write this in the
AT SELECTION_SCREEN on FIELD REQUEST.
using this you will make sure the user enters a valid path..
‎2008 Jun 27 7:09 AM
FILE_GET_NAME - gives the physical path for the logical file NAME.
Go to transaction FILE. Click the LOGICAL FILE NAME DEFINITION, CROSS Client
Make sure you specify the file name and not the file path. If the file name does not exist, the function module will give error that file not found.
If you have complete physical file name then you may also validate it :
data: Dsn(200) value <Complete physical file name>.
Open dataset dsn for INPUT in binary mode.
if sy-subrc <> 0.
Error - file not found
else.
file Exists.
endif.
Reward if useful.