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

Module Pool: Search Help for Local File

Former Member
0 Likes
4,906

Hi All,

It's been ages since I develop module pool.

I have 3 events: PBO, PAI, and POV.

On my POV, I build the logic for the search help of the file, however after I select the file path, the file path is not being copied back to the input parameter for the file path.

How do I pass it back again to the parameter of the file?

I have screen 9001 below.

PROCESS BEFORE OUTPUT.
   MODULE d9001_status.

PROCESS AFTER INPUT.
   MODULE d9001_cancel AT EXIT-COMMAND.
   MODULE d9001_user_command.

PROCESS ON VALUE-REQUEST.
   FIELD io_file  MODULE d9001_value_filepath.


module d9001_STATUS output.
   DATA: lt_fcode  TYPE STANDARD TABLE OF sy-ucomm.
   DATA: lwa_fcode TYPE sy-ucomm.

   CLEAR: lwa_fcode.
   FREE : lt_fcode.

   lwa_fcode = 'EXEC'.
   APPEND lwa_fcode TO lt_fcode.

   SET PF-STATUS 'QUOTE' EXCLUDING lt_fcode.
   SET TITLEBAR 'Upload Prior Quotation'.

   SET PARAMETER ID 'FIL' FIELD space.
endmodule.                 " STATUS_9001  OUTPUT



MODULE d9001_value_filepath INPUT.
   DATA: lv_title      TYPE string,
         lt_filetable  TYPE filetable,
         lv_rc         TYPE i,
         lv_file(200)   TYPE c.
   DATA: lwa_filetable LIKE LINE OF lt_filetable.

   CALL METHOD cl_gui_frontend_services=>file_open_dialog
     EXPORTING
       window_title            = lv_title
     CHANGING
       file_table              = lt_filetable
       rc                      = lv_rc
     EXCEPTIONS
       file_open_dialog_failed = 1
       cntl_error              = 2
       error_no_gui            = 3
       not_supported_by_gui    = 4
       OTHERS                  = 5.
   IF sy-subrc = 0.
     READ TABLE lt_filetable INTO lwa_filetable INDEX 1.
     IF sy-subrc EQ 0.
       lv_file  = lwa_filetable-filename.
       SET PARAMETER ID 'FIL' FIELD lv_file.
       IF sy-subrc EQ 0.

       ENDIF.
     ENDIF.
   ENDIF.

ENDMODULE.                 " VALUE_FILEPATH  INPUT

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,672

Hi Jun,

Use F4_FILENAME function module in PROCESS ON VALUE REQUEST event.

Pass file name value to the screen field to get displayed.

Hi All,

It's been ages since I develop module pool.

I have 3 events: PBO, PAI, and POV.

On my POV, I build the logic for the search help of the file, however after I select the file path, the file path is not being copied back to the input parameter for the file path.

How do I pass it back again to the parameter of the file?

I have screen 9001 below.

PROCESS BEFORE OUTPUT.
   MODULE d9001_status.

PROCESS AFTER INPUT.
   MODULE d9001_cancel AT EXIT-COMMAND.
   MODULE d9001_user_command.

PROCESS ON VALUE-REQUEST.
   FIELD io_file  MODULE d9001_value_filepath.


module d9001_STATUS output.
   DATA: lt_fcode  TYPE STANDARD TABLE OF sy-ucomm.
   DATA: lwa_fcode TYPE sy-ucomm.

   CLEAR: lwa_fcode.
   FREE : lt_fcode.

   lwa_fcode = 'EXEC'.
   APPEND lwa_fcode TO lt_fcode.

   SET PF-STATUS 'QUOTE' EXCLUDING lt_fcode.
   SET TITLEBAR 'Upload Prior Quotation'.

   SET PARAMETER ID 'FIL' FIELD space.
endmodule.                 " STATUS_9001  OUTPUT



MODULE d9001_value_filepath INPUT.
   DATA: lv_title      TYPE string,
         lt_filetable  TYPE filetable,
         lv_rc         TYPE i,
         lv_file(200)   TYPE c.
   DATA: lwa_filetable LIKE LINE OF lt_filetable.

   CALL METHOD cl_gui_frontend_services=>file_open_dialog
     EXPORTING
       window_title            = lv_title
     CHANGING
       file_table              = lt_filetable
       rc                      = lv_rc
     EXCEPTIONS
       file_open_dialog_failed = 1
       cntl_error              = 2
       error_no_gui            = 3
       not_supported_by_gui    = 4
       OTHERS                  = 5.
   IF sy-subrc = 0.
     READ TABLE lt_filetable INTO lwa_filetable INDEX 1.
     IF sy-subrc EQ 0.
       lv_file  = lwa_filetable-filename.
       SET PARAMETER ID 'FIL' FIELD lv_file.
       IF sy-subrc EQ 0.

       ENDIF.
     ENDIF.
   ENDIF.

ENDMODULE.                 " VALUE_FILEPATH  INPUT

6 REPLIES 6
Read only

Former Member
0 Likes
2,673

Hi Jun,

Use F4_FILENAME function module in PROCESS ON VALUE REQUEST event.

Pass file name value to the screen field to get displayed.

Read only

0 Likes
2,672

Hi Shravan,

I tried your approach, but still the same:

PROCESS BEFORE OUTPUT.
   MODULE d9001_status.

PROCESS AFTER INPUT.
*  MODULE d9001_cancel AT EXIT-COMMAND.
*  MODULE d9001_user_command.

PROCESS ON VALUE-REQUEST.
   FIELD io_file  MODULE d9001_value_filepath.


module d9001_STATUS output.
   DATA: lt_fcode  TYPE STANDARD TABLE OF sy-ucomm.
   DATA: lwa_fcode TYPE sy-ucomm.

   CLEAR: lwa_fcode.
   FREE : lt_fcode.

   lwa_fcode = 'EXEC'.
   APPEND lwa_fcode TO lt_fcode.

   SET PF-STATUS 'MAIN' EXCLUDING lt_fcode.

endmodule.                 " STATUS_9001  OUTPUT


MODULE d9001_value_filepath INPUT.
   DATA: lv_filename   TYPE IBIPPARMS-PATH.

   CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      PROGRAM_NAME        = SYST-CPROG
      DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = 'IO_FILE'
    IMPORTING
      FILE_NAME           = lv_filename.
   IF sy-subrc EQ 0.

   ENDIF.

ENDMODULE.                 " VALUE_FILEPATH  INPUT


Read only

0 Likes
2,672

Hi All,

thanks, false alarm , solved.

Added data declaration for the input parameter itself with the same name as in my screen painter.

MODULE d9001_value_filepath INPUT.
   DATA: lv_filename   TYPE IBIPPARMS-PATH.
   DATA: io_file(150) TYPE c.
   CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      PROGRAM_NAME        = SYST-CPROG
      DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = 'IO_FILE'
    IMPORTING
      FILE_NAME           = lv_filename.
   IF sy-subrc EQ 0.
     io_file = lv_filename.
   ENDIF.

ENDMODULE.                 " VALUE_FILEPATH  INPUT

Read only

0 Likes
2,672

Hi Jun,

You can use FM DYNP_VALUES_UPDATE to update dynpro field value.

Regards,

Mordhwaj

Read only

Former Member
0 Likes
2,672

Remove the instruction

"SET PARAMETER ID 'FIL' FIELD space"

Cheers!

Abhinab

Read only

Former Member
0 Likes
2,672

Hello

    Try to set file name to screen file io_file by 'io_file = lv_file' instead of  'SET PARAMETER ID 'FIL' FIELD lv_file'

       Or you can use Function module DYNP_VALUES_UPDATE in order to set file name to sreen field io_file.

      BTW, SET PARAMETER ID 'FIL' FIELD lv_file', it don't work in POV.

BR

Vinh VO