cancel
Showing results for 
Search instead for 
Did you mean: 

How to read custom table in Exit ?

Former Member
0 Kudos

Dear Experts,

I have a Z table with below fields.

Calender Date Merchandising Date

01/01/2008 30/12/2007

02/01/2008 31/12/2007

03/01/2008 01/01/2008

04/01/2008 02/01/2008

I need to calculate the YTD based on merchandising date.

Suppose, if the current system date is 04/01/2008, i need to calculate the merchandising YTD ( i.e sum of 01/01/2008 and 02/01/2008) based on above mapping table.

Can you pls help me with solution ?

Regards,

Srikanth

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member181964
Active Contributor
0 Kudos

Hi,

If you want to Display in Report, then use the following code.

the following code : FMYEAR and LNYEAR are the Customer Exit Variables on 0CALMONTH, I have the same requirement, so I did like this, after that you give offset for FMYEAR and LMYEAR. Create New Selections in Columns and then restrict the above key figures with these two variables by using 0CALMONTH. Or You can create Restricted Keyfigures also, but in the both the case you need to give off set values.

Just try this FMs in SE37 then give some input and see what is out put, with this you get some Idea.

DATA : l_s_range TYPE rsr_s_rangesid,

loc_var_range LIKE rrrangeexit,

zbdatj LIKE t009b-bdatj,

zbuper LIKE t009b-poper,

zper LIKE t009b-poper.

First Month Of Current Fiscal year comment

WHEN 'FMYEAR'.

CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'

EXPORTING

i_date = sy-datum

I_MONMIT = 00

i_periv = 'V3'

IMPORTING

e_buper = zbuper

e_gjahr = zbdatj.

CLEAR: l_s_range.

l_s_range-low+4(2) = '04'.

l_s_range-low+0(4) = zbdatj.

l_s_range-sign = 'I'.

l_s_range-opt = 'EQ'.

APPEND l_s_range TO e_t_range.

Using above code you get First Month Of Current Fiscal year , create Restricted KeyFigure and restrict 0CALMONTH with Value Range and give FMYEAY+3; 0CALMONTH. And in the same RKF, take 0CALDAY and give one input Day with variable, here you can pass day value.

Last Month of Current Fiscal year

WHEN 'LMYEAR'.

CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'

EXPORTING

i_date = sy-datum

I_MONMIT = 00

i_periv = 'V3'

IMPORTING

e_buper = zbuper

e_gjahr = zbdatj.

CLEAR: l_s_range.

l_s_range-low+4(2) = '03'.

l_s_range-low+0(4) = zbdatj + 1.

l_s_range-sign = 'I'.

l_s_range-opt = 'EQ'.

APPEND l_s_range TO e_t_range.

Thanks

Reddy

Former Member
0 Kudos

I am not able to understand.

My query is how to read a custom table, whicl calculating YTD in a User exit ?

Based on SY-date, i would like to goto the custom table to fetch 'To Date'.

Srikanth

former_member181964
Active Contributor
0 Kudos

Hi,

First create Generic DataSource on that Y-Table and then load the data from ECC and then Ceate a reprot based on YTD, the CODE I given in this morning for your Posting.

Thanks

Reddy