Application Development 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: 

How to access selection screen input attributes through screen painter?

waleed_k99
Discoverer
0 Kudos
307

Hello everyone,

I am relatively new to ABAP programming, and I need some help with a certain requirement.

I currently have a task where I need to make select-options mandatory/optional based on which radio button is checked. Seeing as I cannot define select-options in screen painter, I decided to create a subscreen containing them, and inserting it into a subscreen area.

Unfortunately, I cannot figure out a way to change the 'required' attribute for the select-options programmatically. How can I achieve this requirement?

*-Group1 'REQ' contains the select-*options. If r_manage/r_display radio button is checked, the select-*options should be made optional
LOOP AT SCREEN INTO wa_screen.
CASE 'X'.
WHEN r_entry.
IF wa_screen-group1 EQ 'ENT'.
wa_screen-active = '0'.
ENDIF.
WHEN r_manage.
CASE wa_screen-group1.
WHEN'ENT'.
wa_screen-active = '1'.
WHEN 'REQ'.
vl_req_flag = 'X'.
ENDCASE.
WHEN r_display.
CASE wa_screen-group1.
WHEN'ENT'.
wa_screen-active = '1'.
WHEN 'REQ'.
vl_req_flag = 'X'.
ENDCASE.
ENDCASE.
MODIFY SCREEN FROM wa_screen.
ENDLOOP.

*-Preparing values in listbox
vl_vrm_id = 'P_STATUS'.

wa_vrm-key = '1'.
wa_vrm-text = 'Available'.
APPEND wa_vrm TO it_vrm.

wa_vrm-key = '2'.
wa_vrm-text = 'Out'.
APPEND wa_vrm TO it_vrm.

wa_vrm-key = '3'.
wa_vrm-text = 'Both'.
APPEND wa_vrm TO it_vrm.

CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = vl_vrm_id
VALUES = it_vrm.
ENDFORM.

The above subroutine is called whenever the PBO module is called. I am using 'vl_req_flag' as a global variable to determine whether the select-options should be mandatory or optional. I am just stuck on how to access the attributes for the inputs to modify the 'required' attribute.

Any help would be greatly appreciated.

3 REPLIES 3

xiswanto
Active Participant
0 Kudos
263

to change the parameter / select option as required, you need to pass the screen-required = 1
*assuming your optional word mean not mandatory

Sandra_Rossi
Active Contributor
263

Why do you use subscreens? Are you mixing dynpro and selection screen?

If yes, make sure you do LOOP AT SCREEN, MODIFY SCREEN in the right event (at selection-screen output, or PBO module).

As it varies according to the checkbox, it should be "recommended" (required = 2) otherwise you'll get into many troubles (+ you will need to check the mandatory value by ABAP):

screen-required = '2'.
  • 0: optional
  • 1: obligatory
  • 2: recommended

waleed_k99
Discoverer
0 Kudos
263

Yes I had to mix dynpro and selection-screen due to dynpro not supporting multiple entry input fields. I managed to get it working with your advice though, thank you.