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

screen program

Former Member
0 Likes
692

hello friends,

my scenario is, to create a button, and if the button is pressed, a browser should come so that i choose which file to attach.

i was trying to do a screen program , i did the following steps,

1)in se38

created a ztrial program as MODULE program ( should i choose executable),

2)in se51 created a screen 100 with this ztrial program name.

3)i put apush button in the screen , and in the attributes i put okcode for ok.

4)in PAI i called aprogram F4_filename .

now i tried to execute it , it was giving problem.

how should i use the okcode, in PAI

can some one help.

thank you.

1 ACCEPTED SOLUTION
Read only

suresh_datti
Active Contributor
0 Likes
657

Why do you need all that? try the following in your report..

parameters:
          p_file  like rlgrap-filename.  "file name
* get local file
at selection-screen on value-request for p_file.
  perform get_file.
*&---------------------------------------------------------------------*
*&      Form  get_file
*&---------------------------------------------------------------------*
*& Obtain the input file from the desktop if this option is selected
*&---------------------------------------------------------------------*
form get_file .
  data: t_filetable type filetable,
        w_filetable like file_table-filename,
        w_subrc     type i.
  constants: c_title type string value 'Choose File'.       "#EC NOTEXT
  call method cl_gui_frontend_services=>file_open_dialog
    exporting
      window_title            = c_title
    changing
      file_table              = t_filetable
      rc                      = w_subrc
    exceptions
      file_open_dialog_failed = 1
      cntl_error              = 2
      error_no_gui            = 3
      not_supported_by_gui    = 4
      others                  = 5.

  case sy-subrc.
    when 0.
      read table t_filetable index 1 into w_filetable.
      move w_filetable to p_file.
    when others.
      message e016(rp) with 'file not found'.
  endcase.
endform.                    " get_file

~Suresh

5 REPLIES 5
Read only

Former Member
0 Likes
657

try to use like this

PROCESS AFTER INPUT.

MODULE user_command_1100.

double click on user_command_100.

MODULE user_command_1100 INPUT.

case sy-ucomm.

when 'FCODE'.

do ur opreation

endcase.

endmodule.

Read only

suresh_datti
Active Contributor
0 Likes
658

Why do you need all that? try the following in your report..

parameters:
          p_file  like rlgrap-filename.  "file name
* get local file
at selection-screen on value-request for p_file.
  perform get_file.
*&---------------------------------------------------------------------*
*&      Form  get_file
*&---------------------------------------------------------------------*
*& Obtain the input file from the desktop if this option is selected
*&---------------------------------------------------------------------*
form get_file .
  data: t_filetable type filetable,
        w_filetable like file_table-filename,
        w_subrc     type i.
  constants: c_title type string value 'Choose File'.       "#EC NOTEXT
  call method cl_gui_frontend_services=>file_open_dialog
    exporting
      window_title            = c_title
    changing
      file_table              = t_filetable
      rc                      = w_subrc
    exceptions
      file_open_dialog_failed = 1
      cntl_error              = 2
      error_no_gui            = 3
      not_supported_by_gui    = 4
      others                  = 5.

  case sy-subrc.
    when 0.
      read table t_filetable index 1 into w_filetable.
      move w_filetable to p_file.
    when others.
      message e016(rp) with 'file not found'.
  endcase.
endform.                    " get_file

~Suresh

Read only

Former Member
0 Likes
657

HI saritha

Program type shoule be module pool. So its should be type of M.

Create a screens. In module, create Set pf-status '1000'. Create some buttons.

Assign some function code for each buttons.

Move sy-ucomm value to Ok_code.

then u can trigger whteven u want by using CASE statement.

Ex.

Case ok_code

When '/nex'.

leave program.

when 'others'.

leave screen '1001'.

endcase.

need ur reward points

Regards

Ravi

Read only

Former Member
0 Likes
657

thanks sheshu and suresh,

but this is a bigger program, where in my part is to only place abutton on the already existing screen and write code, for the file to get attached if the button is pressed.

thanks again.

Read only

0 Likes
657

then using TCode SE41,add the button & function code to the pf-status of the screen you need to modify & then using SE51, put the above code in the PAI after checking for the function code..

~Suresh