04-05-2006 6:35 PM
Hi all,
I am working in CRM. I am trying to analyze some BAPI programs.
Here the definition name of the BAPI impemented is EXEC_METHODCALL_PPF.
Here I am checking that description field must not be empty. To do this as far I know the field must be accessed in the method -endmethod. But in the program I am analyzing simple message is given and the BADI is triggered when the description field is empty.
Here is the following code.
method IF_EX_EXEC_METHODCALL_PPF~EXECUTE .
message W208(00) with 'Enter a value for Description'.
endmethod.
Can anyone explain me how the BADI is triggered ? And also how the fields of the tcode are accessed in the BADI.
Regards,
Varun.
Message was edited by: varun sonu
04-05-2006 7:32 PM
Varun,
The BADI's are nothing but user exits, triggered by the standard code.
If you look at the definition of the BADI(SE18), you can see the parameters of the method. These are the parameters that will be accessible inside the code.
You can write your own code in the method, by creating a new implementation for the BADI (SE19).
Regards,
Ravi
Note : Please mark the helpful answers.
04-05-2006 7:32 PM
Varun,
The BADI's are nothing but user exits, triggered by the standard code.
If you look at the definition of the BADI(SE18), you can see the parameters of the method. These are the parameters that will be accessible inside the code.
You can write your own code in the method, by creating a new implementation for the BADI (SE19).
Regards,
Ravi
Note : Please mark the helpful answers.
04-05-2006 7:37 PM
HI,
THis I am aware. My quoestion is suppose I am trying to enter a value for input field in a transaction and I want to make sure that this is not empty. For this in the BADI I shounf check something like this :
if <filed> is initial.
message.
endif. But with out checking the condition if I simply give the mesage statement how will it be triggered ?
Regards,
Varun.
04-05-2006 7:42 PM
Varun,
If you have to check the value of a input field, that field need to be a paramter of the method of the BADI. If yes, then its a straight forward case.
Else, we have work around. Find the name of the PROGRAM where that variable exists and see if you can access the same inside the BADI something like this.
field-symbols : <fs_any> type any.
assign (PROGRAM)variable to <fs_any>.
if <fs_any> is initial.
message.
endif.
Regards,
Ravi
Note : Please mark the helpful answers
04-05-2006 7:49 PM
Hi ,
How can we wether the field is the parameter of the method of BADI.
Regards,
Varun.
04-05-2006 7:53 PM
Varun,
Go to SE18, enter the BADI name and display the same.
You will find the name of the method, select that and hit the parameters button on the TOP. You will see the parameters of that method.
Alternatively, you can into the code of the method and in the toolbar, you can find a button called SIGNATURE. If you click on that, it will also the parameters of the method.
Regards,
Ravi
Note : Please mark the helpful answers
04-05-2006 8:12 PM
Hi Ravi,
A small doubt. If a filter has been defined can it be done in this manner ? Because a filter has been defined for the BADI implementation I am trying to analyze. If so can you explain me the concept of filter in BADI.
Regards,
Varun.
04-05-2006 8:18 PM
Varun,
Here is some info regarding the Filter dependent BADI's.
<b>Business Add-Ins may be implemented on the basis of a filter value. If an enhancement for country-specific versions is provided for in the standard version, it is likely that different partners will want to implement this enhancement. The individual countries can create and activate their own implementation.
Enter a filter type when defining your enhancement (a country or industry sector, for example). All methods created in the enhancement's interface have filter value FLT_VAL as their importing parameter. The application program provides the filter value for the enhancement method. The method then selects the active implementation for that value. </b>
Also, look at the following links for more info.
http://help.sap.com/saphelp_nw04/helpdata/en/97/90e24662d6d8478cf1f392108c5df0/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/eb/3e7cf7940e11d295df0000e82de14a/content.htm
But in this case, your accessing the value has nothing to do with filter as long as the BADI is firing. The filter will decide whether the BADI has to get executed or NOT.
Regards,
Ravi
Note : PLease mark the helpful answers
04-05-2006 8:27 PM
Hi Ravi,
Can you please explain me in more detail about the Filters in BADI. I went through the doc's in help.sap.com but I am not able to get the exact definition and use of these filters. I have a badi implemented with the some method specified in the define filters TAB. If I want to find the complete information about the filter what should I do ?
Note: I will surely award the points for you.
Regards,
Varun.
04-05-2006 8:33 PM
Varun,
As far as I understand this, its an IF condition at the BADI level. That means the BADI has to be executed only if the FILTER value is a specific one.
That means there will be an extra paramter which will decide whether the BADI code will have to execute or not
regards,
Ravi
04-05-2006 8:40 PM
well not exactly an IF but sort of IF..ELSEIF..ELSEIF...ENDIF. the filter dependency of a BAdI is very nicely explained <a href="http://help.sap.com/saphelp_47x200/helpdata/en/eb/3e7cf7940e11d295df0000e82de14a/frameset.htm">here</a>.
Regards,
Suresh Datti
04-05-2006 8:49 PM
Hi Suresh,
I have gone through the help.sap.com documentation but I can not figure out anything from that. Actually what I am trying to do is there is a BADI which has been implemented in many ways and I see each of them are triggered in a different situation. The only difference is the filter name in the implementation. I just want to know the detauils of the filter. Can you tell me how ?
I am trying to implement a BADI for two different situations. What should I specify in the filter tab each time I implemenmt a BADI.
Regards,
Varun.
Message was edited by: varun sonu
04-05-2006 8:57 PM
04-05-2006 9:01 PM
HI,
This is the BADI definition : EXEC_METHODCALL_PPF
This is in crm module.
REgards,
Varun.
Message was edited by: varun sonu
04-05-2006 9:14 PM
Hi Varun,
I haven't had a chance to work on CRM but... lets say your EXEC_METHODCALL_PPF is filter dependent & the implementaion has the filter values 1,2,3& 4.
then the methods in the implementation can have the following code..
case flt_val.
when '1'.
* do something
when '2'.
* do something else.
when '3'.
* do something else.
when '4'.
* do something else.
when others.
endcase.
Regards,
Suresh Datti
04-05-2006 9:24 PM
HI Suresh,
So far from all the answers I can not figure out anything. Can you please explain me in detail what a filter is and how it can be specified when I am trying to implement a badi ? Also say I am tryng to implement the same BADI 'n' times for different situations each time with a filter value how do I know which BADI is triggered ? Apart from specifying the name of the filter in the implementation of the BADI what else shlould I do ?
Regards,
Varun.
Regards,
Varun.
Message was edited by: varun sonu
04-05-2006 9:50 PM
>>> I just want to know the detauils of the filter. Can you tell me how ?
Didn't you say this BAdI was already implelemented? Go to SE19 & dsiplay the attributes of the implelmentation. On the Filter type field, there must be a value say 'ZFILTER'. Double click on it , it will take you to the Data Element; Double clikc on the Domain & it should take you the Domain; Click on the Value range tab & you either will see the Fixed values or the Value Table associated with the domain. So, this is where the filter values are maintained.
By making a BAdI filter dependent, you are actually telling it what to do under which condition.. I am at a loss what more you need to understand this process..
Just like a User Exit, the BAdI will also be called from inside some standard program. So this filter could be some scenario that will control how the program should handle this BAdI. When the BAdI gets triggered, the filter value is checked.. If the BAdI is delivered as filter dependent, then the program from where it is triggered will pass the filter value to the implementation. That is how the implementation will know what code to trigger.. for ex: this is how one program that has a filt dependent BAdI in it looks like..
* Create exit object
CALL METHOD cl_exithandler=>get_instance
CHANGING
instance = lr_exit.
* call BADI method: reverse own data concerning the notification
CATCH SYSTEM-EXCEPTIONS dynamic_call_method_errors = 1.
CALL METHOD lr_exit->(l_method)
EXPORTING
flt_val = p_scenario
notification_no = p_notification_no
IMPORTING
return = p_return
reversal_not_allowed = p_reversal_not_allowed.
ENDCATCH.
here lr_exit has the implementation name & p_scenario the filter value..
hope this helps..
Regards,
Suresh Datti
P.S. PL do not forget to reward all helpful answers
04-05-2006 10:06 PM
HI Suresh,
BY the way Suresh I missed the very first quoestion :
in this implementation I need to check that a field in the transactioon should be filled. To do that a badi has been implemented. But the developer has straight given the message with out checking the field value in the program . Even then the BADI is triggered . Can you explain how this is happening ?
I am forwarding the code too. :
<b>method IF_EX_EXEC_METHODCALL_PPF~EXECUTE .
message W208(00) with 'Please Enter the Complaint Description'.
endmethod.</b>
Thanks a lot for your answers and patience man. I am happy that I am able to understand a large about the concept of this BAPI filters. Sure I will award the points. One last quoestions : You have given me more than one answers. Should I award for each answer or once for all 10 points ?
Regards,
Varun.
Message was edited by: varun sonu
Message was edited by: varun sonu
04-05-2006 10:46 PM
Does the warning message appear when the field is empty? As the method doesn't have any check on the field value, it must be in the program where it is triggered. Were you able to figure out from where this BAdI is triggered?
About the points, it is purely your discretion & not mandatory.. the points are a way of appreciating the solution given/time spent by the people who respond...
Regards,
Suresh Datti