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

Validation on selection-screen

Former Member
0 Likes
720

hi all,

there is validation for SELECT-OPTIONS:

Need to take Material No.s and Base Code from the selection-screen, i need to check to see if assignment to certificate profile exits(KOTI001(Table)-material and KOTI905(table)-Base Code). if No need to pop-up message.

Thanks,

7 REPLIES 7
Read only

Former Member
0 Likes
665

hi

use at selection screen for field.

regards

sajid

Read only

0 Likes
665

Hi,

Use 'At Selection Screen' event for validation and 'POPUP_TO_CONFIRM' for the pop up message.

Thanks,

Sri.

Read only

0 Likes
665

No Need of pop-up message jut it is enough to show error message. tell me how to give logic .

Read only

Former Member
0 Likes
665

Hi!!!

Check this code snippet.

TABLES: koti001.
TYPES: BEGIN OF ty_koti001,
           matnr TYPE matnr,
           knumh TYPE knumh,
       END OF ty_koti001.
DATA: it_koti001 TYPE TABLE OF ty_koti001.
SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
select-OPTIONS: pa_matnr FOR koti001-matnr,
                pa_knumh FOR koti001-knumh.
SELECTION-SCREEN END OF BLOCK blk1.
START-OF-SELECTION.
  SELECT matnr FROM koti001 INTO CORRESPONDING FIELDS OF TABLE it_koti001
    WHERE matnr in pa_matnr.
  IF sy-subrc NE 0.
    MESSAGE 'No material found' TYPE 'I'.
  ENDIF.

P.S. Do similar check for base code(koti001-knumh).

Thanks

Read only

RaymondGiuseppi
Active Contributor
0 Likes
665

Try something like

TYPES: BEGIN OF ty_koti001,
           matnr TYPE matnr,
           knumh TYPE knumh,
       END OF ty_koti001.
DATA: gt_koti001 TYPE TABLE OF ty_koti001,
      l_matnr TYPE matnr.

SELECTION-SCREEN: BEGIN OF BLOCK so01 WITH FRAME TITLE text-001.
SELECT-OPTIONS: so_matnr FOR koti001-matnr,
                so_knumh FOR koti001-knumh.
SELECTION-SCREEN END OF BLOCK so01.

AT SELECTION-SCREEN ON BLOCK so01.
  IF sscrfields-ucomm EQ 'ONLI'
  OR sscrfields-ucomm EQ 'PRIN'.
    SELECT matnr
      INTO CORRESPONDING FIELDS OF TABLE gt_koti001
      FROM koti001
        WHERE matnr IN so_matnr
          AND knumh IN so_knumh.
  ELSE.
    SELECT SINGLE matnr
      INTO l_matnr
      FROM koti001
        WHERE matnr IN so_matnr
          AND knumh IN so_knumh.
  ENDIF.
  IF sy-subrc NE 0.
    MESSAGE e019(k6).
  ENDIF.

START-OF-SELECTION.

Regards,

Raymon

Read only

0 Likes
665

This message was moderated.

Read only

Former Member
0 Likes
665

You can use at selection screen event for this purpose.

For example

parameters: p_matnr like mara-matnr.

at selection-screen on p_matnr.

write your logic to give the error message.

select-options: s_matnr for mara-matnr.

at selection-screen.

if not s_matnr[] is initial.

loop at s_matnr.

check the every material no in s_matnr-low and if the material no not satifid the condition then give the error message.

if s_matnr-high is initial.

check the every material no in s_matnr-low and if the material no not satifid the condition then give the error message.

endif.

endloop.