2020 May 20 1:02 PM
Hi,
I want my parameter to copy the value in the select option low. for example, I have a hidden parameter that will appear and replaced the select option if a certain radio button is ticked. If I input a single value in the select option before ticking the radio button, I want my parameter to have the same value as in the select option without re-entering it.
2020 May 20 1:13 PM
Hi catienza11
Below is the code for your requirement:
DATA:
gv_per TYPE i.
PARAMETERS: p_per TYPE i DEFAULT 5.
SELECT-OPTIONS: s_per FOR gv_per.
SELECTION-SCREEN SKIP.
PARAMETERS: p_chk TYPE flag USER-COMMAND chk.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name CS 'P_PER'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN 'CHK'.
CHECK p_chk = abap_true.
IF s_per[] IS INITIAL.
s_per-low = p_per.
APPEND s_per.
ELSE.
p_per = s_per[ 1 ]-low.
ENDIF.
WHEN OTHERS.
" do nothing.
ENDCASE.Your parameter's value will be update only if the user selects the checkbox.
Regards,
Mateusz
Hi,
I want my parameter to copy the value in the select option low. for example, I have a hidden parameter that will appear and replaced the select option if a certain radio button is ticked. If I input a single value in the select option before ticking the radio button, I want my parameter to have the same value as in the select option without re-entering it.
2020 May 20 1:13 PM
Hi catienza11
Below is the code for your requirement:
DATA:
gv_per TYPE i.
PARAMETERS: p_per TYPE i DEFAULT 5.
SELECT-OPTIONS: s_per FOR gv_per.
SELECTION-SCREEN SKIP.
PARAMETERS: p_chk TYPE flag USER-COMMAND chk.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name CS 'P_PER'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN 'CHK'.
CHECK p_chk = abap_true.
IF s_per[] IS INITIAL.
s_per-low = p_per.
APPEND s_per.
ELSE.
p_per = s_per[ 1 ]-low.
ENDIF.
WHEN OTHERS.
" do nothing.
ENDCASE.Your parameter's value will be update only if the user selects the checkbox.
Regards,
Mateusz
2020 May 20 2:46 PM
Hi Sir,
Good Day!
My program is if I tick the radio button the select option field will be hidden and the parameter will appear which I already did. now will this help that if I input a value in the select option and I tick the radio button the parameter will copy the value in the select option low field?
2020 May 20 2:51 PM
Hi Gerard,
Yes, it should work, because there is an event after the user selects the checkbox.
2020 May 21 1:31 PM
hi!
as per my understanding, it is copying the value of the parameter into the select option field. Is there any way can I do it the other way around? I will be just needing the first value or one value that the user enters in the select option field and copy it into the parameter field.
2020 May 21 1:37 PM
Hi
This part of the code copies the SELECT-OPTIONS LOW value to the PARAMETER field.
p_per = s_per[ 1 ]-low.
Regards,2020 May 27 12:03 PM
Hi Mateusz,
Good Day!
I want to add a warning message that if the user enters multiple plants it will prompt, where do I insert this code? I am glad that you were able to help me, I am fairly new to ABAP.
Regards,
Gerard.
2020 May 27 12:13 PM
Hello Gerard
I don't know what is the Plant parameter. But have a look at this.
IF lines( s_plant[] ) > 1.
" show error message
ENDIF.Kind regards,2020 Jul 20 9:18 AM
Hi Mateusz,
Good Day!
related to my last question, I want to know what logic should I add in the code above if the second select option field has values.

Thank you very much!
2020 Jul 20 9:29 AM
Hello Gerard A
It depends on the logic you want to have there. Do you know how the report should behave if the second select option field has values?
Kind regards,2020 Jul 20 9:34 AM
Hi Mateusz,
Good Day!
Same as before, it will display a system message.
Thank you!
2020 Jul 20 9:37 AM
IF s_plant-high IS NOT INITIAL.
" show error message
ENDIF.
2020 May 20 2:15 PM
catienza11,
Am afraid that this functionality can cause several other issues in your program, there is no harm in requesting the user to enter the value again.
How would you expect the program to behave when there are multiple values entered or range of values entered?
Not sure why this is needed!
Regards!