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

problem in loop screen

Former Member
0 Likes
1,197

Hi abapers,

I have written the following code:

selection screen: begin of block b1.

p_new radiobutton group new,

p_saved radiobutton group new.

selection screen: end of block b1.

selection-screen :begin of block b3 with frame title text-013.

parameters:p_rec type string.

selection-screen :end of block b3.

selection-screen: begin of block b4 with frame title text-014.

parameters:p_excel like RLGRAP-FILENAME MEMORY ID M01.

selection-screen:end of block b4.

now my requirment is that when radio button p_new is selected p_excel should be disabled

and when p_saved in checked p_REC should be disabled.

I have written the following code:

At selection-screen output.

perform f_disable-screen.

form f_disable.

loop at screen.

if p_new eq 'X'.

if screen-name = 'P_EXCEL'.

screen-input = 0 .

screen-intensified = 0.

modify screen.

endif.

endif.

if p_saved eq 'X'.

if screen-name = 'P_REC'.

screen-input = 0.

screen-intensified = 0.

modify screen.

endif.

endloop.

endform.

The code is also working but i have one problem.

when the slection screen is displayed no field is disabled

.

I have to press enter for the code to work i.e when i press enter only then the code for the particular radio button works.

I want to get around this and the code should work without pressing enter when any radio buttton is changed.

regards.

Aditya

Edited by: ADITYA KULKARNI on Apr 27, 2009 1:55 PM

Edited by: ADITYA KULKARNI on Apr 27, 2009 1:56 PM

Edited by: ADITYA KULKARNI on Apr 27, 2009 1:56 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,178

Hi,

Use the code this way....

selection-screen: begin of block b1.
parameters: p_new radiobutton group new USER-COMMAND fcode,
p_saved radiobutton group new.
selection-screen: end of block b1.

Regards,

Siddarth

10 REPLIES 10
Read only

Former Member
0 Likes
1,179

Hi,

Use the code this way....

selection-screen: begin of block b1.
parameters: p_new radiobutton group new USER-COMMAND fcode,
p_saved radiobutton group new.
selection-screen: end of block b1.

Regards,

Siddarth

Read only

0 Likes
1,178

Hi ,

Can you please elobrate how to use the user-command addition for the radio-button.

Regards,

Aditya

Read only

0 Likes
1,178

Hi,

You just have to declare it in the declaration with radio-button and need not write any other code apart from it... this will automatically work when you select any of the radio button the fields will get disabled....

just copy and paste the declaration I gave you above and that works as I have tested it as well....

Regards,

Siddarth

Read only

0 Likes
1,178

Hi Siddarth,

You are absolutely correct .

But i have one question this user command is valid for the entire group of radio button right?

Read only

0 Likes
1,178

Hi,

yes its correct... its valid for entire group

Regards,

Siddarth

Read only

Former Member
0 Likes
1,178

Hi,

see the change in code...


selection screen: begin of block b1.
p_new radiobutton group new user-command 'ABC' ,        "add user commandthis it will work..
p_saved radiobutton group new.
selection screen: end of block b1.

selection-screen :begin of block b3 with frame title text-013.
parameters:p_rec type string.
selection-screen :end of block b3.

selection-screen: begin of block b4 with frame title text-014.
parameters:p_excel like RLGRAP-FILENAME MEMORY ID M01.
selection-screen:end of block b4.

now my requirment is that when radio button p_new is selected p_excel should be disabled
and when p_saved in checked p_REC should be disabled.

I have written the following code:

At selection-screen output.
perform f_disable-screen.



form f_disable.

loop at screen.
if p_new eq 'X'.

if screen-name = 'P_EXCEL'.
screen-input = 0 .
screen-intensified = 0.
modify screen.
endif.

endif.

if p_saved eq 'X'.
if screen-name = 'P_REC'.
screen-input = 0.
screen-intensified = 0.
modify screen.
endif.

endloop.

endform.

regards,

Prabhudas

Read only

Former Member
0 Likes
1,178

Hi,

Your MODIFY SCREEN has no effect because p_new and p_save will always be blank when you enter the AT SELECTION-SCREEN OUTPUT statement for the frist time. Change the initial values of your parameters p_new and p_save so you will see deactivations (DEFAULT...).

When you change a value on your selection screen you will always have to hit ENTER to make the system take the new field value and process your selection screen events.

Hope this will help.

Issa

Read only

Former Member
0 Likes
1,178

Hello Aditya,

This code working fine i have to give one suggestion. At starting of selection screen not a single input is disabled for that u have to assign default value 'X' to any radio button.

See the code.

selection-screen: begin of block b1.

parameter : p_new radiobutton group new USER-COMMAND fcode default 'X', "change

p_saved radiobutton group new.

selection-screen: end of block b1.

So that at starting p_excel is by default disabled.

Regeards,

Yogesh

Read only

Former Member
0 Likes
1,178

Hi friends ,

I think Even if u add the Key Word ' USER-COMMAND ' in the statement for parameter definition -->

PARAMETERS: P_NEW RADIOBUTTON GROUP NEW USER-COMMAND ABC .

for the first time when u will execute ,this will not work as per requiremnt.

Just add default option as well in yr parameter definition ,will give u the best suited solution ,

just check out.

PARAMETERS: P_NEW RADIOBUTTON GROUP NEW USER-COMMAND ABC DEFAULT 'X',

Thanks & Regards

Rajesh

Read only

faisalatsap
Active Contributor
0 Likes
1,178

Hi,

Test the following Code i have made the Changes and it is working according to your requirement now.

SELECTION-SCREEN BEGIN OF BLOCK b1.
PARAMETERS: p_new RADIOBUTTON GROUP new USER-COMMAND a DEFAULT 'X',
            p_saved RADIOBUTTON GROUP new.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN :BEGIN OF BLOCK b3 WITH FRAME TITLE text-013.
PARAMETERS:p_rec TYPE string.
SELECTION-SCREEN :END OF BLOCK b3.

SELECTION-SCREEN: BEGIN OF BLOCK b4 WITH FRAME TITLE text-014.
PARAMETERS:p_excel LIKE rlgrap-filename MEMORY ID m01.
SELECTION-SCREEN:END OF BLOCK b4.

AT SELECTION-SCREEN OUTPUT.
  PERFORM f_disable.
*&---------------------------------------------------------------------*
*&      Form  f_disable
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM f_disable.

  LOOP AT SCREEN.
    IF p_new EQ 'X'.

      IF screen-name = 'P_EXCEL'.
        screen-input = 0 .
        screen-intensified = 0.
        MODIFY SCREEN.
      ENDIF.

    ENDIF.

    IF p_saved EQ 'X'.
      IF screen-name = 'P_REC'.
        screen-input = 0.
        screen-intensified = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.

  ENDLOOP.

ENDFORM.                    "f_disable

INITIALIZATION.
  PERFORM f_disable.

Please Reply if any Issue,

Best Regards,

Faisal