2010 Mar 03 4:59 AM
Hi All,
I have a requirement in which i have 2 radio buttons and 1 push button and i have declared these three like this
PARAMETERS: r1 RADIOBUTTON GROUP g1,
r2 RADIOBUTTON GROUP g1.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: PUSHBUTTON 30(30) pb01 USER-COMMAND onli
VISIBLE LENGTH 15.
SELECTION-SCREEN: END OF LINE.
If i select the first radio button and click on the push button ztable should be updated. i have written code for this but 2nd time when user clicks on the push button with out changing the radio button position, a pop up message should be displayed like 'Nothing has been changedu2019.
Please suggest me in this issue.
Thanks in advance.
Regards,
Samatha
Hi All,
I have a requirement in which i have 2 radio buttons and 1 push button and i have declared these three like this
PARAMETERS: r1 RADIOBUTTON GROUP g1,
r2 RADIOBUTTON GROUP g1.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: PUSHBUTTON 30(30) pb01 USER-COMMAND onli
VISIBLE LENGTH 15.
SELECTION-SCREEN: END OF LINE.
If i select the first radio button and click on the push button ztable should be updated. i have written code for this but 2nd time when user clicks on the push button with out changing the radio button position, a pop up message should be displayed like 'Nothing has been changedu2019.
Please suggest me in this issue.
Thanks in advance.
Regards,
Samatha
2010 Mar 03 5:03 AM
Example
SELECTION-SCREEN : BEGIN OF BLOCK rd1 WITH FRAME TITLE text-007.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: r6 RADIOBUTTON GROUP red3 .
SELECTION-SCREEN COMMENT 5(20) text-011.
PARAMETERS: r7 RADIOBUTTON GROUP red3.
SELECTION-SCREEN COMMENT 30(16) text-012 .
PARAMETERS: r3 RADIOBUTTON GROUP red3.
SELECTION-SCREEN COMMENT 51(17) text-003.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN : END OF BLOCK rd1.
2010 Mar 03 5:05 AM
Hi!
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
MODIFY SCREEN.
ENDLOOP.
use your logic here.
2010 Mar 03 5:31 AM
Hi,
Declare an integer field and update it as '1' when the user clicks the push button for the first time.
And in the logic before updating in 'Z' table check this flag, if its value is '1' then display error message else proceed further.
Taj..
2010 Mar 03 5:36 AM
Hello Samatha,
a pop up message should be displayed like 'Nothing has been changedu2019.
May be if you can share with us where this message is being generated by the code it will be better to analyse ...
BR,
Suhas
2010 Mar 03 7:11 AM
Hi Samantha,
Grand Welcome to SDN.
Lets say you have itab.
declare jtab like itab
now move itab contents to jtab.
data : first type c.
if first is initial.
jtab[] = itab[]. " This happens only one time
first = 'X'.
endif.
if r1 = 'X'.
if sy-ucomm = 'PUSH'.
if not itab[] = jtab[].
" update the database.
else.
" Pop a message no data has been changed.
endif.
ENDIF.
ENDIF.Cheerz
Ram
2010 Mar 03 7:33 AM
Hello Samatha,
try this..
TABLES sscrfields.
PARAMETERS: r1 RADIOBUTTON GROUP g1 USER-COMMAND dumm,
r2 RADIOBUTTON GROUP g1.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: PUSHBUTTON 30(30) pb01 USER-COMMAND onli
VISIBLE LENGTH 15.
SELECTION-SCREEN: END OF LINE.
DATA: rb_chgd TYPE c LENGTH 1 VALUE 'X',
l_ucomm TYPE sscrfields-ucomm.
AT SELECTION-SCREEN OUTPUT.
IF l_ucomm <> 'DUMM'.
CLEAR rb_chgd.
ENDIF.
AT SELECTION-SCREEN.
l_ucomm = sscrfields-ucomm.
CASE l_ucomm.
WHEN 'DUMM'.
rb_chgd = 'X'.
WHEN 'ONLI'.
IF rb_chgd <> space.
MESSAGE 'Perform Action' TYPE 'I'.
* your code here..
ELSE.
MESSAGE 'Nothing has changed' TYPE 'I'.
ENDIF.
ENDCASE.
2010 Mar 03 8:05 AM
Hi Arun,
Thanks for the reply.
I have tried with the code you have provided. But 1st time when we select the 1st radio button the table should be update.2nd time if we don't change the position to 2nd radio button means still we are in the 1st radio button only that time the pop up should display an information message.
Regards,
Samatha
2010 Mar 03 11:01 AM
Nice catch Samantha,
Here is my answer..
TABLES sscrfields.
PARAMETERS: r1 RADIOBUTTON GROUP g1 USER-COMMAND dumm,
r2 RADIOBUTTON GROUP g1.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: PUSHBUTTON 30(30) pb01 USER-COMMAND onli
VISIBLE LENGTH 15.
SELECTION-SCREEN: END OF LINE.
DATA: rb_chgd TYPE c LENGTH 1 VALUE 'X',
l_ucomm TYPE sscrfields-ucomm.
AT SELECTION-SCREEN OUTPUT.
IF r1 IS INITIAL AND r2 IS INITIAL.
* we can use this condition to check whether it is first time.
rb_chgd = 'X'.
ELSEIF l_ucomm <> 'DUMM'.
CLEAR rb_chgd.
ENDIF.
AT SELECTION-SCREEN.
l_ucomm = sscrfields-ucomm.
CASE l_ucomm.
WHEN 'DUMM'.
rb_chgd = 'X'.
WHEN 'ONLI'.
IF rb_chgd <> space.
MESSAGE 'Perform Action' TYPE 'I'.
* your code here..
ELSE.
MESSAGE 'Nothing has changed' TYPE 'I'.
ENDIF.
ENDCASE.
2010 Mar 03 11:18 AM
Hi Arun,
Its Fine but when am clicking the 1st radio button for the 1st time also its showing nothing has been changed. but its not like that 1st time it should update the ztable if we dont change the postion to 2nd radio button then it sholud display a pop up.
Please suggest me.
Regards,
Samatha
2010 Mar 03 11:33 AM
Hi Samantha,
<li>Remove USER-COMMAND dumm portion in the below statement.
change to
PARAMETERS: r1 RADIOBUTTON GROUP g1 USER-COMMAND dumm.
Thanks
Venkat.O
PARAMETERS: r1 RADIOBUTTON GROUP g1.
2010 Mar 03 12:01 PM
Samatha,
Did you try to execute the program that I gave? It does not give 'Nothing has changed' the first time.. Or are you trying to embed this in some other logic? In that case, please let me know your entire program. Only then I'll be able to help you.
2010 Mar 03 12:02 PM
Venkat,
That line is required for finding whether the other Radio Button has been clicked or not. Please try to execute the program before commenting..
2010 Mar 03 12:06 PM
Samatha, please copy this program in an abap editor (as a fresh new program) and then execute..
TABLES sscrfields.
PARAMETERS: r1 RADIOBUTTON GROUP g1 USER-COMMAND dumm,
r2 RADIOBUTTON GROUP g1.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: PUSHBUTTON 30(30) pb01 USER-COMMAND onli
VISIBLE LENGTH 15.
SELECTION-SCREEN: END OF LINE.
DATA: rb_chgd TYPE c LENGTH 1 VALUE 'X',
l_ucomm TYPE sscrfields-ucomm.
AT SELECTION-SCREEN OUTPUT.
IF r1 IS INITIAL AND r2 IS INITIAL.
* we can use the above condition to check whether it is first time.
rb_chgd = 'X'.
ELSEIF l_ucomm NE 'DUMM'.
CLEAR rb_chgd.
ENDIF.
AT SELECTION-SCREEN.
l_ucomm = sscrfields-ucomm.
CASE l_ucomm.
WHEN 'DUMM'.
rb_chgd = 'X'.
WHEN 'ONLI'.
IF rb_chgd <> space.
MESSAGE 'Perform Action' TYPE 'I'.
* your code here..
ELSE.
MESSAGE 'Nothing has changed' TYPE 'I'.
ENDIF.
ENDCASE.This is just to let you know the logic to do this..
2010 Mar 03 12:27 PM
Hi Arun,
Thanks Alot.
One more i have 2 differnt conditions for 2 radio buttons. For the first one it sholud set some flag in ztable as X and for the 2nd it should set flag as Blank. With this code am getting flag as x for the 2 radio buttons.
Please suggest.
Regards,
Samatha
2010 Mar 03 12:20 PM
Hello,
Please try the following code.
PARAMETERS: r1 RADIOBUTTON GROUP g1 ,
r2 RADIOBUTTON GROUP g1.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: PUSHBUTTON 30(30) pb01 USER-COMMAND onli
VISIBLE LENGTH 15.
SELECTION-SCREEN: END OF LINE.
DATA rb.
AT SELECTION-SCREEN.
CLEAR rb.
IF r1 = 'X'.
IMPORT rb FROM MEMORY ID 'RB'.
IF rb IS INITIAL.
* perform update.
rb = 'X'.
EXPORT rb TO MEMORY ID 'RB'.
ELSE.
MESSAGE 'Select other radio button' TYPE 'I'.
ENDIF.
ELSEIF r2 = 'X'.
FREE MEMORY ID 'RB'.
ENDIF.
hope this helps in resolving your issue.
Regards,
Sachin
2010 Mar 04 11:15 AM
text 001 :Selection screen sample
tex t002 : List
text 003: Alv
text 004: None
CONSTANTS : rbSelected TYPE c LENGTH 1 VALUE 'X'.
DATA : p_txt type c LENGTH 100.
SELECTION-SCREEN BEGIN OF BLOCK frame1 WITH FRAME TITLE text-001.
SELECTION-SCREEN ULINE /10(40).
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 15.
PARAMETERS: rb1 RADIOBUTTON GROUP rb.
SELECTION-SCREEN COMMENT 20(30) text-002.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 15.
PARAMETERS: rb2 RADIOBUTTON GROUP rb.
SELECTION-SCREEN COMMENT 20(30) text-003.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 15.
PARAMETERS: rb3 RADIOBUTTON GROUP rb.
SELECTION-SCREEN COMMENT 20(30) text-004.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN ULINE /10(40).
SELECTION-SCREEN END OF BLOCK frame1.
IF rb1 = rbSelected.
CONCATENATE 'You selected' text-002 INTO p_txt SEPARATED BY space.
ELSEIF rb2 = rbSelected.
CONCATENATE 'You selected' text-003 INTO p_txt SEPARATED BY space.
ELSEIF rb3 = rbSelected.
CONCATENATE 'You selected' text-004 INTO p_txt SEPARATED BY space.
ENDIF.
WRITE / p_txt.
2010 Mar 04 12:31 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |