‎2007 May 22 5:55 PM
Hi all,
select single * from marC where matnr = '1234' AND
WERKS = 'ABC' AND
WERKS = 'XYZ' .
even though the material exist in both the plant it returns a sy-subrc eq to 4.
Though it supposed to return sy-subrc eq 0.
Thanks
Suchitra
‎2007 May 22 5:57 PM
select single * from marC where matnr = '1234' AND
WERKS in ( 'ABC', 'XYZ').
Try This
The select U have written always return sy-subrc 4 because u where checking whether plant is both ABC and XYZ which is always false . hence the select query was failing
‎2007 May 22 5:57 PM
select single * from marC where matnr = '1234' AND
WERKS in ( 'ABC', 'XYZ').
Try This
The select U have written always return sy-subrc 4 because u where checking whether plant is both ABC and XYZ which is always false . hence the select query was failing
‎2007 May 22 6:00 PM
‎2007 May 22 6:00 PM
Hi
Use the <b>CONVERSION_EXIT_ALPHA_INPUT or OUTPUT </b> for the material field and pass the material no, because it has to be 18 char.
select single * from marC where matnr = <b>'000000000000001234' AND
WERKS in ( 'ABC', 'XYZ').</b>
Reward points if useful
Regards
Anji
‎2007 May 22 6:01 PM
use ranges :
tables : marc.
range p_werks for marc-werks.
start-of-selection.
r_werks-low = '1234'.
r_werks-option = 'EQ'.
r_werks-sign = 'I'.
append r_werks.
r_werks-low = '1235'.
r_werks-option = 'EQ'.
r_werks-sign = 'I'.
append r_werks.
select single * from marC
where matnr = '1234' AND
WERKS in p_werks.
‎2007 May 22 6:12 PM
Hi ALL,
I WANT TO CHECK WHETHER THE MATERIAL IS PRESENT IN BOTH THE PLANTS THEN ONLY IT SHOULD A SY-SUBRC EQ 0
EVEN THOUGH IT EXISTS IN ONE PLANT IT SHOULD RETURN A SY-SUBRC NE 0.
select single * from marC where matnr = '1234' AND
WERKS = ('ABC' , 'XYZ' ).
WHEN I DO THIS EVEN THOUGH IT EXIST IN ONE PLANT IT RETURNS A SY-SUBRC EQ 0.
WHICH IS WRONG
lET ME KNOW HOW TO ACHIEVE THIS
THANKS
‎2007 May 22 6:18 PM
Hi
In that case use like this and see, still it gives error or not.
select single * from marC where matnr = '000000000000001234'
AND ( WERKS = 'ABC' and WERKS = 'XYZ' ).
Reward points if useful
Regards
Anji
‎2007 May 22 6:19 PM
select single * from marC
where matnr = '1234' AND
( WERKS = 'ABC' and WERKS = 'XYZ' ).
‎2007 May 22 6:20 PM
Hi,
With the syntax you provided it gives a sy-subrc eq 4 even though it exists in both the plants
Thanks
‎2007 May 22 6:22 PM
select single * from marC
where matnr = '000000000000001234' AND
( WERKS = 'ABC' and WERKS = 'XYZ' ).
try this one.
‎2007 May 22 6:27 PM
Hi ,
I DID TRIED THIS ONE .
EVEN THOUGH THE MATERIAL EXISTS IN BOTH THE PLANTS IT RETURNS A SY-SUBRC EQ 4
LET ME KNOW
THANKS
‎2007 May 22 6:37 PM
You cannot use one SELECT SINGLE. intstead try with two ie
select single * from marC
where matnr = '1234' AND
WERKS = 'ABC'.
if sy-subrc eq 0.
select single * from marC
where matnr = '1234' AND
WERKS = 'XYZ' .
if sy-subrc eq 0.
* record found
else.
*error.
endif.
endif.
~Suresh
‎2007 May 22 6:40 PM
Hi Suresh ,
In your case even though it exists in one plant the sy-subrc is equal to 0 right.
I want the sy-subrc to be 0 only when it exist in both the palnts
Thanks
‎2007 May 22 6:41 PM
‎2007 May 22 6:45 PM
do not use select single and it will get one record from database.
use select * from marc and try now.
‎2007 May 22 6:47 PM
try like this and you will get exact results :
tables : marc .
data wa_marc like marc occurs 0 with header line.
parameters : p_matnr like marc-matnr.
*ranges : r_werks for marc-werks.
start-of-selection.
*r_werks-low = '1000'.
*r_werks-sign = 'I'.
*r_werks-option = 'EQ'.
*append r_werks.
*
*r_werks-low = '1100'.
*r_werks-sign = 'I'.
*r_werks-option = 'EQ'.
*append r_werks.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = p_matnr
IMPORTING
OUTPUT = p_matnr
.
select * from marc into table wa_marc
where matnr = p_matnr
and ( werks = '1000' and werks = '1100' ).
if sy-subrc eq 0.
write:/ 'Plant is okay'.
endif.
Reward Points if it is helpful
Thanks
Seshu
‎2007 May 22 6:54 PM
Hi ALL,
THANKS FOR YOUR REPLIES.
i THOUGH OF DOING THIS WITHOUT CREATING ANY INTERNAL TABLES AND WITH A SINGLE STATEMENT.
I guess it doesn't seem to work that way
I went multiple select statements
I awarded points to all
Thanks AGAIN