2011 Dec 20 1:42 PM
Hello,
My hierarchy is loaded through flat file. This file is present in the application server.
We have hard coded the filename path in our program in the production system as:
DATA:p_fname LIKE rlgrap-filename value '
A0001SAP\PACE_PRD\interface\BI\BO\PYD_PDL.CSV'
Now, our pre production system is refreshed and hence after the refresh, the same path got copied in the pre production system and our process chain got failed as the path name is wrong. Same is the case in the development system.
Please note: The file path is same in all the systems except the name of the system i.e.
For development system, the name is PACE_DEV
for preprodcution system, the name is PACE_PREPRD,
for production system, it is PACE_PRD.
Could anyone let us know, what global logic should be developed so that the process chain runs smoothly in all the systems?
Thanks in advance for the reply.
Regards,
Nitin Chopade.
2011 Dec 20 1:45 PM
2011 Dec 20 1:49 PM
Use the below code for the file path of your local matchine.
PARAMETER: file_nm TYPE localfile.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file_nm.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
static = 'X'
MASK = ' '
CHANGING
file_name = file_nm
EXCEPTIONS
mask_too_long = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
2011 Dec 20 2:33 PM
Hi,
+1 for Maen suggestion: Logical file path is the best way to "standardize" file accesses! Have a look to doc & transaction FILE...
The only FM you will then need is FILE_GET_NAME_USING_PATH...
Kr,
Manu.
2011 Dec 20 9:06 PM
Nitin Chopade,
Put the path /file name on the selection screen.
parameters: p_output(120).
Then use that selection-screen field in place of the hard coded value.
You can then change the path / file name at will.
or
Change the file '
A0001SAP\PACE_PRD\interface\BI\BO\PYD_PDL.CSV'
to '
A0001SAP\PACE_&SYSID&\interface\BI\BO\PYD_.CSV'
Assign the hard coded value to a variable, w_variable.
Before you use the file:
replace '&SYSID&' in w_variable with sy-sysid
Bruce
Edited by: Bruce Tjosvold on Dec 20, 2011 4:09 PM
2011 Dec 21 12:52 AM
Hi,
Depending on the setup, you may use radiobuttons to let the user choose between the 3 hardcoded paths. If the program is automated and you know how to determine what system is being used, you may use custom tables to maintain the hardcoded path that will be used by the program.
Regards,
Paul
2011 Dec 21 1:26 AM
Hi Nitin,
I'd suggest to use logical filename, which is platform independent.
Cheers
2011 Dec 21 1:48 AM
Hi,
I suggest you to use Logical File Path
FM: FILE_GET_NAME_USING_PATH
Chaminda