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

Screen enable-disable issues

Former Member
0 Likes
777

Hi,

I am from basis and not a champion in ABAP.

I am writing a small ABAP program to enable-disable upon clicking a radio button.

The program is as follows -

************************

REPORT ZTEST1.

DATA : loopchk2 type i.

selection-screen begin of block ready with frame title text-113.

parameter obj type c default 'X' as checkbox USER-COMMAND b.

parameter obj1 default 'X' radiobutton group and3 MODIF ID two.

parameter obj2 radiobutton group and3 MODIF ID two.

selection-screen end of block ready.

INITIALIZATION.

loopchk2 = 1.

AT SELECTION-SCREEN .

IF sy-ucomm = 'B'.

IF obj = 'X'.

loopchk2 = 1.

ELSE.

loopchk2 = 0.

endif.

ENDIF.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF screen-group1 = 'TWO'.

screen-input = loopchk2.

MODIFY SCREEN.

endif.

ENDLOOP.

START-OF-SELECTION.

perform objwrite.

form objwrite.

write: / 'Please select at least one check box for report to run.'.

endform.

******************************

The issue is when I uncheck the checkbox "obj" and run the report, it prints the result, which is fine but then I choose a back button then i can see that the checkbox is unchecked but two radio buttons are enabled again. The screen initializes again. The screen should not change. I debug it and found that the it changess the value of obj checkbox to X but the screen does not show it. It shows as unchecked.

Please help me.

I will appreciate your help.

Thank you,

SC

1 ACCEPTED SOLUTION
Read only

bbalci
Contributor
0 Likes
669

Hello Sume,

When you press F3 button,

events INITIALIZATION and AT SELECTION-SCREEN OUTPUT.will be triggered again respectively.

Since you set variable loopchk2 = 1. in the INITIALIZATION event

you see screen elements editable again.

You don't need to use INITIALIZATION and AT SELECTION-SCREEN events for this,

Just use this code :

REPORT ztest1.

*DATA : loopchk2 TYPE i.

SELECTION-SCREEN BEGIN OF BLOCK ready WITH FRAME TITLE text-113.

PARAMETER obj TYPE c DEFAULT 'X' AS CHECKBOX USER-COMMAND b.

PARAMETER obj1 DEFAULT 'X' RADIOBUTTON GROUP and3 MODIF ID two.

PARAMETER obj2 RADIOBUTTON GROUP and3 MODIF ID two.

SELECTION-SCREEN END OF BLOCK ready.

*INITIALIZATION.

  • loopchk2 = 1.

*AT SELECTION-SCREEN .

  • IF sy-ucomm = 'B'.

  • IF obj = 'X'.

  • loopchk2 = 1.

  • ELSE.

  • loopchk2 = 0.

  • ENDIF.

  • ENDIF.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF screen-group1 = 'TWO'.

IF obj = 'X'. <--- Use directly the parameter obj here, no need to other event and variables

screen-input = 1.

ELSE.

screen-input = 0.

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

START-OF-SELECTION.

PERFORM objwrite.

&----


*& Form objwrite

&----


  • text

----


FORM objwrite.

WRITE: / 'Please select at least one check box for report to run.'.

ENDFORM. "objwrite

I hope it helps.

Bulent

Edited by: Bulent Balci on Jul 27, 2010 4:45 PM

2 REPLIES 2
Read only

bbalci
Contributor
0 Likes
670

Hello Sume,

When you press F3 button,

events INITIALIZATION and AT SELECTION-SCREEN OUTPUT.will be triggered again respectively.

Since you set variable loopchk2 = 1. in the INITIALIZATION event

you see screen elements editable again.

You don't need to use INITIALIZATION and AT SELECTION-SCREEN events for this,

Just use this code :

REPORT ztest1.

*DATA : loopchk2 TYPE i.

SELECTION-SCREEN BEGIN OF BLOCK ready WITH FRAME TITLE text-113.

PARAMETER obj TYPE c DEFAULT 'X' AS CHECKBOX USER-COMMAND b.

PARAMETER obj1 DEFAULT 'X' RADIOBUTTON GROUP and3 MODIF ID two.

PARAMETER obj2 RADIOBUTTON GROUP and3 MODIF ID two.

SELECTION-SCREEN END OF BLOCK ready.

*INITIALIZATION.

  • loopchk2 = 1.

*AT SELECTION-SCREEN .

  • IF sy-ucomm = 'B'.

  • IF obj = 'X'.

  • loopchk2 = 1.

  • ELSE.

  • loopchk2 = 0.

  • ENDIF.

  • ENDIF.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF screen-group1 = 'TWO'.

IF obj = 'X'. <--- Use directly the parameter obj here, no need to other event and variables

screen-input = 1.

ELSE.

screen-input = 0.

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

START-OF-SELECTION.

PERFORM objwrite.

&----


*& Form objwrite

&----


  • text

----


FORM objwrite.

WRITE: / 'Please select at least one check box for report to run.'.

ENDFORM. "objwrite

I hope it helps.

Bulent

Edited by: Bulent Balci on Jul 27, 2010 4:45 PM

Read only

Former Member
0 Likes
669

Thank you.

The issue is resolved.

Regards

SC