Show TOC

ExampleExample: Enhancements for Industry Sector and Industry System

 

This is an example of how to append fields to structures and how to create an implementation of the Business Add-In for the appended fields.

With the default BAdI implementation, the industry-sector information of an Organization cannot be included when business partners of type Organization are created. To bring in this information from the file to the BAdI method CREATE_BUSINESS_PARTNESR, perform the following activities:

  1. Attach an Append to the dictionary structure CRMT_MKTLIST_ORG_EXT (via Transaction SE11).

    For more information on the Append method, see the SAP Help Portal under help.sap.com   mySAP Business Suite   SAP Learning Solution   Choose Language   SAP Library   mySAP Technology Components   SAP Web Application Server   ABAP Workbench (BC-DWB)   BC-ABAP Dictionary   Tables   Append Structures  .

    This Append structure contains a field for the industry sector and possibly one additional field for the industry system.

  2. You must decide at this point whether you want to provide both fields for the mapping or whether only the industry sector should be provided for the mapping, while the industry system set in the source code.

    The BAPI BAPI_INDUSTRYSECTOR_ADD, which is used to add this information while business partners are created, requires both sets of information: industry-sector and industry-system. Use the data element BU_IND_SECTOR for the industry sector and the data element BU_ISTYPE for the possible industry system. Behind these data elements exist domains with value tables. The values from these tables are provided during the mapping format definition, if you carry out a value mapping.

  3. Save and activate CRMT_MKTLIST_ORG_EXT.

    Now, the fields for the industry sector or the fields for the industry sector and the industry system are available in the mapping.

  4. Next, you must create an own implementation for the Business Add-In CRM_MKTLIST_BADI.

    For more information on the Append method, see the SAP Help Portal under help.sap.com   mySAP Business Suite   SAP Learning Solution   choose Language   SAP Library   mySAP Technology Components   SAP Web Application Server   ABAP Workbench (BC-DWB)   Changing the SAP Standard (BC)   Business Add-Ins  .

  5. Copy the source code from the default implementation.

  6. Copy all additional private methods along with the source code in these methods.

  7. Now change the source code in your BAdI implementation.

    In the method CREATE_ORGANIZATION, you can call the BAPI BAPI_INDUSTRYSECTOR_ADD between block 2 (Add External ID) and block 3 (Add / Update Classification data).

    Here you must pass the industry sector and the industry system. The fields of your Append are contained in structure WA_CC_ORG. In the example code below, it is assumed that the industry sector and the industry system are fields of the Append structure:

    * Check for errors

    LOOP AT et_return TRANSPORTING NO FIELDS WHERE type CA 'AEX' .

    * Errors occured while adding identification

    RETURN. " leave method

    ENDLOOP.

    ENDIF.

    >>>>>>>>>>>>>> BEGIN INSERT

    *--------------------------------*

    * Add Industry Sector

    *--------------------------------*

    CALL FUNCTION 'BAPI_INDUSTRYSECTOR_ADD'

    EXPORTING

    businesspartner = ev_bp_org

    industrysectorkeysystem = wa_cc_org-z_ind_sector_key

    industrysector = wa_cc_org-z_ind_sector

    defaultindustry = 'X'

    TABLES

    return = lt_error.

    * Fill return messages for insertion into error cache

    wa_error-parameter = iv_c_head_guid.

    MODIFY lt_error FROM wa_error TRANSPORTING parameter

    WHERE id NE ' '.

    APPEND LINES OF lt_error TO et_return.

    REFRESH lt_error.

    * Check for errors

    LOOP AT et_return TRANSPORTING NO FIELDS WHERE type CA 'AEX' .

    * Errors occured while creating organization

    RETURN. " leave method

    ENDLOOP.

    >>>>>>>>>>>>>>>>>> END INSERT

    *--------------------------------*

    * 3.Add / Update Classification data

    ..*--------------------------------*

  8. Finally, activate the source code and your BAdI implementation. Now you can create a mapping format which could include the industry sector, and possibly the industry system, as mapping fields.

More Information

For more information about target fields to which the external data can be mapped, see Mapping Fields.