cancel
Showing results for 
Search instead for 
Did you mean: 

code for customer exit variable in sap bi report ?

former_member182467
Participant
0 Kudos

Hi,

I need to use a customer exit variable reading from a custom table, from a list of values. That is instead of giving the value in the global filter selection of a query, we need to use a customer exit to read from a custom variable and execute the report only for those values in the table.

I have searched and could not find any doc for the same. Can any abap/bi expert, please provide me a link or code to use for the customer exit variable. Hope I am clear.

Please let me know if you need more details.

thank you

DR

Accepted Solutions (0)

Answers (1)

Answers (1)

BenedictV
Active Contributor
0 Kudos

Hello Daniel,

If I get it right, you want to restrict an infoobject with values from a 'Z' table right? Cant you define a customer exit variable and read the table for values during 'i_step = 1'.

Please let us know why this will not work for you.

former_member182467
Participant
0 Kudos

Hi Benedict,

You got it right. As I have few reports which need this value and should not show all the values, Need to do it through a customer exit as exclude option in the global filter will degrade the query performance.

I don't know abap, can you please update the code for the same. Consider ZVAR is the table entry, and now what code should I write in CMOD to fetch the required values from the ztable with the zvar field.

Thanks again for the reply.

Cheers

DR

BenedictV
Active Contributor
0 Kudos

Hi Daniel,

Explicit code sharing is not encouraged or allowed in SCN. You can find lots of documents here in SCN for BEx variable customer exit code.

May I ask what is the selection criteria you apply on ZVAR table?

former_member182467
Participant
0 Kudos

Hi Benedict,

I could find code for customer exit but not for this scenario. There is no input selection criteria which is related to this, but just the year and plant. This variable is for PO doc type. If the user select the year and the plant, he need to see a set of values related to the doc type and these set of doc type's are given in the ztable in zvar= a, zvar= b, zvar= c etc.

I need to get only the PO's with these doc type's given in the ztable. But the user entry will not be dependent or selected during the input variable entry.

My doubt is should the code be written in step 1 or step 2, as there is no relation to the input entered by the user.

I_STEP = 1 is used when ther is need of default value in input parameter. This parameter may or may not be INPUT type and mandatory or Optional and Processing type must be Customer Exit.

I_STEP = 2 is when there is need of calculating the value of variable by the value of another variable. The second variable Processing type Customer Exit, Not ready for input and mandatory.

thank you

DR

former_member182467
Participant
0 Kudos

I think I should write the code in i_step = 2 ,because the customer exit should execute after the user entry variable selection is done.

that is after the user enter the year or what ever then the customer exit should trigger, ..though the user is not entering any value related for this customer exit, its just other char selection in the query. why do we need to write in i_step = 1, as before selecting the variable entry. should it be 1 or 2.

Please advice.

PFB

BenedictV
Active Contributor
0 Kudos

Hi Daniel,

You should write your code in i_step 2. But, the user will not be able to make further selections from the populated values for ZVAR. Is that ok?

Right now I do not have access to a BW system, so I cannot help you with the exact structure and variable names where you can access the values for year and plant that the user selects.

But your idea is right. In i_step 2 you get the values for the year and plant from the other variables and then do a selection on the z table.

former_member182467
Participant
0 Kudos

Thank You Benedict,

As I understand, we will be able to write the customer exit for the IOBJ where we need the selection from the ztable, irrespective if this IOBJ is used in the input selection or not. Am I right ?

Because in which ever document I search, the user exit is mainly written on the IOBJ which is used in the user entry selection or indirectly dependent on the user input selection. For example, if user enter's posting date/date etc in the user entry screen, the user exit will be dependent on this field, where the last day of the quarter or beginning of the month/year etc are being written.....so I got a doubt, if the user exit can be written on any IOBJ which is no way related the user input of the query.

Is my understanding correct ? I do not want any help with the exact structure and variable names where you can access the values for year and plant that the user selects. I just need to variable/example for the customer exit code which I need to write on the IOBJ which is used for lookup on the ztable ? Can you help me with that ? Please advice.

Thanks again for your reply. that helps.

Cheers

DR

BenedictV
Active Contributor
0 Kudos

Hi Daniel,

Your first statement is true. You need a variable on this IOBJ, but you do not need to have it as a user selection.

On the variable creation 'Details' tab, you can un-check the box 'Variable is ready for input'. This would make the variable not appear in the user selection screen.

former_member182467
Participant
0 Kudos

Thanks Benedict, but I am confused with the step = 2 option got it from a link, which says as

I_STEP = 1 is used when ther is need of default value in input parameter. This parameter may or may not be INPUT type and mandatory or Optional and Processing type must be Customer Exit.

I_STEP = 2 is when there is need of calculating the value of variable by the value of another variable. The second variable Processing type Customer Exit, Not ready for input and mandatory.


In this case, step= 2 saying that it need to be calculated on the base of another value. but we dont have any base or any variable depending on it as user will not enter any doc type selection and we dont have any base as plant/year is the only input given by the user and none of these are dependent on doc type. In that case, technically it should be written in step = 1. Please advice. I am confused :


Thank You

DR

BenedictV
Active Contributor
0 Kudos

In your code you need the values for plant and year that the user initially selects right? You cannot get them in i_step 1 before the input screen. Hence i_step 2. How you get the plant and year value in your code is what I said I cant help with earlier, since I do not have access to a BW system to look it up and guide you.

BTW, if you found any of my previous answers helpful, please mark them so.

former_member182467
Participant
0 Kudos

Plant and year will be direct selection from the MP. There is no customer exit here. Its just a direct input variable which will fetch values from the MP. Why can't I get them in i_step 1, as the sdn says, This parameter may or may not be INPUT type and mandatory or Optional and Processing type must be Customer Exit....so here in our case, its not the input type because customer will not enter doc type as input, and the 2nd condition is optional, which is correct as user will not enter it, and processing type is customer exit.


where as in step= 2, there is need of calculating the value of variable by the value of another variable....we do not have any base variable base to calculate or fetch the values from the ztable.....so this will be incorrect....as we are just fetching the values for already given values in the ztable and we don't need any base to fetch the values based on any input variable/value by the user.


How will it be step = 2 ? I will award you points after the correct resolution as it will be assumed answered, if I mark anything as correct. Dont worry about that.

thank you

DR

BenedictV
Active Contributor
0 Kudos

Hello Daniel,

If I understand right.

When a report is opened,

1. Customer exit code for i_step = 1 will be executed before the variable entry screen is popped up.In      your case you do not have any code here.

Then,

2. The user will enter a plant and year in the input variable and execute (eg. 1001 and 2016)

Then,

3. Customer exit code for i_step = 2 will be executed

     Here, we need to get the values for plant and year entered earlier and make a selection on      ZTABLE to get the document types.

     e.g. select doc_type from ZTABLE where plant = 1001 and year = 2016

     Populate the selected values in the e_t_range table