‎2009 Sep 07 8:54 AM
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
‎2009 Sep 07 8:58 AM
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
‎2009 Sep 07 9:00 AM
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
‎2009 Sep 07 9:43 AM
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
‎2009 Sep 07 10:51 AM
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.
‎2009 Sep 07 10:55 AM
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
‎2009 Sep 07 11:03 AM
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
‎2009 Sep 07 11:23 AM
>
> 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
‎2009 Sep 07 11:26 AM
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
‎2009 Sep 08 6:12 AM