2012 May 15 7:15 AM
Dear All Gurus,
I have developed a Report with Plant as Parameters and in another selection screen block there are 4 radiobuttons viz A,B,C,D
My requirement is that if I enter Plant as X then all the 4 Radiobutton should be visible and if I enter Plant as Y then only A and B should be made visible.
I have already worked in case of radiobutton selection changes screen dynamically and in Listbox also.But heer I want in case of text field.
I have already searched on SDN and found that NO-DISPLY will not work, Loop at Screen will work only with USER-COMMAND. Here user will not press Enter otherwise that can work. Can it be possible to hide the screen at first and then call the screen based on X or Y.
Kindly guide me in this matter.
Regards,
Bharti Jain
2012 May 15 10:44 AM
I would show the plant parameter as a listbox and associate a user command to it so that a PAI is executed when the user selects one plant. Just like this:
PARAMETERS: p_werks type werks_d AS LISTBOX VISIBLE LENGTH 40 USER-COMMAND plant.
I would show the plant parameter as a listbox and associate a user command to it so that a PAI is executed when the user selects one plant. Just like this:
PARAMETERS: p_werks type werks_d AS LISTBOX VISIBLE LENGTH 40 USER-COMMAND plant.
2012 May 15 8:02 AM
Hi,
parameters:p_werks like marc-werks.
selection-screen begin of block bl1 with frame title text-001.
parameters:rd1 radiobutton group gr1,
rd2 radiobutton group gr1,
rd3 radiobutton group gr1,
rd4 radiobutton group gr1.
selection-screen end of block bl1.
at selection-screen OUTPUT.
LOOP AT screen.
IF P_WERKS = 'Y'.
if screen-name = 'RD1' OR SCREEN-NAME = 'RD2'.
SCREEN-INVISIBLE = 1.
ELSE.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
2012 May 15 12:02 PM
Thanks For Replying.
I have already done the same but it is happening only while pressing Enter. Can we have a method to call a screen with 4 RB at X Plant and 2 at Y Plant.
Regards,
Bharti Jain
2012 May 15 10:44 AM
I would show the plant parameter as a listbox and associate a user command to it so that a PAI is executed when the user selects one plant. Just like this:
PARAMETERS: p_werks type werks_d AS LISTBOX VISIBLE LENGTH 40 USER-COMMAND plant.
2012 May 15 12:03 PM
Thanks For Replying,
I have already shown to user in this way but they dont want List Box. They want in Text Field only.
Regards,
Bharti Jain
2012 May 15 12:15 PM
That is not possible... Only some kind of screen elements can carry the user-command which is required to trigger a PAI/PBO cycle which will redisplay screen on a classical GUI screen.
4. ... AS CHECKBOX [USER-COMMAND fcode]
5. ... RADIOBUTTON GROUP group [USER-COMMAND fcode]
6. ... AS LISTBOX VISIBLE LENGTH vlen [USER-COMMAND fcode]
Regards,
Raymond
2012 May 15 12:54 PM
Well, there is still a chance. You can use class CL_GUI_TIMER to trigger an automatic PAI every second.
Check this: http://scn.sap.com/message/13248739#13248739
2012 May 16 4:31 AM
Please guide me how can do this in this case where when the plant is entered then based on it the selection screen displays. I am not very much comfortable with OO. Please guide me regarding this.
Regards,
Bharti Jain
2012 May 16 10:22 AM
I have borrowed Sap Abap's code and modified it a little. It has no complication at all. You define a timer. Every second you read the screen value of P_WERKS and compare it with the previous value. It the user has modified the value you trigger a PAI and the AT SELECTION-SCREEN OUPUT is executed. If P_WERKS is 'AAAA' then we hide two options.
REPORT ztimer_test.
*----------------------------------------------------------------------*
* CLASS lcl_update DEFINITION
*----------------------------------------------------------------------*
CLASS lcl_update DEFINITION.
PUBLIC SECTION.
METHODS constructor.
PROTECTED SECTION.
DATA: my_timer TYPE REF TO cl_gui_timer,
my_werks TYPE werks_d.
METHODS on_finished FOR EVENT finished OF cl_gui_timer.
ENDCLASS. "lcl_update DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_update IMPLEMENTATION
*----------------------------------------------------------------------*
CLASS lcl_update IMPLEMENTATION.
METHOD constructor.
CREATE OBJECT my_timer.
my_timer->interval = 1.
SET HANDLER me->on_finished FOR my_timer.
my_timer->run( ).
ENDMETHOD. "constructor
METHOD on_finished.
DATA: ls_dynpread TYPE dynpread,
lt_dynpread TYPE STANDARD TABLE OF dynpread.
*--Get current value of P_WERKS ---------
ls_dynpread-fieldname = 'P_WERKS'.
APPEND ls_dynpread TO lt_dynpread.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
TABLES
dynpfields = lt_dynpread
EXCEPTIONS
OTHERS = 0.
*-- Compare previous value with current value. Trigger PAI only if it has changed
READ TABLE lt_dynpread INTO ls_dynpread INDEX 1.
IF sy-subrc EQ 0.
IF ls_dynpread-fieldvalue NE my_werks.
cl_gui_cfw=>set_new_ok_code( 'REFRESH' ).
ENDIF.
my_werks = ls_dynpread-fieldvalue.
ENDIF.
my_timer->run( ).
ENDMETHOD. "on_finished
ENDCLASS. "lcl_update IMPLEMENTATION
DATA: gr_update TYPE REF TO lcl_update.
PARAMETERS: p_werks TYPE werks_d.
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
PARAMETERS: rd1 RADIOBUTTON GROUP gr1,
rd2 RADIOBUTTON GROUP gr1,
rd3 RADIOBUTTON GROUP gr1,
rd4 RADIOBUTTON GROUP gr1.
SELECTION-SCREEN END OF BLOCK bl1.
INITIALIZATION.
CREATE OBJECT gr_update.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF p_werks = 'AAAA'.
IF screen-name = 'RD1' OR screen-name = 'RD2'.
screen-invisible = 1.
rd1 = space.
rd2 = space.
ELSE.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
2012 May 18 11:09 PM
Hello,
You could also solve your problem using a second selection-screen, or multiple tabs on the selection-screen.
Bruce
PARAMETERS: p_text(1).
SELECTION-SCREEN BEGIN OF SCREEN 2000.
PARAMETERS:a RADIOBUTTON GROUP g1,
b RADIOBUTTON GROUP g1,
c RADIOBUTTON GROUP g1,
d RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF SCREEN 2000.
AT SELECTION-SCREEN OUTPUT.
IF sy-dynnr = '2000'.
IF p_text = 'X'.
* OK, all radio buttons dispaly
ELSEIF p_text = 'Y'.
LOOP AT SCREEN.
IF screen-name = 'C' OR
screen-name = 'D'.
screen-invisible = 1.
ELSE.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF. " p_text = 'X'
ENDIF. " sy-DYNNR = '2000'.
START-OF-SELECTION.
CALL SELECTION-SCREEN 2000 STARTING AT 20 5.
WRITE: / 'Back after 2nd sel screen'.
Message was edited by: Bruce Tjosvold
Message was edited by: Bruce Tjosvold
2012 May 15 12:09 PM
Hi,
I would suggest you use a search help for the text field and make the text field non editable.
So when user selects a Plant from Search help, it can be displayed in the Text box and immediately after that you can have code for modifying the screen.
Thanks,
Shambu
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |