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

Movement types in a date range

RahulKeshav
Active Contributor
0 Likes
2,116

Hi All,

I need to get all the movement types occured in date range for a material.

I got movement types for material form MSEG but i need to specify within date range.

Plz suggest.

Thanx

Rohit

1 ACCEPTED SOLUTION
Read only

faisalatsap
Active Contributor
0 Likes
1,702

Hi,

Try the following code,

TABLES: mseg.

RANGES: r_bwart FOR mseg-bwart.
r_bwart-sign = 'I'.
r_bwart-option = 'EQ'.
SELECT DISTINCT bwart FROM mseg
   INTO r_bwart-low.
APPEND r_bwart TO r_bwart.
ENDSELECT.

Hope will help you.

Kind Regards,

Faisal

Hi All,

I need to get all the movement types occured in date range for a material.

I got movement types for material form MSEG but i need to specify within date range.

Plz suggest.

Thanx

Rohit

7 REPLIES 7
Read only

Former Member
0 Likes
1,702

Make a join between MKPF and MSEG. MKPF has the dates.

You can create a simple query in SQVI to create a table join.

Read only

saikumar_vvs
Explorer
0 Likes
1,702

Could you please elabarate the requirement..date range??

Regards,

Sai

Read only

GauthamV
Active Contributor
0 Likes
1,702

Hi,

use MKPF,MSEG ( combination ) tables.

Read only

RahulKeshav
Active Contributor
0 Likes
1,702

Thanks for repling..

Now i have mov type from date range for material doc.for mkpf..table

and i have three fields on the selection screen..

Posting date(parameters)20/01/2009

System date(parameters)03/02/2009

System time(select-option)00:00:00 to 16:24:34

if a mat.doc has been created on 25/01/2009 18:24:20 and i am taking posting date which is in between the two dates given in the selection screen...

as 25/01/2009 falls in between that range but the time is 18:24:34 which does not fall in between that time range provided on the screen...

so the select query fails...

wt i want is that to get a range as 20/01/2009 00:00:00 to 03/02/2009 16:24:34 from table mkpf..

how to get that...

plz suggest..

Rohit

Read only

0 Likes
1,702

try it like this: you will get the movement type between this date & time range from mseg

Select a~BWART
  into table t_itab
  from mseg as a inner join mkpf as b
    on a~MBLNR eq b~MBLNR
   and a~MJAHR eq b~MJAHR
 where b~BLDAT between l_BLDAT     and h_BLDAT
   and b~CPUTM between s_time-low  and s_time-high.

or you want to check for a single movement type than

Select single a~BWART
  into w_bwart
  from mseg as a inner join mkpf as b
    on a~MBLNR eq b~MBLNR
   and a~MJAHR eq b~MJAHR
 where b~BLDAT between l_BLDAT     and h_BLDAT
   and b~CPUTM between s_time-low  and s_time-high
   and a~BWART eq p_BWART.

if sy-subrc <> 0.
Endif.

With luck,

Pritam.

Edited by: Pritam Ghosh on Feb 3, 2009 4:42 PM

Read only

faisalatsap
Active Contributor
0 Likes
1,703

Hi,

Try the following code,

TABLES: mseg.

RANGES: r_bwart FOR mseg-bwart.
r_bwart-sign = 'I'.
r_bwart-option = 'EQ'.
SELECT DISTINCT bwart FROM mseg
   INTO r_bwart-low.
APPEND r_bwart TO r_bwart.
ENDSELECT.

Hope will help you.

Kind Regards,

Faisal

Read only

RahulKeshav
Active Contributor
0 Likes
1,702

Thanks all for ur replies...

my problem has solved....

i cant take time as select-option as mentioned by pretam....because

if i want to take a range as

20-jan 12:00:10

30-jan 09:12:00

in that case the s_time-low (12:00:10) has value greater than s_time-high (09:12:00).....thats not possible..

so i took time as two perameters.....

Thanks every bdy....

Rohit