on 03-11-2008 7:03 AM
Hi,
I have added a field called 'select from file' in selection screen by using
PARAMETERS: p_fname LIKE rlgrap-filename.
so thet the user can give the location of the text file,from which the data can be taken.
But in the selection screen I am not getting the f4 help for this field.What can I do If I want f4 help for this field.
Regards,
Hema
Hi
see this sample program it will ask for F4 help
&----
*& Report ZNNR_FM_LEAD
*&
&----
*&
*&
&----
REPORT ZNNR_FM_LEAD.
parameter: file_nm type localfile.
types : begin of it_tab1,
f1(20),
f2(40),
f3(20),
end of it_tab1.
data : it_tab type table of ALSMEX_TABLINE with header line,
file type rlgrap-filename.
data : it_tab2 type it_tab1 occurs 1,
wa_tab2 type it_tab1,
w_message(100) TYPE c.
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.
start-of-selection.
refresh it_tab2[].clear wa_tab2.
file = file_nm.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '10'
i_end_row = '35'
tables
intern = it_tab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 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.
loop at it_tab.
case it_tab-col.
when '002'.
wa_tab2-f1 = it_tab-value.
when '004'.
wa_tab2-f2 = it_tab-value.
when '008'.
wa_tab2-f3 = it_tab-value.
endcase.
at end of row.
append wa_tab2 to it_tab2.
clear wa_tab2.
endat.
endloop.
data : p_file TYPE rlgrap-filename value 'TEST3.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*--- Display error messages if any.
IF sy-subrc NE 0.
MESSAGE e001(zsd_mes).
EXIT.
ELSE.
*---Data is downloaded to the application server file path
LOOP AT it_tab2 INTO wa_tab2.
TRANSFER wa_tab2 TO p_file.
ENDLOOP.
ENDIF.
*--Close the Application server file (Mandatory).
CLOSE DATASET p_file.
loop at it_tab2 into wa_tab2.
write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
endloop.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this function
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME =
.
give ur file name in file_name ok
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
DATA: I_TAB TYPE STANDARD TABLE OF TY_ITAB WITH HEADER LINE.
DATA : GFILE(150).
DATA: G_FILE(150).
DATA: PATH(100).
DATA: DATE(8), DATE1(6).
DATA: RECORD TYPE STRING,
FILE TYPE STRING.
DATA: L_FILETAB TYPE FILETABLE,
L_FILETAB_H TYPE FILETABLE WITH HEADER LINE,
INITIAL_DIR_PATH TYPE STRING,
L_RC TYPE I.
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: FNAME TYPE LOCALFILE OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK B1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FNAME.
REFRESH L_FILETAB.
INITIAL_DIR_PATH = 'C:\'.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = 'Select the Asset Master Data file'
DEFAULT_EXTENSION =
DEFAULT_FILENAME =
FILE_FILTER = 'Text Files (.TXT)|.TXT|'
INITIAL_DIRECTORY = INITIAL_DIR_PATH
MULTISELECTION = SPACE
WITH_ENCODING =
CHANGING
FILE_TABLE = L_FILETAB
RC = L_RC
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
OTHERS = 5
.
IF SY-SUBRC <> 0.
WRITE:/ 'Error while selecting the input file'.
ELSE.
LOOP AT L_FILETAB INTO L_FILETAB_H.
FNAME = L_FILETAB_H-FILENAME.
EXIT.
ENDLOOP.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.