‎2010 Mar 04 10:16 AM
Hi,
I got a scenario where i have a selection screen
SELECTION-SCREEN BEGIN OF BLOCK b1 .
SELECT-OPTIONS: material FOR mara-material.
Now at START-OF-SELECTION. i need to check the values entered by user in this selection screen like if same material name is entered 2 times and give me msg like that.How can i capture the vales from selection screen.
Regards,
Ravi
‎2010 Mar 04 10:29 AM
Hi Ravi,
<li>Try this way.
Thanks
Venkat.OREPORT ztest.
TABLES mara.
DATA l_matnr TYPE mara-matnr.
SELECT-OPTIONS: matnr FOR mara-matnr.
AT SELECTION-SCREEN.
LOOP AT matnr .
IF l_matnr IS INITIAL.
l_matnr = matnr-low.
ELSE.
IF matnr-low = l_matnr.
MESSAGE 'Duplicate' TYPE 'E'.
ENDIF.
ENDIF.
ENDLOOP.
‎2010 Mar 04 10:24 AM
Hi Ravi,
You will need to write the relevant code in the 'AT SELECTION-SCREEN ON material' event.
For example:
AT SELECTION-SCREEN ON material.
delete adjacent duplicates from material. "will remove duplicate entries
START-OF-SELECTION.
...
You should find plenty of resources on this forum for handling AT SELECTION-SCREEN events. Please search for them; wish you all the best!
Cheers,
Shailesh.
Always provide feedback for helpful answers
‎2010 Mar 04 10:29 AM
Hi Ravi,
<li>Try this way.
Thanks
Venkat.OREPORT ztest.
TABLES mara.
DATA l_matnr TYPE mara-matnr.
SELECT-OPTIONS: matnr FOR mara-matnr.
AT SELECTION-SCREEN.
LOOP AT matnr .
IF l_matnr IS INITIAL.
l_matnr = matnr-low.
ELSE.
IF matnr-low = l_matnr.
MESSAGE 'Duplicate' TYPE 'E'.
ENDIF.
ENDIF.
ENDLOOP.
‎2010 Mar 04 11:05 AM
Hi venkat,
A small correction.
The l_matnr will only be initial for the first time .
‎2010 Mar 04 11:48 AM
Hi execute teh code for analysing this issue ..
tables : mara.
SELECT-OPTIONS: s_mat FOR mara-matnr no-display.
data : lv_mat type char21 .
ranges rtab for s_mat occurs 0 .
initialization.
s_mat-low = '100-100'.
APPEND S_MAT.
s_mat-LOW = '100-101'.
APPEND S_MAT.
s_mat-LOW = '100-100'.
APPEND S_MAT.
s_mat-LOW = '100-101'.
APPEND S_MAT.
s_mat-LOW = '100-101'.
APPEND S_MAT.
s_mat-LOW = '100-101'.
APPEND S_MAT.
START-OF-SELECTION.
SORT S_MAT BY LOW.
LOOP AT S_MAT.
if lv_mat is initial or lv_mat ne s_mat-low.
lv_mat = s_mat-low.
rtab-low = s_mat-low. append rtab.
WRITE:/ S_MAT-LOW.
elseif s_mat-low eq rtab-low .
WRITE:/ S_MAT-LOW, 'duplciate entry'.
endif.
ENDLOOP.
the write statement in ur case can be replaced by message statement .
The user can enter multiple entries in the selection screen in the low field . now better to sort this stuff before handing the sequence ..
you can check this by altering the select options table .
br,
Vijay.
‎2010 Mar 04 11:53 AM
It would be better to check the input at event AT SELECTION-SCREEN as opposed to START-OF-SELECTION as the message will be displayed whilst still in the selection screen. At START-OF-SELECTION this is not the case.