cancel
Showing results for 
Search instead for 
Did you mean: 

User Exit for 0CALDAY

former_member935223
Discoverer
0 Kudos

There is a business requirement to load 3 days of data every time we run the data load. The logic to derive 3 days are as follows:-

First day value of 0calday :- Sy-datm -1

Second value of 0calday :- sy-datm -2

Third value of 0calday :- sy-datum-3

Now the 3 dates will be passed as filter values for 0calday and data load will be for above 3 dates. E.g. load data where 0calday = Sy-datm -1 or Sy-datm -2 or Sy-datm -3

I have done user exits on extractor side but this is first time to work with user exit on report side. Please provide me the sample code.

Thanks,

Anil

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Anil,

use this which i have used earlier.....

When'ZDAT'

lv_date = sy-datum.

ls_range-low = lv_date - 3.

ls_range-high = lv_date - 1.

append ls_range.

Hope this helps....

Former Member
0 Kudos

Hello Guys,

I have some different requirement. I have 0CALDAY in a ODS. On that basis how to calculate prior year and prior month seperately? and assign the same as customer exit to a variable.

All steps in coding will be appreciated. I am new to coding.

Thanks.

Answers (2)

Answers (2)

former_member181964
Active Contributor
0 Kudos

Hi,

Using small ABAP code you can do it. User Formula Variable with Customer Exit and then do it.. see the following code , here I'm getting System Date in the same way you can gey -1 and -2 also i.e. you can set offset values for that Variable or using code directly you can do it.

See

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intellige...

For all Exit Variable see in

http://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy

IF i_step = 2.
CASE i_vnam.
WHEN 'ZCURDAY'.
CLEAR: l_s_range.
l_s_range-low = sy-datum.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDCASE.

To get the -1 you just create one more variable and do -1 for the above code.

Thanks

Reddy

Former Member
0 Kudos

Hello Surendra,

Thanks for you reply.

I guess my requirement is bit different. Let me explain you,

I have query, in which i need to restrict a sales amt keyfigure in columns with an year. Year will be prior year from date entered in user input selection screen. He/she can enter any date there. Query is created infocube, which gets data from ods. Infocube has only one time characteristics 0CALDAY. So need to get prior year based on 0CALDAY.

I think its clear now. In the same way I have to get prior month.

So can you get me all steps, I am not good in abap, just a bw consultant. Hope u understood

Thanks waiting for your reply.

former_member181964
Active Contributor
0 Kudos

Hi

Using 'DATE_CREATE' FM we can do it. see it in SE37 and implement it.

CALL FUNCTION 'DATE_CREATE'
	  EXPORTING
*   		ANZAHL_JAHRE         = -1
		ANZAHL_KALTAGE       = 0
*   		ANZAHL_MONATE        = 0
*   		ANZAHL_TAGE          = 0
    		datum_ein            = 20.04.2010
*   		DATUM_EIN_ULT        = ' '
*   		ULTIMO_SETZEN        = ' '
 	 IMPORTING
		DATUM_AUS            = 
		E_TT                 = 
*   		E_ULTKZ              =
		 .
 
      l_s_range-low = PSDT.
      l_s_range-sign = 'I'.
      l_s_range-opt = 'EQ'.
      APPEND l_s_range TO e_t_range.

The same is explained in the following article, you need to take only year from the result of teh FM.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/20f119d9-922d-2c10-88af-8c016638b...

Thanks

Reddy

Former Member
0 Kudos

Hello Surendra,

Thanks for replying. But its difficult to understand abap codes. Its going over my head. There is no simple way to make it possible? my requirement is as follows:

1. Prior Calender Year based on System date- for this we can just put offset on standard variable available from SAP on Current Calender year. [0CYEAR - 1]

2. Prior YTD based on 0CALMONTH

3. Current YTD based on 0CALMONTH

I just got system date available as a date field.

How can I get this? Is there any standard variable available in BI Content so that I can direct install and use it.

I really appreciate your help.

Thanks.

Former Member
0 Kudos

Well,

Can anybody tell me what is the significance of I_STEP in user exits.

What are the meanings of I_STEP & when to use:

I_STEP = 0

I_STEP = 1

I_STEP = 2

and also meaning of each internal table fields-

What is

E_T_RANGE-LOW = W_DATE. ??

E_T_RANGE-HIGH = ?? (other options?)

E_T_RANGE-SIGN = 'I'. ?? (other options?)

E_T_RANGE-OPT = 'EQ'. ?? (other options?)

APPEND E_T_RANGE

Thanks.

ravishanker_cheedepudi
Active Participant
0 Kudos

You can try this code ..

WHEN 'ZDATEDERI'.

CLEAR E_T_RANGE.

CLEAR L_S_RANGE.

l_s_range-low = sy-datum - 3.

l_s_range-high = sy-datum - 1 .

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'BT'.

APPEND L_S_RANGE TO E_T_RANGE.

Ravi