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

default values on selection screen

Former Member
0 Likes
775

Dear All,

I have a selection screen with some select options and 4 radio buttons. Now my requirement is to set the default values in the select options dynmically on browse of radiobuttons. I'm not able to set the default values with option 'NE', when i set the s_matnr-option = 'NE', then user cannot change this default setting on the selection screen. Please suggest something.

Thanks,

Anup.

6 REPLIES 6
Read only

Former Member
0 Likes
731

Hi,

In the Event AT SELECTION SCREEN, write the code for the condition.

Check for the radio button selected and then assign the values to the Select option field.

I hope you must be aware of the Table which is assigned to every select option. You can fill the values in this table.

Hope it helps...

Lokesh

Pls. reward appropriate points

Read only

Former Member
0 Likes
731

at selection-screen.

*do like this.

if rbutton1.

loop at screen.

if screen-name = 'CUSTOMER'.

delete s_kunnr.

s_kunnr-low = 'xxx'.

s_kunnr-option = 'EQ'.

append s_kunnr.

modify screen.

endif.

endloop.

Read only

Former Member
0 Likes
731

this is my selection screen:

PARAMETERS: P_APPN RADIOBUTTON GROUP RAD1 DEFAULT 'X' USER-COMMAND RAD.

PARAMETERS: P_PRTN RADIOBUTTON GROUP RAD1.

PARAMETERS : P_LPATH TYPE RLGRAP-FILENAME MODIF ID Z1,

P_D10 TYPE RLGRAP-FILENAME,

P_D13 TYPE RLGRAP-FILENAME,

P_D75 TYPE RLGRAP-FILENAME.

SELECTION-SCREEN END OF BLOCK B2 .

write the given logic in your program

AT SELECTION-SCREEN OUTPUT.

PERFORM CHANGE_STATUS.

FORM CHANGE_STATUS.

IF SY-SLSET IS INITIAL.

*--this is to check any variant selected or not

*-- Use default values

IF P_APPN = 'X'.

"if USER selects application radio button

P_LPATH = 'Z0LO_SCM_FROM_SAP'.

P_D10 = 'LPAD10SAP.TXT'. "these 3 are parameters

P_D13 = 'LPAD13SAP.TXT'.

P_D75 = 'LPAD75SAP.TXT'.

ELSE.

P_D10 = 'C:\LPAD10SAP.TXT'.

P_D13 = 'C:\LPAD13SAP.TXT'.

P_D75 = 'C:\LPAD75SAP.TXT'.

ENDIF.

ENDIF.

IF P_PRTN = 'X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'Z1' .

SCREEN-INVISIBLE = 1.

SCREEN-ACTIVE = 0.

ELSE.

SCREEN-INVISIBLE = 0.

SCREEN-ACTIVE = 1.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

ENDFORM. " CHANGE_STATUS

Read only

Former Member
0 Likes
731
REPORT  ZTEST1234TX                             .

tables: mara.
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE g_b2_ttl.

parameters: r1 radiobutton group g1 user-command ABC,
            r2 radiobutton group g1.
select-options: s_matnr for mara-matnr.
SELECTION-SCREEN END OF BLOCK blk2.
at selection-screen output.

if r1 = 'X'.
loop at screen.
if screen-name = 'S_MATNR-LOW'.
CLEAR S_MATNR.
s_matnr-low = '1234'.
s_matnr-option = 'NE'.
s_matnr-sign = 'I'.
append s_matnr.
endif.
endloop.
else.

**do what ever here..similar way..
endif.
Read only

Former Member
0 Likes
731

Hi Anup,

To assign default values to a selection criterion, you use the following syntax:

SELECT-OPTIONS <seltab> FOR <f> DEFAULT <g> [TO <h>] ....

Default values <g> and <h> can be literals or field names. You can only use fields that contain a value when the program is started.

To fill only the LOW field (single field comparison), use:

........DEFAULT <g>.

To fill the LOW and HIGH fields (range selection), use:

........DEFAULT <g> TO <h>.

To fill the OPTION field, use:

........DEFAULT <g> [to <h>] OPTION <op>.

Hope this helps u,

Regards,

Nagarajan.

Read only

Former Member
0 Likes
731

Hi Anup

U can go thru this sample code.

tables mara.

parameters: p_r1 radiobutton group r1 default 'X',

p_r2 radiobutton group r1,

p_r3 radiobutton group r1,

p_r4 radiobutton group r1.

select-options: s_matnr for mara-matnr default '100' option NE.

at selection-screen output.

if p_r1 = 'X'.

loop at screen.

if screen-name = 'S_MATNR-LOW'.

s_matnr-low = '1'.

insert s_matnr index 1.

endif.

modify screen.

endloop.

elseif p_r2 = 'X'.

loop at screen.

if screen-name = 'S_MATNR-LOW'.

s_matnr-low = '2'.

insert s_matnr index 1.

endif.

modify screen.

endloop.

elseif p_r3 = 'X'.

loop at screen.

if screen-name = 'S_MATNR-LOW'.

s_matnr-low = '3'.

insert s_matnr index 1.

endif.

modify screen.

endloop.

elseif p_r4 = 'X'.

loop at screen.

if screen-name = 'S_MATNR-LOW'.

s_matnr-low = '4'.

insert s_matnr index 1.

endif.

modify screen.

endloop.

endif.

Regards

Neelima.