6 Replies Latest reply: Apr 18, 2006 4:01 PM by François Henrotte RSS

Implementing BADI to read the Customer defined Filter Values

Suresh Babu Mannem
Currently Being Moderated

Dear All

 

We are posting Payroll results to FI by ALE. We are using here BAPI-ALE interface methods to post the payroll results. In this process we got a requirement to filter the information by G/L account. But G/L account is not a Standard filter, so we created G/L account filter. But as per the online help we need to implement the BADI to read the customer defined Filter values. In online they have given an example also.

 

But I am not able to figure it out where i need to write the code and in which BADI as i am very new to the BADI's.

 

 

Technical details are :

 

Object Name: AcctngEmplyeeExpnses

Object Type: BUS6004

Method        : Post

Function Module: BAPI_ACC_EMPLOYEE_EXP_POST

ALE Message Type: ACC_EMPLOYEE_EXP

 

Could any body help me out in this problem?

 

Regards

Suresh B Mannem

 

 

Message was edited by: Suresh Babu  Mannem

 

 

Could any body look in to the problem and pass on your comments? Thanks in Advance

 

 

Message was edited by: Suresh Babu  Mannem

 

  • Re: Implementing BADI to read the Customer defined Filter Values
    Christian Wohlfahrt
    Currently Being Moderated

    Hi Suresh!

     

    You can implement BADIs with transaction SE19 - but with your given information I couldn't find the BADI (only the BAPI and business object).

     

    But if you have already an example, you should be able to find your BADI. Transaction to search BADIs: SE18 (here you look at all the definitions, in SE19 you add you specail coding).

     

    Regards,

    Christian

    • Re: Implementing BADI to read the Customer defined Filter Values
      Suresh Babu Mannem
      Currently Being Moderated

      Hi Christian

       

      Thanks for the reply. In online help they have given general example how to read customer defined filter values.

       

      But i am not able to find out the BADI in my program..

       

      The Tcode i am executing is PCP0 My program name is RPCIPP00.

       

      So can you give any idea how to find that BADI?

      or how can i call my own BADI method in SAP application Program?

       

      The sample program which they have given in online is :

       

      So please can some body help me out in this problem?

       

       

      data declaration

       

      Filter Object Types Are Not Known at Runtime

      data: filterobj_values like bdi_fobj occurs 0,

      filterobj_types like bdi_fobjtype occurs 0,

      bapi_logsys like bdi_logsys occurs 0.

       

      constants:

      c_objtype_plant type c value ‘WERKS’,

      c_objtype_langu type c value ‘SPRAS’.

       

      • get filterobjects from ALE distribution model

       

      call function ‘ALE_BAPI_GET_FILTEROBJECTS’

      exporting

      object = ‘BUS1001’

      method = ‘REPLICATEDATA’

      tables

      filterobjects = filterobj_types

      exceptions

      error_in_ale_customizing = 1.

       

      • fill filterobject values into table

       

      loop at filterobj_types.

      case filterobj_values-objtype.

      when c_objtype_plant.

      filterobj_values-objtype = c_objtype_plant.

      filterobj_values-objvalue = ‘0002’.

      when c_objtype_langu.

      filterobj_values-objtype = c_objtype_langu.

      filterobj_values-objvalue = ‘D’.

      when others.

      endcase.

      append filterobj_values.

      endloop.

       

      • get receiver from ALE distribution model

       

      call function ‘ALE_ASYNC_BAPI_GET_RECEIVER’

      exporting

      object = ‘BUS1001’

      method = ‘REPLICATEDATA’

      tables

      receivers = bapi_logsys

      filterobject_values = filterobj_values

      exceptions

      error_in_filterobjects = 1

      error_in_ale_customizing = 2.

       

      • call generated ALE interface function module

       

      if sy-subrc <> 0.

      if not bapi_logsys[] is initial.

      call function ‘ALE_MATERIAL_REPLICATE_DATA’

      tables

      receivers = bapi_logsys

      ...

      commit work.

      endif.

      endif.

      Receiver determination with business add-in

      Form routine implemented by SAP

      *----


       

      • FORM ALE_BFA_TEST_RECEIVERS

      *----


       

      FORM ale_bfa_test_receivers TABLES receivers STRUCTURE bdi_logsys

      USING object TYPE swo_objtyp

      method TYPE swo_method

      key1 LIKE tbbfatest-key1

      key2 LIKE tbbfatest-key2

      return_info LIKE syst.

      • key1 and key2 are parameters regarding receiver determination

      • 2 filter object types were defined by SAP:

      • TEST_KEY1

      • TEST_KEY2

       

      • variables definition

      DATA: w_filter_object_type TYPE bdi_flttyp,

      t_filter_object_type TYPE bdi_flttyp_tab,

      w_filter_object_value TYPE bdi_fobj,

      t_filter_object_value TYPE bdi_fobj_tab,

      receivers_output LIKE bdi_logsys OCCURS 0 WITH HEADER LINE.

      CLASS: cl_ex_customer_filter DEFINITION LOAD.

      DATA: my_exit TYPE REF TO if_ex_customer_filter.

      *> Step 1) get filter object types for a BAPI

      CALL FUNCTION 'ALE_BAPI_GET_FILTEROBJECTS'

      EXPORTING

      object = object

      method = method

      TABLES

      receiver_input = receivers

      filterobjects = t_filter_object_type

      EXCEPTIONS

      error_in_ale_customizing = 1

      OTHERS = 2.

      IF sy-subrc <> 0.

      return_info = syst.

      EXIT.

      ENDIF.

       

      *> Step 2) evaluate SAP filter objects

      LOOP AT t_filter_object_type INTO w_filter_object_type.

      CASE w_filter_object_type-objtype.

      • evaluate delivered filter objects

      WHEN 'TEST_KEY1'.

      MOVE-CORRESPONDING w_filter_object_type

      TO w_filter_object_value.

      w_filter_object_value-objvalue = key1.

      APPEND w_filter_object_value TO t_filter_object_value.

      WHEN 'TEST_KEY2'.

      MOVE-CORRESPONDING w_filter_object_type

      TO w_filter_object_value.

      w_filter_object_value-objvalue = key2.

      APPEND w_filter_object_value TO t_filter_object_value.

      • customers defined filter objects

      WHEN OTHERS.

      ENDCASE.

      ENDLOOP.

      *> Step 3) evaluate customer-defined filter objects

      CREATE OBJECT my_exit TYPE cl_ex_customer_filter.

      CALL METHOD my_exit->filtering

      EXPORTING

      object = object

      method = method

      key1 = key1

      key2 = key2

      filterobjtype = t_filter_object_type

      CHANGING

      filterobjvalue = t_filter_object_value.

      *> Step 4) determine receivers for all filter objects

      CALL FUNCTION 'ALE_ASYNC_BAPI_GET_RECEIVER'

      EXPORTING

      object = object

      method = method

      TABLES

      receiver_input = receivers

      receivers = receivers_output

      filterobject_values = t_filter_object_value

      EXCEPTIONS

      error_in_filterobjects = 1

      error_in_ale_customizing = 2

      OTHERS = 3.

      IF sy-subrc <> 0.

      return_info = syst.

      EXIT.

      ENDIF.

      receivers[] = receivers_output[].

      ENDFORM.

       

      Methods Implemented by Customers

      • The following method was implemented by a customer with

      • Business Add-In

      • 1 filter object type was defined by customer:

      • ZTEST_KEYS

       

      METHOD if_ex_customer_filter~filtering.

      • ...

      DATA: w_filterobjtype TYPE bdi_flttyp,

      w_filterobjvalue TYPE bdi_fobj.

      LOOP AT filterobjtype INTO w_filterobjtype.

      CASE w_filterobjtype-objtype.

      WHEN 'ZTEST_KEYS'.

      MOVE-CORRESPONDING w_filterobjtype TO w_filterobjvalue.

      w_filterobjvalue-objvalue+0(3) = key1.

      w_filterobjvalue-objvalue+3(3) = key2.

      APPEND w_filterobjvalue TO filterobjvalue.

      WHEN OTHERS.

      ENDCASE.

      ENDLOOP.

      ENDMETHOD.

       

      #

       

      Filter Object Types are Known at Runtime

      • data declaration

       

      data: filterobj_values like bdi_fobj occurs 0,

      filterobj_types like bdi_fobjtype occurs 0,

      bapi_logsys like bdi_logsys occurs 0.

       

      filterobj_values-objtype = ‘KKBER’.

      filterobj_values-objvalue = ‘0002’.

      append filterobj_values.

       

      • get receiver from ALE distribution model

       

      call function ‘ALE_ASYNC_BAPI_GET_RECEIVER’

      exporting

      object = ‘BUS1010’

      method = ‘REPLICATESTATUS’

      tables

      receivers = bapi_logsys

      filterobject_values = filterobj_values

      exceptions

      error_in_filterobjects = 1

      error_in_ale_customizing = 2.

       

      • call generated ALE interface function module

       

      if sy-subrc <> 0.

      if not bapi_logsys[] is initial.

      call function ‘ALE_DEBITOR_CREDITACC_REPLICATESTATUS’

      tables

      receivers = bapi_logsys

      ...

      commit work.

      endif.

      endif.

       

       

      Message was edited by: Suresh Babu  Mannem

       

  • Re: Implementing BADI to read the Customer defined Filter Values
    Serdar Simsekler
    Currently Being Moderated

    Hi Suresh

     

    As directed to this thread :):

     

    Filtering is adjusted via the relevant screen tab at the implementation transaction (SE19). Did you see the relevant part where you enable filtering and insert filter values?

     

    BTW, please assign points to post which you find helpful using the scala on the left of each post. By assigning a 10-points or choosing "Solved by my own" at the left of your original post you can close the thread which saves SDNers' time.

     

    Regards

     

    *--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

Actions