2006 Jun 16 9:17 PM
Hello, there
I have written the follwing segment of code:
AT SELECTION-SCREEN.
DATA: IT_PCFILES TYPE FILETABLE,
LV_RC TYPE I.
AT SELECTION-SCREEN ON HELP-REQUEST FOR P_PCPATH.
CALL METHOD CI_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
CHANGING
FILE_TABLE = IT_PCFILES
RC = LV_RC.
When I tried to compile it, it says:
Field "IT_PCFILES" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement. "DATA" statement.
However, if I remove the line:
AT SELECTION-SCREEN ON HELP-REQUEST FOR P_PCPATH.
Then the syntax check is fine.
May I know why is that so and how can I fix the code. Many thanks!
2006 Jun 16 9:21 PM
Here is a complete solution.
report zrich_0001 .
data: it_pcfiles type filetable,
wa_pcfiles like line of it_pcfiles,
lv_rc type i.
parameters: p_pcpath type localfile.
at selection-screen.
at selection-screen on value-request for p_pcpath.
call method cl_gui_frontend_services=>file_open_dialog
changing
file_table = it_pcfiles
rc = lv_rc.
read table it_pcfiles into wa_pcfiles index 1.
if sy-subrc = 0.
p_pcpath = wa_pcfiles-filename.
endif.
Regards,
Rich Heilman
Hello, there
I have written the follwing segment of code:
AT SELECTION-SCREEN.
DATA: IT_PCFILES TYPE FILETABLE,
LV_RC TYPE I.
AT SELECTION-SCREEN ON HELP-REQUEST FOR P_PCPATH.
CALL METHOD CI_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
CHANGING
FILE_TABLE = IT_PCFILES
RC = LV_RC.
When I tried to compile it, it says:
Field "IT_PCFILES" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement. "DATA" statement.
However, if I remove the line:
AT SELECTION-SCREEN ON HELP-REQUEST FOR P_PCPATH.
Then the syntax check is fine.
May I know why is that so and how can I fix the code. Many thanks!
2006 Jun 16 9:18 PM
hi Check this out
http://help.sap.com/saphelp_erp2005/helpdata/en/c5/aa575426ad11d2954d0000e8353423/frameset.htm
declare it in this way
AT SELECTION-SCREEN ON HELP-REQUEST.
The error could be because you might have declared P_PCPATH.
declare it and then use ...
<b>i.e, PARAMETERS: P_PCPATH TYPE STRING.
AT SELECTION-SCREEN ON HELP-REQUEST FOR P_PCPATH.</b>
Regards,
Santosh
2006 Jun 16 9:18 PM
By defining IT_PCFILES inside the AT SELECTION-SCREEN event, you are making them local to that event. Put that at the top of the program. Also use VALUE-REQUEST
<b>report zrich_0001.
DATA: IT_PCFILES TYPE FILETABLE,
LV_RC TYPE I.
parameters: p_pcpath type localfile.
AT SELECTION-SCREEN.</b>
AT SELECTION-SCREEN ON <b>VALUE-REQUEST</b> FOR P_PCPATH.
CALL METHOD <b>CL</b>_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
CHANGING
FILE_TABLE = IT_PCFILES
RC = LV_RC.Regards,
Rich Heilman
2006 Jun 16 9:21 PM
Here is a complete solution.
report zrich_0001 .
data: it_pcfiles type filetable,
wa_pcfiles like line of it_pcfiles,
lv_rc type i.
parameters: p_pcpath type localfile.
at selection-screen.
at selection-screen on value-request for p_pcpath.
call method cl_gui_frontend_services=>file_open_dialog
changing
file_table = it_pcfiles
rc = lv_rc.
read table it_pcfiles into wa_pcfiles index 1.
if sy-subrc = 0.
p_pcpath = wa_pcfiles-filename.
endif.
Regards,
Rich Heilman
2006 Jun 16 9:23 PM
You can also declare the IT_PCFILES table in that particular event.
report zrich_0001 .
parameters: p_pcpath type localfile.
at selection-screen.
at selection-screen on value-request for p_pcpath.
<b> data: it_pcfiles type filetable,
wa_pcfiles like line of it_pcfiles,
lv_rc type i.</b>
call method cl_gui_frontend_services=>file_open_dialog
changing
file_table = it_pcfiles
rc = lv_rc.
read table it_pcfiles into wa_pcfiles index 1.
if sy-subrc = 0.
p_pcpath = wa_pcfiles-filename.
endif.
Regards,
Rich Heilman
2006 Jun 16 9:56 PM
Hi Anyi Zhu,
Ur code.
AT SELECTION-SCREEN.
DATA: IT_PCFILES TYPE FILETABLE,
LV_RC TYPE I.
U r decalring the variable in the AT SELECTION-SCREEN event.
Thats what the error is Coming.
PUT the declaration part above the AT SELECTION-SCREEN Event.
like this.
DATA: IT_PCFILES TYPE FILETABLE,
LV_RC TYPE I.
AT SELECTION-SCREEN.
or delete the AT SELECTION-SCREEN event.
- Selvapandian Arunachalam
2006 Jun 16 10:00 PM
Hi,
If you want to get the File browsing option:
use ON VALUE-REQUEST
If want F1 help
Use ON HELP-REQUEST
- Selva
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |