Application Development 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: 

Pricing period

Former Member
0 Kudos

Hello

I'm using SD pricing condition table A004 and have f.ex. three condition records. Each record consists for a material with a valid from - valid to date.

example:

matnr: 312, datab: 01.01.2008, datbi: 15.01.2008

matnr: 312, datab: 16.01.2008, datbi: 31.01.2008

matnr: 312, datab: 01.02.2008, datbi: 31.12.2008

I would like to create a select statement to get all records within a given period.

In this case I would like to know all existing records within January 2008:

h_datab = 01.01.2008

h_datbi = 31.01.2008

SELECT knumh INTO TABLE t_knumh FROM A004

WHERE kappl = 'V'

AND kschl = kschl

AND matnr = matnr

AND datbi BETWEEN h_datab AND h_datbi

AND datab BETWEEN h_datab AND h_datbi

=> I also tried GT, LE etc.

Any ideas ?

thanks

3 REPLIES 3

Former Member
0 Kudos

I think that it's sufficient to test the beginnig date; you are interested in all prices valid in a given period so the pricing started in that period.

I'll do in this way, but I don't know what you really need.

h_datab = 01.01.2008

h_datbi = 31.01.2008

SELECT knumh INTO TABLE t_knumh FROM A004

WHERE kappl = 'V'

AND kschl = kschl

AND matnr = matnr

AND datab >= h_datab

AND datab <= h_datbi.

Hope this helps,

Regards

Former Member
0 Kudos

Hi,

You can try something like this:

assuming your db table has each a "valid from" and "valid to" field

select * from dbtab into inttab

(with the required select options but no restriction to the dates)

sort inttab by primary key fields

delete inttab

where ( valid_from > low_date "01.01.2008" OR valid_to < high_date "31.01.2008" ).

Kind Regards

Edited by: Raymond Friston on Sep 18, 2008 10:33 AM

Former Member
0 Kudos

great - I used following statement and it worked fine.

SELECT knumh INTO TABLE t_knumh FROM A004

WHERE kappl = 'V'

AND kschl = kschl

AND matnr = matnr

AND datbi >= h_datab

AND datbi <= i_datbi.

thanks a lot.