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

Pass Parameter value to event At Selection-Screen On Value-Request

Former Member
0 Likes
12,722

Requirement -  Need to capture parameter value from selection-screen .

                     Pass the value to method CALL METHOD cl_gui_frontend_services=>file_save_dialog ,

                     Which comes under event At Selection-Screen On Value-Request .

In below sample code , i want to pass p_name value to list .

Sample code -                     

                  

Data :   list TYPE string  'MYFILE'.

PARAMETERS : p_name(30),

p_file TYPE rlgrap-filename.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

                

CALL METHOD cl_gui_frontend_services=>file_save_dialog

     EXPORTING

       default_file_name         = list

*      with_encoding             =

*      file_filter               =

*      initial_directory         =

*      prompt_on_overwrite       = 'X'

     CHANGING

       filename                  = lv_file

       path                      = lv_path

       fullpath                  = lv_fullpath

*      user_action               =

*      file_encoding             =

*    EXCEPTIONS

*      cntl_error                = 1

*      error_no_gui              = 2

*      not_supported_by_gui      = 3

*      invalid_default_file_name = 4

*      others                    = 5

           .

   IF sy-subrc <> 0.

*   Implement suitable error handling here

   ENDIF.


Is it possible to capture the parameter value in event  AT SELECTION-SCREEN ON VALUE-REQUEST ?



Regards,

Prabin

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
9,715

Any input please.

Let me know for further info .

Requirement -  Need to capture parameter value from selection-screen .

                     Pass the value to method CALL METHOD cl_gui_frontend_services=>file_save_dialog ,

                     Which comes under event At Selection-Screen On Value-Request .

In below sample code , i want to pass p_name value to list .

Sample code -                     

                  

Data :   list TYPE string  'MYFILE'.

PARAMETERS : p_name(30),

p_file TYPE rlgrap-filename.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

                

CALL METHOD cl_gui_frontend_services=>file_save_dialog

     EXPORTING

       default_file_name         = list

*      with_encoding             =

*      file_filter               =

*      initial_directory         =

*      prompt_on_overwrite       = 'X'

     CHANGING

       filename                  = lv_file

       path                      = lv_path

       fullpath                  = lv_fullpath

*      user_action               =

*      file_encoding             =

*    EXCEPTIONS

*      cntl_error                = 1

*      error_no_gui              = 2

*      not_supported_by_gui      = 3

*      invalid_default_file_name = 4

*      others                    = 5

           .

   IF sy-subrc <> 0.

*   Implement suitable error handling here

   ENDIF.


Is it possible to capture the parameter value in event  AT SELECTION-SCREEN ON VALUE-REQUEST ?



Regards,

Prabin

19 REPLIES 19
Read only

Former Member
0 Likes
9,715

Use FM RS_REFRESH_FROM_SELECTOPTIONS.

Call function 'RS_REFRESH_FROM_SELECTOPTIONS'

exporting

  curr_Report = sy-repid

tables

selection_table = I_selections[].

Then read this table I_selections to get LOW field value to get parameter value.

Regards,

Kazmi

Read only

0 Likes
9,715

Hi Kazmi,

I am not able to capture parameter  p_name  value inside table  i_selection[].

Is it because  i am using it inside the event AT SELECTION-SCREEN ON VALUE-REQUEST?

sample code

PARAMETERS : p_name(30),

              p_file TYPE rlgrap-filename.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'

   EXPORTING

     curr_report               = prg_nam

* IMPORTING

*   SP                        =

   tables

     selection_table           = i_selection[]

*   SELECTION_TABLE_255       =

* EXCEPTIONS

*   NOT_FOUND                 = 1

*   NO_REPORT                 = 2

*   OTHERS                    = 3



           .


Kindly suggest .


Thanks.

Read only

9,715

Use this one.

Read only

Chintu6august
Contributor
0 Likes
9,715

Hi,

PARAMETERS : p_name(30),

                             p_file TYPE rlgrap-filename.

DATA :  t_field TYPE STANDARD TABLE OF DYNPREAD,

              s_field TYPE DYNPREAD.

s_field-FIELDNAME = 'P_NAME'.

APPEND s_field TO t_field.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy-repid

dynumb = sy-DYNNR

tables

dynpfields = t_read.

read table t_read into s_read WITH KEY fieldname = 'P_NAME'.

if sy-subrc is initial.

  p_file = s_read-fieldvalue.

endif.

thank you!!

Read only

0 Likes
9,715

Hi ,

Already tried , did't help me .

Thanks

Read only

0 Likes
9,715

You didn't pass any field name in T_FIELD, read FM documentation or at least exexute a where used search to find samples.

Read only

0 Likes
9,715

Hi,

pass the field name

PARAMETERS : p_name(30),

                             p_file TYPE rlgrap-filename.

DATA :  t_field TYPE STANDARD TABLE OF DYNPREAD,

              s_field TYPE DYNPREAD.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

s_field-FIELDNAME = 'P_NAME'.

APPEND s_field TO t_field.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy-repid

dynumb = sy-DYNNR

tables

dynpfields = t_read.

read table t_read into s_read WITH KEY fieldname = 'P_NAME'.

if sy-subrc is initial.

  p_file = s_read-fieldvalue.

endif.

Read only

0 Likes
9,715

This is the  program

PARAMETERS : p_name(30),

              p_file TYPE rlgrap-filename.

DATA t_field TYPE STANDARD TABLE OF DYNPREAD WITH HEADER LINE,

               s_field TYPE DYNPREAD ,

                p_val(20).

s_field-FIELDNAME = 'P_NAME'.

APPEND s_field TO t_field.

CLEAR s_field.

DATA : PRG_NAME TYPE D020S-PROG VALUE 'ZTEST_DYNFIELD',

        scr_name TYPE D020S-DNUM.

*START-OF-SELECTION.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

   scr_name = sy-dynnr .

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = PRG_NAME

dynumb = scr_name

tables

dynpfields = t_field[].

read table t_field into s_field WITH KEY fieldname = 'P_NAME'.

if sy-subrc is initial.

  p_val = s_field-fieldvalue.

endif.




This is the selection screen field



During debugging



   


Now kindly suggest .


Read only

0 Likes
9,715

Please check my whole program code above (replied to Raymond Giuseppi).

I have tried the same.

No luck.

Read only

0 Likes
9,715

Hi,


Remove header line from table declaration which is creating problem for you .


PARAMETERS : p_name(30),

               p_file TYPE rlgrap-filename.

DATA :  t_field TYPE STANDARD TABLE OF DYNPREAD,  "WITH HEADER LINE, <<comment

                s_field TYPE DYNPREAD ,

                 p_val(20).

DATA : PRG_NAME TYPE D020S-PROG VALUE 'ZDEMO12',

          scr_name TYPE D020S-DNUM.

*START-OF-SELECTION.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

s_field-FIELDNAME = 'P_NAME'.

APPEND s_field TO t_field.

CLEAR s_field.

    scr_name = sy-dynnr .

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = PRG_NAME

dynumb = scr_name

tables

dynpfields = t_field[].

read table t_field into s_field WITH KEY fieldname = 'P_NAME'.

if sy-subrc is initial.

   p_val = s_field-fieldvalue.

endif.

Read only

0 Likes
9,715

My previous answer doesn't change, you still don't fill  the dynpfields parameter (t_field varianle) before calling the FM, so no returned value to expect.


  dynpfields-fieldname = 'P_NAME'.

  append dynpfields.

Regards,

Raymond

Read only

RaymondGiuseppi
Active Contributor
0 Likes
9,715

Did you try FM like

  • RS_SELECTIONSCREEN_READ (and RS_SELECTIONSCREEN_UPDATE)
  • GET_DYNP_VALUE (and  SET_DYNP_VALUE)
  • DYNP_VALUES_READ (an DYNP_VALUES_UPDATE)

Regards,

Raymond

Read only

Former Member
0 Likes
9,716

Any input please.

Let me know for further info .

Read only

0 Likes
9,715

Hi,


Remove with header line statement from internal table declaration which is creating problem for you because the table with header line has work area (Implicit work area) with same name of internal table.


Either use implicit work area or remove WITH HEADER LINE statement


do this your code will work

thank you!!

Read only

0 Likes
9,715

Hi

What's P_NAME?

Anyway you need to append the parameter i/o field you need to check before calling the fm DYNP_VALUES_READ as Chintu adi said


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  prg_name = sy-repid.

  scr_name = sy-dynnr .

  s_field-fieldname = 'P_NAME'.

  APPEND s_field TO t_field.

CALL FUNCTION 'DYNP_VALUES_READ'

    EXPORTING

      dyname     = prg_name

      dynumb     = scr_name

    TABLES

      dynpfields = t_field[].

  READ TABLE t_field INTO s_field WITH KEY fieldname = 'P_NAME'.

  IF sy-subrc IS INITIAL.

    p_val = s_field-fieldvalue.

  ENDIF.

Max

Read only

0 Likes
9,715

Superb!!! . Did work for me .

Thank you All.

Read only

0 Likes
9,715

Hi,

P_NAME is the parameter on the screen whose value we are capturing.

thank you!!

Read only

0 Likes
9,715

Hi

Yes I know it.....but what does it mean?

I can suppose a file name?....anyway the problem is solved

Read only

0 Likes
9,715

Hi,

It can be of any type.

thanks!!