2016 Aug 31 9:34 AM
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
2016 Aug 31 1:26 PM
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
2016 Aug 31 10:02 AM
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
2016 Aug 31 10:35 AM
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.
2016 Aug 31 11:03 AM
2016 Aug 31 10:59 AM
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!!
2016 Aug 31 11:17 AM
2016 Aug 31 11:55 AM
2016 Aug 31 12:02 PM
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.
2016 Aug 31 12:17 PM
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 .
2016 Aug 31 12:22 PM
Please check my whole program code above (replied to Raymond Giuseppi).
I have tried the same.
No luck.
2016 Aug 31 1:24 PM
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.
2016 Aug 31 1:48 PM
2016 Aug 31 11:01 AM
2016 Aug 31 1:26 PM
2016 Aug 31 1:30 PM
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!!
2016 Aug 31 1:38 PM
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
2016 Aug 31 1:44 PM
2016 Aug 31 3:08 PM
Hi,
P_NAME is the parameter on the screen whose value we are capturing.
thank you!!
2016 Aug 31 4:27 PM
Hi
Yes I know it.....but what does it mean?
I can suppose a file name?....anyway the problem is solved
2016 Sep 01 4:04 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |