2006 Mar 29 10:47 PM
Hi all,
Program reads ESTMJ table to find the specification linked to the material. However, multiple specifications might be linked with the material. The specification number should be output to the file based upon the specification type. In order to output specification number, we check whether the specification type is REAL_SUB or ZPURCH_SUB
The select statements have been developed in this manner :
SELECT matnr bismt
INTO t_outtab FROM mara
WHERE lvorm IN s_lvorm
AND kzumw IN s_kzumw
AND mtart IN s_mtart .
*--- Retrieve 'RECNROOT' given the material number
CLEAR : w_recnroot.
SELECT SINGLE recnroot INTO w_recnroot
FROM estmj
WHERE matnr = t_outtab-matnr
AND delflg = space.
IF sy-subrc EQ 0.
*--- Retrieve the specification number
SELECT SINGLE subid INTO t_outtab-subid
FROM estrh
WHERE recnroot =
w_recnroot
AND delflg = space.
I changed the code for third query as in following manner :
SELECT SINGLE subid INTO t_outtab-subid
FROM estrh
WHERE recnroot = w_recnroot
AND ( subcat = 'REAL_SUB' or subcat =
'ZPURCH_SUB' )
AND delflg = space.
Can anyone suggest me whether what I have done is correct or wrong ?
Regards,
Varun.
Message was edited by: varun sonu
2006 Mar 29 10:52 PM
2006 Mar 29 10:52 PM
2006 Mar 29 11:03 PM
Hi Varun,
You can change the 3rd select like this & check.But your select looks good..
SELECT SINGLE subid INTO t_outtab-subid
FROM estrh
WHERE recnroot = w_recnroot
AND subcat in ('REAL_SUB' , 'ZPURCH_SUB')
AND delflg = space.
2006 Mar 29 11:09 PM
Hi Varun,
It seems good. but one suggestion, try to select the query based on RECN instead RECNROOT. Always it is better to retrieve query on Key values to increase performance and integrity purpose.
shylesh