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

capturing selection screen values

Former Member
0 Likes
843

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

1 ACCEPTED SOLUTION
Read only

venkat_o
Active Contributor
0 Likes
811

Hi Ravi, <li>Try this way.

REPORT 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.
Thanks Venkat.O

5 REPLIES 5
Read only

Former Member
0 Likes
811

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

Read only

venkat_o
Active Contributor
0 Likes
812

Hi Ravi, <li>Try this way.

REPORT 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.
Thanks Venkat.O

Read only

0 Likes
811

Hi venkat,

A small correction.

The l_matnr will only be initial for the first time .

Read only

Former Member
0 Likes
811

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.

Read only

Former Member
0 Likes
811

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.