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: 

Dynamic interaction on selection screen

Former Member
0 Kudos

Hi experts,

I just have a easy question regarding selection screen in a ordinary ABAP report.

The code is below:

*-- Blcok 2

selection-screen begin of block block_2 with frame title text-s03.

select-options:

s_wc_id for /cockpit/cwc_id-wc_id matchcode object zmm25sh000008.

selection-screen begin of line.

parameters p_duewc type c as checkbox.

selection-screen comment 5(50) status_1 for field p_duewc.

selection-screen end of line.

parameters p_ndays(2) type n.

selection-screen end of block block_2.

When the user marks the checkbox p_duewc the parameter p_ndays should be ready for data entering.

If the checkbox is not marked (default) p_ndays shall be not ready for data entering.

I guess I can control it via the statement at-selection screen but can you give more details.

How can I code such a request?

Thanks in advance.

Regards

Cornelius

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Thanks for the answer,

but remember the user don't want to press the enter button after marking the checkmark p_duewc.

With the logics you've provided it is neccessary to press the return-button to start use the functionality.

Are there any other possibilities?

Regargs

Cornelius

11 REPLIES 11

Former Member
0 Kudos

hI

selection-screen begin of block block_2 with frame title text-s03.

select-options:

s_wc_id for /cockpit/cwc_id-wc_id matchcode object zmm25sh000008.

selection-screen begin of line.

parameters p_duewc type c as checkbox user-cammand NOD.

selection-screen comment 5(50) status_1 for field p_duewc.

selection-screen end of line.

parameters p_ndays(2) type n MODIF ID AAA.

selection-screen end of block block_2.

AT SELECTION-SCREEN OUTPUT.

IF p_duewc = SPACE.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'AAA'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Max

Former Member
0 Kudos

You need to assign a user command to the check box. add the command USER COMMAND p1 to the checkbox definition.

When the user selects the checkbox AT SELECTION SCREEN OUTPUT will be triggered.

Under this event you need to write

if p_duewc = 'X'.

LOOP AT SCREEN.

CHECK SCREEN-NAME = 'P_NDAYS'.

Screen-input = 1.

MOdify screen.

ENdloop.

else.

LOOP AT SCREEN.

CHECK SCREEN-NAME = 'P_NDAYS'.

Screen-input = 0.

MOdify screen.

ENdloop.

endif.

-Kiran

*Please mark useful answers

Former Member
0 Kudos

Hi ,

modify your code as below.

parameters p_ndays(2) type n MODIF ID sc1 .

AT SELECTION-SCREEN OUTPUT.

if p_duewc NE 'X'.

PERFORM set_screen_attr.

endif.

FORM set_screen_attr .

LOOP AT SCREEN.

IF screen-group1 = c_sc_grp.

screen-active = c_one.

screen-input = c_zero.

screen-output = c_one.

screen-invisible = c_zero.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

reward if you find this helpful.

regards,

Sumit.

Former Member
0 Kudos

Hello,

U can use this code.

SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-001.

PARAMETER: P_LAND LIKE KNA1-LAND1 ,

P_REGIO LIKE KNA1-REGIO ,

P_PSTLZ LIKE KNA1-PSTLZ ,

P_ORT01 LIKE KNA1-ORT01 .

SELECTION-SCREEN END OF BLOCK BL1.

SELECTION-SCREEN SKIP 2.

SELECTION-SCREEN BEGIN OF BLOCK BL2 WITH FRAME TITLE TEXT-001.

PARAMETERS: P_KDGR AS CHECKBOX MODIF ID SC1 USER-COMMAND SELTYPE,

P_BCS AS CHECKBOX MODIF ID SC2,

P_BDS AS CHECKBOX MODIF ID SC2,

P_BDC AS CHECKBOX MODIF ID SC2,

P_ALL AS CHECKBOX MODIF ID SC3 USER-COMMAND SELTYPE.

SELECTION-SCREEN END OF BLOCK BL2.

AT SELECTION-SCREEN OUTPUT.

IF P_KDGR = 'X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'SC1'.

SCREEN-INPUT = '1'.

SCREEN-OUTPUT = '1'.

MODIFY SCREEN.

ENDIF.

IF SCREEN-GROUP1 = 'SC2'.

SCREEN-INPUT = '0'.

SCREEN-OUTPUT = '1'.

MODIFY SCREEN.

ENDIF.

IF SCREEN-GROUP1 = 'SC3'.

SCREEN-INPUT = '0'.

SCREEN-OUTPUT = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSEIF P_ALL = 'X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'SC1'.

SCREEN-INPUT = '0'.

SCREEN-OUTPUT = '1'.

MODIFY SCREEN.

ENDIF.

IF SCREEN-GROUP1 = 'SC2'.

SCREEN-INPUT = '0'.

SCREEN-OUTPUT = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Reward points if is useful.

Regards,

Vasanth

Former Member
0 Kudos

Hi,

Use:

at selection-screen.

if p__duewc = 'X'.

loop at screen.

if screen-name = 'P_DUEWC'.

screen-input = 1.

modify-screen.

endif.

endloop.

Regards,

Mireia

former_member181962
Active Contributor
0 Kudos

at selection-screen output.

if p_duewc = SPACE.

loop at screen.

if screen-name = 'P_NDAYS'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

endloop.

endif.

rEGARDS,

rAVI

Former Member
0 Kudos

Thanks for the answer,

but remember the user don't want to press the enter button after marking the checkmark p_duewc.

With the logics you've provided it is neccessary to press the return-button to start use the functionality.

Are there any other possibilities?

Regargs

Cornelius

0 Kudos

If you have assigned a user command to the checkbox then the user need not press enter. On selecting the check box the event is fired automatically.

Sample code

PARAMETER: ckb1 AS CHECKBOX USER-COMMAND cb1.

AT SELECTION-SCREEN OUTPUT.

MESSAGE s000(vz) WITH 'Event1'.

-Kiran

Message was edited by: Kiran Raorane

0 Kudos

you can assign your check box a user command and then make use of it.

PARAMETERS check AS CHECKBOX USER-COMMAND check.

0 Kudos

No, fortunality the event is not triggered automatically.

I've tested it and when I mark the checkbox it happens nothing.

But if i mark the checkbox and press return the event is triggered.

- Cornelius

0 Kudos

Hi

you can try like that.

TABLES : SSCRFIELDS .

parameters p_ndays(2) type n MODIF ID SC1 .

PARAMETERS check AS CHECKBOX USER-COMMAND CHECK.

AT SELECTION-SCREEN .

case SSCRFIELDS-UCOMM.

when 'CHECK'.

if check = 'X'.

PERFORM set_screen_attr.

endif.

endcase.

FORM set_screen_attr .

LOOP AT SCREEN.

IF screen-group1 = 'SC1'.

screen-active = '1'.

screen-input = '0'.

screen-output = '1'.

screen-invisible = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

endform.