‎2009 Feb 12 8:43 PM
Hi Experts,
I am trying to create a selection screen which has got the following option:
radio button 1. select by name
and within this radio button there should a parameter for a user to enter lets say "name"
radio button 2. Select by ID
and within this radio button there should be a parameter for a user to enter lets say "ID"...
Can you please tell me how can I acheiev this.
Thanks,
Rajeev
‎2009 Feb 13 7:07 AM
Hi Rajeev,
Try it this way:
TABLES:
tstc.
Data:
t_tstc like standard table of tstc.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-002.
PARAMETERS:
p_tcode RADIOBUTTON GROUP rad1 DEFAULT 'X' user-command abc,
p_prog RADIOBUTTON GROUP rad1.
SELECTION-SCREEN END OF BLOCK blk1.
selection-screen begin of block 1 with frame title text-001.
SELECT-OPTIONS:
s_tcode for tstc-tcode modif id aaa,
s_pgmna for tstc-PGMNA modif id bbb.
selection-screen end of block 1.
At selection-screen output.
if p_tcode = 'X'.
loop at screen.
if screen-group1 = 'BBB'.
screen-input = 0.
modify screen.
endif.
endloop.
elseif p_prog = 'X'.
loop at screen.
if screen-group1 = 'AAA'.
screen-input = 0.
modify screen.
endif.
endloop.
endif.
Start-of-selection.
If S_PGMNA is initial and S_TCODE is not initial. " i have changed d condition here as my last
* condition was wrong
Perform GET_S_PGMNA.
Elseif S_PGMNA is not initial and S_TCODE is initial.
Perform GET_S_TCODE.
Endif.
*&---------------------------------------------------------------------*
*& Form GET_S_PGMNA
*&---------------------------------------------------------------------*
form GET_S_PGMNA.
SELECT *
FROM tstc
INTO TABLE t_tstc
WHERE tcode IN s_tcode.
endform. " GET_S_PGMNA
*&---------------------------------------------------------------------*
*& Form GET_S_TCODE
*&---------------------------------------------------------------------*
form GET_S_TCODE.
SELECT *
FROM tstc
INTO TABLE t_tstc
WHERE tcode IN s_pgmna.
endform. " GET_S_TCODEWith luck,
Pritam.
Edited by: Pritam Ghosh on Feb 13, 2009 8:11 AM
‎2009 Feb 12 8:56 PM
Hello Rajeev,
Search on SCN/WIKI for hiding fields on selection screen.
regards,
Advait
‎2009 Feb 12 8:56 PM
search forum for SELECTION SCREEN BEGIN OF LINE or you can check the SAP Help also for the same.
‎2009 Feb 12 11:16 PM
Hi All,
I have tried the following code:
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-002.
PARAMETERS: p_tcode RADIOBUTTON GROUP rad1 DEFAULT 'X',
s_tcode like tstc-tcode,
p_prog RADIOBUTTON GROUP rad1 ,
s_pgmna like tstc-pgmna.
SELECTION-SCREEN END OF BLOCK blk1.but now I am getting an error at the following select statement...
SELECT * FROM tstc
INTO TABLE t_tstc
WHERE tcode IN s_tcode."The IN operator with "S_TCODE" is followed neither by an internal table"
can you please tell me what I am dng wrong
Thanks,
Rajeev
‎2009 Feb 12 9:27 PM
Hi,
you can create radio button in 2 diff groups .
In first group create your "name" radio button nd then add that parameter for input field
and in select group other radio button and other parameter.
Now if you want that if you select 1st radio button than user should be allowed only to enter value in first parameter than you have to code that in program.
else.
create do like this ..
lets say ur first radio button name is r_but1 and paramter name is p_name
and r_but2 and p_xyz.
create all these 4 things in single group.
than write logic like
if r_but1 = x
loop at screen.
screen-field = p_name
screen-active = 1.
modify screen.
screen-field = p_xyz.
screen-active = 0.
modify screen.
endloop.
like wise you can code for other radio button.
‎2009 Feb 12 9:27 PM
Hello,
I know this does not address your question but one other way to do this would
be to display both parameters without the radiobuttons.
They really do not add much value.
Then if someone enters a value for name
Select data by name
if a value is entered for id
Select data by id.
If data is entered for both name and id issue an error
Regards
Greg Kern
‎2009 Feb 12 11:03 PM
Hi All,
I have tried the following code:
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-002.
PARAMETERS: p_tcode RADIOBUTTON GROUP rad1 DEFAULT 'X',
s_tcode like tstc-tcode,
p_prog RADIOBUTTON GROUP rad1 ,
s_pgmna like tstc-pgmna.
SELECTION-SCREEN END OF BLOCK blk1.
but now I am getting an error at the following select statement...
SELECT * FROM tstc
INTO TABLE t_tstc
WHERE tcode IN s_tcode.
"The IN operator with "S_TCODE" is followed neither by an internal table"
can you please tell me what I am dng wrong
Thanks,
Rajeev
‎2009 Feb 12 11:18 PM
Hello
s_tcode needs to be declared as a select-option( see f1).
Regards
Greg Kern
‎2009 Feb 13 3:04 AM
Declare s_tcode like this
SELECT-OPTIONS: s_tcode FOR tstc-tcode. if it needs a range in the input selection..
If you want only single value input,
Code like this:
PARAMETERS: s_tcode LIKE tstc-tcode.
Then you need to use EQ operator in the SELECT query...
Thanks
Geetha
‎2009 Feb 13 3:49 AM
Hi Geetha,
Thnks for the reply....now I have written the following code:
selection-screen begin of block 1 with frame title 010.
select-options: p_tcode for tstc-pcode,
p_name for tstc-pmna.
selection-screen end of block 1.and it's working fine...but now I have a question...I have code in program where if user selects the first parameter i.e. p_tcode then the program should do a particular perform and if the user selects the p_name one then it should do a different perform.... so can you please tell me how can I achieve this...
I mean there should be a condition like this:
if user selects p_tcode.
perform p_trnscode.
else.
perform p_program.
endif.
but I am not able to identify how can I get this.
Thanks,
Rajeev
‎2009 Feb 13 5:28 AM
hi,
SELECT * FROM tstc
INTO TABLE t_tstc
WHERE tcode IN s_tcode.
This is what u have used.
I feel thet 'IN' will not work with Parameter , so insted try using this
SELECT * FROM tstc
INTO TABLE t_tstc
WHERE tcode = s_tcode.
I hope this will help u. If I am wrong please let me know.
‎2009 Feb 13 5:38 AM
Hi,
Use AT SELECTION-SCREEN ON <Fieldname> event
Check Demo program DEMO_SELECTION_SCREEN_EVENTS
‎2009 Feb 13 6:22 AM
Hi Suraj,
I tried doing this also... and it's working also but the problem it's only tsking care of single entry at a time..... it's not taking care of the range.....so I tried the follwoing:
Hi Geetha,
Thnks for the reply....now I have written the following code:
selection-screen begin of block 1 with frame title 010.
select-options: p_tcode for tstc-pcode,
p_name for tstc-pmna.
selection-screen end of block 1.and it's working fine...but now I have a question...I have code in program where if user selects the first parameter i.e. p_tcode then the program should do a particular perform and if the user selects the p_name one then it should do a different perform.... so can you please tell me how can I achieve this...
I mean there should be a condition like this:
if user selects p_tcode.
perform p_trnscode.
else.
perform p_program.
endif.
Please advise.
‎2009 Feb 13 3:13 AM
Hi,
write like this.....
selection-screen begin of block b1 with frame.
parameters:
p_sales radiobutton group grp user-command UC default 'X',
p_name type sy-uname modif id grp,
p_order radiobutton group grp,
p_ID type sy-uname modif id g2.
selection-screen end of block b1.
Regards
Kiran
‎2009 Feb 13 3:33 AM
Hi,
You can get with the following code:
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME.
PARAMETERS:
p_rad1 RADIOBUTTON GROUP r1,
p_name TYPE sy-uname ,
p_rad2 RADIOBUTTON GROUP r1,
p_id(6) TYPE n.
SELECTION-SCREEN END OF BLOCK a1.
Regards,
Rajani
‎2009 Feb 13 6:35 AM
Hi Rajeev,
This works.....
Parameters:
P_box1 radiobutton group GRP,
P_NAME(30) TYPE C MODIF ID SC1,
P_box2 radiobutton group GRP,
P_ID TYPE I MODIF ID SC1.
AT SELECTION-SCREEN OUTPUT.
If p_box1 eq 'X'.
LOOP AT SCREEN.
IF screen-NAME CS 'P_ID'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
elseIF P_BOX2 EQ 'X'.
LOOP AT SCREEN.
IF screen-NAME CS 'P_NAME'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-group1 = 'SC1'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
Regards,
Mdi.Deeba
‎2009 Feb 13 6:38 AM
Hi Rajeev,
In the start-of-selection you can do the below code.
IF p_tcode = 'X'.
*Call ur Perform A.
PERFORM perform_A.
ELSEIF p_prog = 'X'.
*Call ur Perform B.
PERFORM perform_B.
ENDIF.
hopes it will work for you.....
Cheers,
Rajesh.
‎2009 Feb 13 6:42 AM
Hi,
Check this one,
TABLES : mara,marc.
*******************************************************************************************
************************Selection screen fields******************************************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_meth1 RADIOBUTTON GROUP g1 USER-COMMAND g1,
p_meth2 RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK matnr
WITH FRAME TITLE text-002.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS : so_matnr FOR marc-matnr MODIF ID m1.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS : so_werks FOR marc-werks MODIF ID m1 .
SELECTION-SCREEN END OF BLOCK matnr.
SELECTION-SCREEN BEGIN OF BLOCK file WITH FRAME TITLE text-003.
SELECTION-SCREEN SKIP 1.
PARAMETERS: p_fpath TYPE ibipparms-path MODIF ID m2 LOWER CASE.
SELECTION-SCREEN END OF BLOCK file.
SELECTION-SCREEN BEGIN OF BLOCK date WITH FRAME TITLE text-004.
SELECTION-SCREEN SKIP 1.
PARAMETERS : p_date TYPE datuv. "CCT51576.
SELECTION-SCREEN END OF BLOCK date.
***************************************************************************************
***********************Screen Validation*********************************************
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
CASE screen-group1.
WHEN 'M1'.
IF p_meth1 <> 'X'.
screen-active = 1.
ENDIF.
IF p_meth2 = 'X'.
screen-active = 0.
ENDIF.
WHEN 'M2'.
IF p_meth2 = 'X'.
screen-active = 1.
ELSE.
screen-active = 0.
ENDIF.
IF p_meth1 = 'X'.
screen-active = 0.
ENDIF.
ENDCASE.
MODIFY SCREEN.
ENDLOOP.
‎2009 Feb 13 7:07 AM
Hi Rajeev,
Try it this way:
TABLES:
tstc.
Data:
t_tstc like standard table of tstc.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-002.
PARAMETERS:
p_tcode RADIOBUTTON GROUP rad1 DEFAULT 'X' user-command abc,
p_prog RADIOBUTTON GROUP rad1.
SELECTION-SCREEN END OF BLOCK blk1.
selection-screen begin of block 1 with frame title text-001.
SELECT-OPTIONS:
s_tcode for tstc-tcode modif id aaa,
s_pgmna for tstc-PGMNA modif id bbb.
selection-screen end of block 1.
At selection-screen output.
if p_tcode = 'X'.
loop at screen.
if screen-group1 = 'BBB'.
screen-input = 0.
modify screen.
endif.
endloop.
elseif p_prog = 'X'.
loop at screen.
if screen-group1 = 'AAA'.
screen-input = 0.
modify screen.
endif.
endloop.
endif.
Start-of-selection.
If S_PGMNA is initial and S_TCODE is not initial. " i have changed d condition here as my last
* condition was wrong
Perform GET_S_PGMNA.
Elseif S_PGMNA is not initial and S_TCODE is initial.
Perform GET_S_TCODE.
Endif.
*&---------------------------------------------------------------------*
*& Form GET_S_PGMNA
*&---------------------------------------------------------------------*
form GET_S_PGMNA.
SELECT *
FROM tstc
INTO TABLE t_tstc
WHERE tcode IN s_tcode.
endform. " GET_S_PGMNA
*&---------------------------------------------------------------------*
*& Form GET_S_TCODE
*&---------------------------------------------------------------------*
form GET_S_TCODE.
SELECT *
FROM tstc
INTO TABLE t_tstc
WHERE tcode IN s_pgmna.
endform. " GET_S_TCODEWith luck,
Pritam.
Edited by: Pritam Ghosh on Feb 13, 2009 8:11 AM
‎2009 Feb 13 3:46 PM
Hi Pritam,
Thanks a lot for the reply and it did work.... but I have a small problem... if i selects 1st radio button and enter the tcode in the parameter and execute it...it will giveme the desired result but now if I need to select the second radio button and need to enter the program name.... but to get the result I first need to delete the entry that I made in the first selection and then only it will give me the result...otherwise it will do nothing !!! do you have any idea why it is like this....
Thanks
Rajeev
‎2009 Feb 16 6:14 AM
Do it this way, add selection-screen event, like this:
At selection-screen.
if p_tcode = 'X'.
Clear s_pgmna.
elseif p_prog = 'X'.
Clear s_tcode.
endif.With luck,
Pritam.