Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

On help-request for

Former Member
0 Likes
946

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!

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
866

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!

6 REPLIES 6
Read only

Former Member
0 Likes
866

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

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
866

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

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
867

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

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
866

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

Read only

Former Member
0 Likes
866

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

Read only

Former Member
0 Likes
866

Hi,

If you want to get the File browsing option:

use ON VALUE-REQUEST

If want F1 help

Use ON HELP-REQUEST

- Selva