cancel
Showing results for 
Search instead for 
Did you mean: 

How to insert a code for a function module into a Customer Exit Variable?

Former Member
0 Kudos

I have two Key Figures viz., Net Prchs Rtl, and Net Prchs Unt. Both these Key figures have This Week (TW) and Last Week (LW). There is a variable for This week but there is no variable defined for Last week.

I need to get data in the column LW (Last Week) for both the key figures.

In function module EXIT_SAPLRRS0_001 one of the functions I have is:

  • Get the previous Fiscal Week

CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'

I need to create a new variable to get values in the Last week column for different key figures and use function “'DATE_TO_PERIOD_CONVERT'” in that variable.

Can anyone please explain me the steps as to how to use a function module in a variable so that when the variable is used in a key figure it shows the output.

In other words what I want to know is after creating a Customer exit variable of type Characteristic value how do I refer the above mentioned function moduel and insert the code for the function module into the Customer exit variable that I created.

Thank you.

TR.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

"In other words what I want to know is after creating a Customer exit variable of type Characteristic value how do I refer the above mentioned function moduel and insert the code for the function module into the Customer exit variable that I created."

In your customer exit, you need to pass value from user entry or default value to the function module and build your logic to return the desired result from the export of the function module and return to the variable. Once you build your logic and return values, you create a variable which will use the custom exit and attach it in your query.

But you are not write a custom exit and use the FM in a different place, but in your code.

thanks.

Wond

Former Member
0 Kudos

Hi Wond,

Thanks a lot for your reply. I understand what you mean but I have never done this before so can you please explain it in a detailed manner. I have the following code:

  • Get the previous Fiscal Week

CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'

EXPORTING

i_date = ld_date

i_periv = lc_periv

IMPORTING

e_buper = ln_poper

e_gjahr = ln_bdatj

EXCEPTIONS

input_false = 1

t009_notfound = 2

t009b_notfound = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

lc_poper = ln_poper.

CONCATENATE ln_bdatj lc_poper+1(2) INTO wa_e_t_range-low.

wa_e_t_range-sign = 'I'.

wa_e_t_range-opt = 'EQ'.

APPEND wa_e_t_range TO e_t_range.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

*******************************************************

I believe I should now use the above code in my customer exit variable. If that's right can you please explain me the steps as to how should I do this so that the variable gets populated.

Thank you.

Regards,

TR.