‎2008 May 13 1:19 PM
Hi,
I'm trying to give a validation on the input file name which is given below.I dont want to hard code the path.when i'm giving F4 help it should pick only
' C.028 Project Plan balances_DMTHMPLAN ' file .if the file having different name is picked than it should give an error.
I'm trying to do this via this code.
Can anyone help me out.
IF P_FILE NP ' C.028 Project Plan balances_DMTHMPLAN' .
IF SY-FDPOS = 1.
MESSAGE E000 WITH TEXT-001 .
ENDIF.
ENDIF.
‎2008 May 13 1:21 PM
‎2008 May 13 1:21 PM
‎2008 May 13 1:23 PM
‎2008 May 13 1:24 PM
hi,
do this way ..
IF P_FILE NS ' C.028 Project Plan balances_DMTHMPLAN' .
MESSAGE E000 WITH TEXT-001 .
ENDIF.
‎2008 May 13 1:29 PM
Hi Dheeraj,
You can try using CS (Contains String) or CP (Contains Pattern ). But be specific , as it is case-sensitive.
Try using :
IF P_FILE CS ' C.028 Project Plan balances_DMTHMPLAN' .
or
IF P_FILE CP ' C.028 Project Plan balances_DMTHMPLAN' .
Choose the kind of syntax as per your requirement.
Hope this is helpful to you. If you need further information, revert
back.
Reward all the helpful answers.
Regards
Nagaraj T
‎2008 May 13 1:35 PM
HI,
use find keyword.
FIND 'C.028 Project Plan balances_DMTHMPLAN' in file.
IF subrc <> 0.
MESSAGE e000(zmsg_tab) with 'error'.
ENDIF.
rgds,
bharat.
‎2008 May 13 1:37 PM
Hi,
You can use this code with little bit modifications as of ur requirements.
PARAMETERS: P_FILE TYPE RLGRAP-FILENAME.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = P_FILE.
IF P_FILE NE 'C.028 Project Plan balances_DMTHMPLAN'.
MESSAGE i000(Z50871MSG) WITH 'error' .
ENDIF.
Regards
Sandeep Reddy
‎2008 May 13 3:16 PM