You are on page 1of 4

Hi This badi is using the filter concept. For example the company having business a cross the world.

He need calculate the Tax rates based on sales organization lev el.Make the badi as filter dependent and added the VKORG in Filter text box. Simple Badi using Filters: This Example explains how to implement BADIs with Filter Types. Follow the steps to complete the work. ? Go to T.Code SE18 ? Create BADI Definiton ZBADI_FILTER & enter Short Text and save. ? Check both Multiple use and Filter-Depend ? Add VKORG in the filter text box. What ever we enter in Filter text box is a data element and that data element ha ving search help. ? Click on Interface tab and double click on interface name ? Click on methods tab add instance method GET_VKORG with 2 parameters FLT_VAL Import Type VKORG ZTAX_RATE Changing Type STRING ? Save, check and activate the interface & back Now Creating Implementation of the above BADI ? Go to T. Code SE19 ? Give Implementation name as ZBADI_FILTER_IMPL & click on create ? Give the Definition name as ZBADI_FILTER & continue ? Give short text and save ? You can find Defined filters section at the bottom of the screen ? Click on + Symbol and maintain input values for filter type ? Click on interface tab and double click on the implementation class name. ? Provide the functionality to the GET_VKORG method. ? Write the following code for the method. If it is helpful rewards points. Regards Pratap.M method ZIF_EX_BADI_FILTER~GET_VKORG . if flt_val = '0001'. ztax_rate = '15'. elseif flt_val = '1000'. ztax_rate = '20'. ? Save, check & back ? Save, check and activate the class & back ? Save & activate the BADI Implementation

Now write a Report program to call the BADI Implementation. data: tax_rate type string. parameters p_VKORG like TVKO-VKORG. start-of-selection. data: l_badi_inst type ref to ZIF_EX_BADI_FILTER. CALL METHOD CL_EXITHANDLER=>GET_INSTANCE EXPORTING EXIT_NAME = 'ZBADI_FILTER' CHANGING INSTANCE = l_badi_inst EXCEPTIONS NO_REFERENCE = 1 NO_INTERFACE_REFERENCE = 2 NO_EXIT_INTERFACE = 3 CLASS_NOT_IMPLEMENT_INTERFACE = 4 SINGLE_EXIT_MULTIPLY_ACTIVE = 5 CAST_ERROR = 6 EXIT_NOT_EXISTING = 7 DATA_INCONS_IN_EXIT_MANAGEM = 8 others = 9. IF SY-SUBRC 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. else. call method l_badi_inst->get_VKORG EXPORTING flt_val = p_VKORG CHANGING ztax_rate = tax_rate. if tax_rate is initial. write:/ 'Tax rate not returned for sales org:', p_vkorg. else. write:/ 'Tax Rate for Sales Org ', p_vkorg, 'is:', tax_rate. endif. endif. endif. endmethod Guest Re: Filter Badi's Posted: Mar 5, 2008 10:02 AM in response to: rajesh nimakuri in response to: r ajesh nimakuri Click to report abuse... Click to reply to this thread Reply Hi, Implement the BADI - BBP_WF_LIST using SE18 Transaction for the filter type - BUS2203 for doing this job. Here is the documetation of this BADI BBP_WF_LIST BADI code ____________________________________________________ Short Text Displa y Worklists and Search Results Lists With the Business Add-In BBP_WF_LIST , you can tailor the display of worklists and search results lists for purchase order documents (and Sourcing applications) in SRM Server according to your own criter ia. Standard settings The following methods are available: BBP_WF_LIST for purch asing documents BBP_WF_LIST_SOCO for the Sourcing application In the standard ve rsion, the following differences exist between the display of worklists and sear

ch results lists: Normal employees see only their own requirements and documents The purchaser's worklist in Sourcing and in the application for processing purc hase orders is dependent on assignment to an organizational unit. The goods reci pient and invoicing party can find all purchase orders, confirmations, and invoi ces. As standard, the system sorts the purchasing documents in ascending order b y the last date of processing. To distinguish between the worklists and search r esults lists of the SRM Server applications, the BAdI is implemented dependent o n the following filters: BUS2201 Filter value for the worklist in purchase order processing in SAP Enterprise Buyer BUS2203 Filter value for the worklist in con firmation processing in SAP Enterprise Buyer BUS2205 Filter value for the search results list in invoice processing in SAP Enterprise Buyer BUS2121 Filter value for the worklist in shopping cart status check in SAP Enterprise Buyer BUS2200 Filter value for the search results list in bid invitation processing in SAP Bid ding Engine BUS2202 Filter value for the search results list in bid processing i n SAP Bidding Engine BUS2000113 Filter value for the search results list in cont ract processing in SAP Enterprise Buyer Activities Implement and activate the BA dI if you wish to adapt worklists and search results lists. Note that the filter value Object type (field OBJECT_TYPE) determines for which application the BAdI implementation is active. Example Using the BadI BBP_WF_LIST you can sort the w orklist by document number, for example, or remove documents belonging to a part icular user from the worklist. The implementation of the BadI using Business obj ect type BUS2205 allows you to change the list of invoices and the purchase orde rs associated with these invoices independently of one another. For example, you could sort the purchase orders by purchase order number and the invoices by the name of the user who created them. You can exclude bid invitations from a certa in product category, for example, from the purchaser's search results list in SA P Bidding Engine. You can exclude contracts from a certain purchasing organizati on or purchasing group, for example, from the purchaser's search results list in SAP Enterprise Buyer. Further notes If the BadI is used for confirmations and p urchase orders, it always accesses the list of the actual document and its purch ase orders. The purchaser's worklist contains only requirements that, according to Customizing, are to be processed in the Sourcing application. See the IMG act ivity Define Sourcing for Product Categories. -------------------------------- C hange Output List Purchasing Documents Functionality With method BBP_WF_LIST in SAP Enterprise Buyer, you can adapt the display list of the worklist for purchas ing documents and search results lists according to your own criteria. Parameter s Importing FLT_VAL Filter value I_PDLIST_NEW Entry list of worklist or the sear ch results list and additional information Changing E_PDLIST Output list of work list or the search results list (contains only GUIDs)[/code] And Here is the sam ple Code for the BADI Implementation... codeMETHOD if_ex_bbp_wf_list~bbp_wf_list . DATA: t_header_guids TYPE TABLE OF bbp_guid_tab, t_pdlist TYPE TABLE OF bbp_pd s_pdlist, t_messages TYPE TABLE OF bbp_pds_messages, t_sc_guids TYPE TABLE OF bb p_guid_tab, t_ref_doc TYPE TABLE OF bbps_sc_refdata, t_itemlist TYPE TABLE OF bb p_pds_sc_itemlist, t_conf_pdlist TYPE TABLE OF bbp_pds_pdlist. DATA: wa_sc_guids TYPE bbp_guid_tab, wa_pdlist TYPE bbp_pds_pdlist, wa_ref_doc TYPE bbps_sc_refda ta, wa_itemlist TYPE bbp_pds_sc_itemlist, wa_conf_pdlist TYPE bbp_pds_pdlist. IF sy-tcode EQ 'BBPCF02'. First Get all the Reference documents Get all the Shoppi ng Carts CALL FUNCTION 'BBP_PD_SC_GETLIST' TABLES i_header_guids = t_header_guid s e_pdlist = t_pdlist e_messages = t_messages. Sort the SC based on SC number SO RT t_pdlist BY object_id. Get all the Header Guids LOOP AT t_pdlist INTO wa_pdli st. wa_sc_guids-guid = wa_pdlist-guid. APPEND wa_sc_guids TO t_sc_guids. ENDLOOP . Get all the Reference Document for the Header Guids CALL FUNCTION 'BBP_PD_SC_R EF_GETLIST' EXPORTING i_item_not_deleted = 'X' TABLES it_header_guids = t_sc_gui ds et_refdata = t_ref_doc it_logical_systems = 'R3BACKENDSYSTEM' -> Give he R/3 backend system RFC Destination name here EXCEPTIONS nothing_found = 1 OTHERS = 2 . Retain only the PO (Business Object 2012) DELETE t_ref_doc WHERE ( be_object_t ype NE 'BUS2012' AND be_object_type NE 'BUS2012001' ). Sort all reference docume nts based on be_object_id - Purchase Order numbers. SORT t_ref_doc BY be_object_ id. Loop on all remaianing POs Use SC Guid (Header) LOOP AT t_ref_doc INTO wa_re f_doc. DELETE e_pdlist WHERE object_id = wa_ref_doc-be_object_id. ENDLOOP. Here

make a call to the R/3 system by using your RFC Function module and update e_pdl ist [] table which finally will contain all the detialed confirmations starting with Document type - "EB" based on the document type "ECDP" and "ECPO" - Add one more document type "EB" .. so when ever BBPCF02 is called in ITS it should disp ly the POs which are based on document types as "ECDP" "ECPO" and "EB". ELSEIF s y-tcode EQ 'BBPCF03'. " Display All PO/Confirmations Similar code as above ENDIF . "if sy-tcode eq 'BBPCF02'. ENDMETHOD.[/code] Hope this will help. with regards , sowjanyagosala,.

You might also like