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

Selection option error message

Former Member
0 Likes
530

Dear Experts,

I need your help to code an error message:

This is an ABAP report program:

User can enter either Group Key (LFA1-KONZS) or Vendor Number (LFA1-LIFNR), if enter both, send an messagee : 'Please enter either Group Key or Vendor Number, not both'

The error message show at the status line of the button of the input selection option screen.

How do I do that?

Here are my codes so far:

*----


  • Selection Options

*----


selection-screen: begin of block box1 with frame title text-001.

select-options: so_bukrs for bkpf-bukrs obligatory.

select-options: so_blart for bkpf-blart obligatory.

select-options: so_cpudt for bkpf-cpudt obligatory.

select-options: so_konzs for lfa1-konzs.

select-options: so_lifnr for lfa1-lifnr.

selection-screen end of block box1.

Thank you very much!

Helen

1 ACCEPTED SOLUTION
Read only

faisalatsap
Active Contributor
0 Likes
477

Hi,

Test the following Sample Code Hope will solve out your problem,

TABLES: bkpf, lfa1.
SELECTION-SCREEN: BEGIN OF BLOCK box1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: so_bukrs FOR bkpf-bukrs OBLIGATORY.
SELECT-OPTIONS: so_blart FOR bkpf-blart OBLIGATORY.
SELECT-OPTIONS: so_cpudt FOR bkpf-cpudt OBLIGATORY.
SELECT-OPTIONS: so_konzs FOR lfa1-konzs. " This
SELECT-OPTIONS: so_lifnr FOR lfa1-lifnr. " This
SELECTION-SCREEN END OF BLOCK box1.

AT SELECTION-SCREEN.

  IF so_konzs IS NOT INITIAL AND so_lifnr IS NOT INITIAL.

    MESSAGE: 'Please enter either Group Key or Vendor Number, not both' TYPE 'I'.

  ENDIF.
" if you need that user must enter one value from the both than use the following lines of code too else Remove

  IF so_konzs IS INITIAL AND so_lifnr IS INITIAL.

    MESSAGE: 'Please enter Group Key or Vendor Number, not both' TYPE 'I'.

  ENDIF.

Kind Regards,

Faisal

Edited by: Faisal Altaf on Feb 9, 2009 10:16 PM

Edited by: Faisal Altaf on Feb 9, 2009 10:34 PM

2 REPLIES 2
Read only

faisalatsap
Active Contributor
0 Likes
478

Hi,

Test the following Sample Code Hope will solve out your problem,

TABLES: bkpf, lfa1.
SELECTION-SCREEN: BEGIN OF BLOCK box1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: so_bukrs FOR bkpf-bukrs OBLIGATORY.
SELECT-OPTIONS: so_blart FOR bkpf-blart OBLIGATORY.
SELECT-OPTIONS: so_cpudt FOR bkpf-cpudt OBLIGATORY.
SELECT-OPTIONS: so_konzs FOR lfa1-konzs. " This
SELECT-OPTIONS: so_lifnr FOR lfa1-lifnr. " This
SELECTION-SCREEN END OF BLOCK box1.

AT SELECTION-SCREEN.

  IF so_konzs IS NOT INITIAL AND so_lifnr IS NOT INITIAL.

    MESSAGE: 'Please enter either Group Key or Vendor Number, not both' TYPE 'I'.

  ENDIF.
" if you need that user must enter one value from the both than use the following lines of code too else Remove

  IF so_konzs IS INITIAL AND so_lifnr IS INITIAL.

    MESSAGE: 'Please enter Group Key or Vendor Number, not both' TYPE 'I'.

  ENDIF.

Kind Regards,

Faisal

Edited by: Faisal Altaf on Feb 9, 2009 10:16 PM

Edited by: Faisal Altaf on Feb 9, 2009 10:34 PM

Read only

Former Member
0 Likes
477

hi bro

you can go in following way( This is working code)

tables: lfa1,

bkpf.

selection-screen: begin of block box1 with frame title text-001.

select-options: so_bukrs for bkpf-bukrs obligatory.

select-options: so_blart for bkpf-blart obligatory.

select-options: so_cpudt for bkpf-cpudt obligatory.

select-options: so_konzs for lfa1-konzs.

select-options: so_lifnr for lfa1-lifnr.

selection-screen end of block box1.

at selection-screen.

if so_lifnr is not initial and so_konzs is not initial.

message 'BOTH NOT' type 'E'.

endif.

if so_lifnr is initial and so_konzs is initial.

message 'ATLEAST one' type 'E'.

endif.

regards