2013 Jul 23 9:00 PM
Hi everybody,
How can i work it;
s_mjahr(year char4) is select-options .
plaf-psttr is date(dats) type
select mara~mtart mara~matkl plaf~matnr plaf~plwrk plaf~verid
into (gt_out-mtart, gt_out-matkl, gt_out-matnr, gt_out-plwrk,
gt_out-verid)
from plaf inner join mara on ( plaf~matnr = mara~matnr )
where plaf~matnr in s_matnr
and plaf~plwrk in s_werks
and mara~mtart in s_mtart
* and plaf~psttr+0(4) in s_mjahr "--> not working
.
append gt_out.
endselect.
thank.
2013 Jul 23 10:00 PM
Hi,
I don't think you could make it work in the SQL statement.
What you could do is:
Add field PSTTR to the structure of GT_OUT and don't append the line if it does not match your condicition.
Something like this:
SELECT mara~mtart mara~matkl plaf~matnr plaf~plwrk plaf~verid plaf~psttr
INTO (gt_out-mtart, gt_out-matkl, gt_out-matnr, gt_out-plwrk, gt_out-verid, gt_out-psttr)
FROM plaf INNER JOIN mara ON ( plaf~matnr = mara~matnr )
WHERE plaf~matnr IN s_matnr
AND plaf~plwrk IN s_werks
AND mara~mtart IN s_mtart .
IF gt_out-psttr(4) IN s_mjahr.
APPEND gt_out.
ENDIF.
ENDSELECT.
2013 Jul 23 10:00 PM
Hi,
I don't think you could make it work in the SQL statement.
What you could do is:
Add field PSTTR to the structure of GT_OUT and don't append the line if it does not match your condicition.
Something like this:
SELECT mara~mtart mara~matkl plaf~matnr plaf~plwrk plaf~verid plaf~psttr
INTO (gt_out-mtart, gt_out-matkl, gt_out-matnr, gt_out-plwrk, gt_out-verid, gt_out-psttr)
FROM plaf INNER JOIN mara ON ( plaf~matnr = mara~matnr )
WHERE plaf~matnr IN s_matnr
AND plaf~plwrk IN s_werks
AND mara~mtart IN s_mtart .
IF gt_out-psttr(4) IN s_mjahr.
APPEND gt_out.
ENDIF.
ENDSELECT.
2013 Jul 24 5:57 AM
Hi,
Try this, it will work,
assign the values of your select-option into a range table like,
SIGN = 'I'
OPTION = 'CP' 'Contains Pattern
LOW & HIGH from your select-option embedded with a * at the last (like if the year is 1990 append as 1990*)
And and in the select querry modify the statment
and plaf~psttr+0(4) in s_mjahr "--> not working
AS
and plaf~psttr in r_mjahr(range table)
Hope this helps