Spend Management Blogs by Members
Check out community member blog posts about spend management and SAP Ariba, SAP Fieldglass, and SAP Concur solutions. Post or comment about your experiences.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
3,301

This blog will give an overview of moving standard ECC fields such as rev level , military indicator etc   to SRM (  as custom fields ) .

1.Configuration in ECC for triggering the SRM MIDDLEWARE download of data

  Configuration Tables TBE24 and TPS34 in ECC must be maintained for triggering the SRM Middleware download of data from ECC to SRM. In Table TPS34 the           Process CRM0_200 contains the entry for SRM Middleware download of data.

     Activate Customer Product by maintaining table TBE24 using transaction SM30

Add the function module that the OPEN_FI function module can find for a Business Transaction Event (BTE) as an alternative to a standard function module by maintaining table TPS34 using transaction SM30




Create Function module for mapping

Function Module Z_CUSTOMAEOI handles mapping the custom fields to be transferred to the SRM system.

Sample code:

TYPES: BEGIN OF ty_aeoi,

             revlv TYPE cc_revlv,

             andat TYPE cc_andat,

          END OF ty_aeoi.

   DATA  loc_objkt      TYPE aeobjekt.

   DATA: loc_revlv      TYPE cc_revlv,

         int_aeoi       TYPE TABLE OF ty_aeoi,

         fs_aeoi        TYPE ty_aeoi.

   FIELD-SYMBOLS: <fs_mara>    TYPE mara.

   CONSTANTS: wl_material      TYPE  obj_name  VALUE 'MATERIAL',

              wl_mara          TYPE  tabname   VALUE 'MARA',

              wl_zsr_addldata  TYPE  strng250  VALUE 'ZSR_ADDLDATA',

              wl_41            TYPE  aetyp     VALUE '41'.

   CASE i_obj_name.

     WHEN wl_material.

       LOOP AT t_int_tables WHERE tabname = wl_mara.

         ASSIGN t_int_tables-data TO <fs_mara> CASTING.

         loc_objkt = <fs_mara>-matnr.

         SELECT aeoi~revlv aenr~datuv

            INTO TABLE int_aeoi

           FROM aeoi

           INNER JOIN aenr

           ON aeoi~aennr = aenr~aennr

           WHERE aeoi~aetyp = wl_41

            AND aeoi~objkt = loc_objkt

            AND aeoi~revlv NE space.

         IF sy-subrc = 0.

           SORT int_aeoi BY andat DESCENDING.

           READ TABLE int_aeoi INTO fs_aeoi INDEX 1.

           loc_revlv = fs_aeoi-revlv.

         ENDIF.

         IF <fs_mara> IS ASSIGNED.

           t_other_info-field1       = wl_zsr_addldata.

           t_other_info-field2       = <fs_mara>-matnr.

           t_other_info-field3       = loc_revlv.

           APPEND t_other_info.

         ENDIF.

       ENDLOOP.

   ENDCASE.

Configuration in CRM for triggering the CRM Middleware download of data

  1. Create a SETTYPE in Tcode COMM_ATTRSET.

Name: ZSR_ADDLDATA

   2. Add material master custom fields as attributes.

Attribute Names:

ZDEPRDHA               Product Code

ZDEITARK                 Military Goods

ZDEREVLV               Revision Level

Include the set type ZSR_ADDLDATA in a transport request as give in the below screen shot.


  • Make sure the create API APPEND flag is set to generate the API methods by the system.

3. Create Implementation for BADI to update the custom fields of SRM with material master fields.

BADI Name: PRODUCT_CUSTOMER2

Implementation Name: ZNSRE_PRODUCT_CUST

Method: MAP_R3_TO_CRM_MATERIAL

This BADI is used to update the custom fields of a material master in SRM.

Sample code:

DATA:

         int_categories            TYPE comt_prod_cat_rel_tab,

         int_cat_settype_rel       TYPE comt_cat_frag_rel_tab,

         int_cat_settype_rel_all   TYPE comt_cat_frag_rel_tab,

         fs_other_info             TYPE bapiextc,

         fs_marc                   LIKE LINE OF it_marc,

         fs_cat_settype_rel        TYPE comt_cat_frag_rel,

         fs_settype                TYPE comt_settype_ext,

         fs_category               TYPE comt_prod_cat_rel,

         fs_category_bdoc          TYPE comt_prod_cat_rel_maintain,

         fs_zcustdata              TYPE zsr_addldata_maintain,

         loc_matnr                 TYPE strng250.

   CONSTANTS: wl_zsr_addldata      TYPE  comt_frgtype_id       VALUE 'ZSR_ADDLDATA',

              wl_0000000000        TYPE  comt_pr_key_type      VALUE '0000000000'.

   CALL FUNCTION 'COM_PROD_CAT_REL_READ_WITH_PR'

     EXPORTING

       iv_product_guid  = cs_product_bdoc-header-com_product-product_guid

       iv_update_buffer = space

     IMPORTING

       et_set           = int_categories.

   LOOP AT cs_product_bdoc-header-categories INTO fs_category_bdoc.

     MOVE-CORRESPONDING fs_category_bdoc-data TO fs_category.

     READ TABLE int_categories WITH KEY hierarchy_guid = fs_category-hierarchy_guid TRANSPORTING NO FIELDS.

     IF sy-subrc = 0.

       MODIFY int_categories FROM fs_category INDEX sy-tabix.

     ELSE.

       APPEND fs_category TO int_categories.

     ENDIF.

   ENDLOOP.

   LOOP AT int_categories INTO fs_category.

     CALL FUNCTION 'COM_CAT_FRAG_REL_READ'

       EXPORTING

         iv_category_guid = fs_category-category_guid

       IMPORTING

         et_cat_frag_rel  = int_cat_settype_rel

       EXCEPTIONS

         wrong_call       = 1

         OTHERS           = 2.

     IF sy-subrc = 0.

       APPEND LINES OF int_cat_settype_rel TO int_cat_settype_rel_all.

     ENDIF.

   ENDLOOP.

   DELETE ADJACENT DUPLICATES FROM int_cat_settype_rel_all.

   LOOP AT int_cat_settype_rel_all INTO fs_cat_settype_rel.

     CALL FUNCTION 'COM_SETTYPE_READ_SINGLE'

       EXPORTING

         iv_settype_guid  = fs_cat_settype_rel-frgtype_guid

       IMPORTING

         es_settype       = fs_settype

       EXCEPTIONS

         not_found        = 1

         no_import_values = 2

         no_text_found    = 3

         OTHERS           = 4.

     IF sy-subrc <> 0.

* Implement suitable error handling here

     ENDIF.

     CASE fs_settype-frgtype_id.

       WHEN wl_zsr_addldata.

         SELECT SINGLE guid

           INTO fs_zcustdata-relation-key_guid

           FROM mdm_pr0000000000

           WHERE key_type = wl_0000000000.

         fs_zcustdata-relation-owner    = zcl_constants=>gc_x.

         fs_zcustdata-relation-logsys   = cs_product_bdoc-header-com_product-logsys.

         fs_zcustdata-data-frg_guid     = fs_settype-frgtype_guid.

         fs_zcustdata-data-zz0010       = is_mara-prod_hier.

         fs_zcustdata-data_x-zz0010     = zcl_constants=>gc_x.

*       update the military flag for the material

         READ TABLE it_marc INTO fs_marc WITH KEY material = is_mara-material milit_id = zcl_constants=>gc_x.

         IF sy-subrc = 0.

           fs_zcustdata-data-zz0011     = zcl_constants=>gc_x.

           fs_zcustdata-data_x-zz0011   = zcl_constants=>gc_x.

         ELSE.

           fs_zcustdata-data-zz0011     = space.

           fs_zcustdata-data_x-zz0011   = zcl_constants=>gc_x.

         ENDIF.

*       Update Revision level for the material

         loc_matnr = is_mara-material.

         READ TABLE it_other_info INTO fs_other_info WITH KEY field1 = wl_zsr_addldata

                                                              field2 = loc_matnr.

         IF sy-subrc = 0.

           fs_zcustdata-data-zz0012     = fs_other_info-field3+0(2).

           fs_zcustdata-data_x-zz0012   = zcl_constants=>gc_x.

         ENDIF.

         APPEND fs_zcustdata TO cs_product_bdoc-data-zsr_addldata.

         APPEND fs_settype-frgtype_id TO cs_product_bdoc-data-mnt_settype.

     ENDCASE.

   ENDLOOP.

Please feel free to comment or ask questions and as usual I shall try my best to answer them.

Naveen



1 Comment
Top kudoed authors