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

at selection-screen problem

former_member630092
Participant
0 Likes
1,120

Hi all,

my report has selection-screen with fields lifnr and ekorg (mandatory field).

and output is lifnr , ekorg and some fields from lfb1.

i selected ekorg and lifnr from lfm1. and make relation with lfb1 table.

i want a at selection screen. in which it should display that vendor does not exits

in this organization. Please let me know the sol.

Example. : i give in selection-screen

vendor 1003

ekorg a100

If vendor is not in a100. it should display a message like E001(message zm)

Vendor does not exist in this ekorg.

Thanks

9 REPLIES 9
Read only

Former Member
0 Likes
1,054

Hi.

You can do a select single to LFM1 table with the vendor and pur org..

if value exists vendor is corect or else wrong.

Regards

Ansari

Read only

Former Member
0 Likes
1,054

Hi,

Check this ,


select-options: s_lifnr for lfm1-lifnr,
                        s_ekorg for lfm1-ekorg.


AT selection screen. 

select single * 
from lfm1
where lifnr in s_lifnr and 
            ekorg in s_ekorg.

If sy-subrc NE 0.
message E001 with 'Vendor does not exist in the purch org' .
endif.

Regards,

Vikranth

Read only

Former Member
0 Likes
1,054

hi ravi,

use this

select-options: s_lifnr for lfm1-lifnr,

s_ekorg for lfm1-ekorg.

at selection-screen.

IF NOT S_LIFNR IS INITIAL.

SELECT SINGLE * FROM lfm1

WHERE LIFNR IN S_LIFNR.

IF SY-SUBRC <> 0.

MESSAGE TEXT-001 TYPE 'E'.

ENDIF.

ENDIF.

IF NOT S_EKORG IS INITIAL.

SELECT SINGLE * FROM lfm1

WHERE EKORG IN S_EKORG.

IF SY-SUBRC <> 0.

MESSAGE TEXT-002 TYPE 'E'.

ENDIF.

ENDIF.

rgds/

shivraj

Edited by: ShivrajSinha on Sep 7, 2009 10:44 AM

Read only

0 Likes
1,054

Hi sir,

I tried the logic , but it is not working

Initialization.

AT selection-screen.

select single * from ekko

where lifnr in so_lifnr and

ekorg = s_ekorg.

If sy-subrc NE 0.

message E001 with 'Vendor does not exist in the purch org' .

endif.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,054

Hello Ravi,

Please clarify how you have defined your screen elements: so_lifnr & s_ekorg.

I think s_ekorg is a PARAMETER & so_lifnr is a SELECT_OPTION.

And you want to issue an error message for any LIFNR & EKORG combination not defined.

Plz revert back.

BR,

Suhas

Read only

0 Likes
1,054

Yes, exactly ,i am trying to do that.

s_ekorg is a PARAMETER

&

so_lifnr is a SELECT_OPTION .

for some vendor it is working , but for maximum vendors it is showing list with all blank fields.

Please rectify me

.thanks

Read only

0 Likes
1,054

>

> Yes, exactly ,i am trying to do that.

> s_ekorg is a PARAMETER

> &

> so_lifnr is a SELECT_OPTION .

>

> for some vendor it is working , but for maximum vendors it is showing list with all blank fields.

> Please rectify me

> .thanks

HI, Ravi

Check the following Sample Code hope will work for you.

TABLES: lfm1.
SELECT-OPTIONS: so_lifnr FOR lfm1-lifnr NO INTERVALS OBLIGATORY NO-EXTENSION.
PARAMETERS:     s_ekorg  like lfm1-ekorg OBLIGATORY.


AT SELECTION-SCREEN.
  SELECT SINGLE * FROM lfm1
    WHERE lifnr IN so_lifnr
      AND ekorg = s_ekorg.
  IF sy-subrc NE 0.
    MESSAGE: 'Not Found' TYPE 'E'.
  ENDIF.

Please Reply if still any Issue,

Regards,

Faisal

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,054

Hello Ravi,

Please try like this then:

LOOP AT SO_LIFNR.
  SELECT COUNT(*) FROM LFM1
  WHERE LIFNR = SO_LIFNR-LOW
  AND      EKORG = S_EKORG.
  
  IF SY-SUBRC NE 0.
"   Give Error Message
  ENDIF.
ENDLOOP.

BR,

Suhas

Read only

former_member630092
Participant
0 Likes
1,054

answered