You are on page 1of 15

Add ECC Custom Fields in CRM

Web UI ERP Order Using Lean


Order Framework

Applies to:
SAP CRM7.0 SP06 or Higher
SAP ECC 6.0 with EhP4 with following activate switch
 SD_01
 LOG_SD_CI_01
 ESOA_OPS01
 LOG_SD_SIMP_02

Summary
This article is based on a customer specific requirement which I have undertaken on a project. It describes a
scenario where ERP custom fields are required in CRM Web UI to create Quotation/Order in ERP Order
scenario in SAP CRM.
The ERP order setup was done through LORD Lean Order Management, Web UI enhancement via AET and
BADI enhancement (for populating data in custom fields)
This article explains how the custom fields and BADI was implemented in configured in SAP CRM and ECC
step by step.

Author: Aditya Karkare


Company: Cognizant Technology Solutions
Created on: 21 March 2011

Author Bio
Aditya Karkare is an SAP Development Consultant working for Cognizant Technology Solution. He has 10
years of SAP experience which includes SAP ECC and SAP CRM. He has undertaken projects for
customers based in India, Germany, Belgium and USA.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 1
Add ECC Custom Fields in CRM Web UI ERP Order Using Lean Order Framework

Table of Contents
Requirement ....................................................................................................................................................... 3
Implementation Steps ......................................................................................................................................... 4
Enhance CRM UI component and add custom fields in CRM. ....................................................................... 4
Maintain Interface Communication in ECC ..................................................................................................... 6
Maintain mapping tables in ECC: .................................................................................................................... 8
BADI Implementation in ECC ........................................................................................................................ 10
Related Content ................................................................................................................................................ 14
Disclaimer and Liability Notice .......................................................................................................................... 15

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 2
Add ECC Custom Fields in CRM Web UI ERP Order Using Lean Order Framework

Requirement
Create ERP order from CRM using lean order management – LORD; to create any quotation/ order in ERP
few custom fields are mandatory in ECC. To achieve this, these custom fields are mandatory in ERP order
Web UI screen.
Additional custom fields required at header level and item level.
ERP order Web UI screen after enhancement in SAP CRM.

Lean Order Architect

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 3
Add ECC Custom Fields in CRM Web UI ERP Order Using Lean Order Framework

Implementation Steps
1. Enhance CRM UI component and add custom fields in CRM.
2. Maintain interface communication structure in ECC.
3. Maintain Mapping tables in ECC
4. Implement BADI ENH_SPOT_LORD in ECC
5. Enhance CRM Web UI screen using application enhancement tool.

Enhance CRM UI component and add custom fields in CRM.

Open ERP Quotation/Order Web UI Screen and Click on ‘Show Configuration Area’ button.

Double click on Header data, view configuration screen will come.


Select configuration which you want to enhance and click on ‘Create New Field’ button.

Select part of BO based on requirement and click OK button. Here I am selecting Header
Changeable

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 4
Add ECC Custom Fields in CRM Web UI ERP Order Using Lean Order Framework

Provide field details and click on Back button.

Click on Save and Generate

You can add as many fields based on requirement.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 5
Add ECC Custom Fields in CRM Web UI ERP Order Using Lean Order Framework

Maintain Interface Communication in ECC


A. Communication Structure
There are three different for each are like Header, Item, Status, Text etc
a. TDS_*****_COMV:- Ready for input fields
b. TDS_*****_COMR:- Read only field
c. TDS_*****_COMC:- change require flag structure
Header interface structures are TDS_HEAD_COMV, TDS_HEAD_COMR, TDS_HEAD_COMC and
item interface structure is TDS_ITEM_COMV, TDS_ITEM_COMR, TDS_ITEM_COMC.

Add new append structure ZZHEADCOMV to header interface structure.


TDS_HEAD_COMV.Add custom fields to this structure.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 6
Add ECC Custom Fields in CRM Web UI ERP Order Using Lean Order Framework

Add new append structure ZZHEADCOMR to header interface structure.


TDS_HEAD_COMR. Add custom fields to this structure.

Add new append structure ZZHEADCOMC to header interface structure.


TDS_HEAD_COMC. Add custom fields flags to this structure.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 7
Add ECC Custom Fields in CRM Web UI ERP Order Using Lean Order Framework

Add fields to item communication structure TDS_ITEM_COMV, TDS_ITEM_COMR and


TDS_ITEM_COMC based on requirement.

Maintain mapping tables in ECC:


Mapping Tables: Mapping tables is used to define the assignment of a field in the communication
structure to a field in the business logic.
LORD_MAPPING
LORD_MAPPING_RO
Execute Transaction Code SM30, Maintain Table LORD_MAPPING and LORD_MAPPING_RO for
custom field.

Mapping table entries for HEADER Object

Object ID :The object to which filed belongs like HEADER,ITEM,HVSTAT


Field Name :Custom field name in LORD interface
Internal Field Name : Name of the field in logic
Program Name :Program name where logic has written in ECC for the custom field.
Reference Screen :Screen number where the logic has written for custom field.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 8
Add ECC Custom Fields in CRM Web UI ERP Order Using Lean Order Framework

Detail view of one entry.

Mapping table entries for ITEM object

If standard field not available in communication structure TDS_****_COMV, TDS_****_COMR and


TDS_****_COMC, LORD mapping tables and in CRM UI component ERP_H,ERP_I,ERP_IT etc. Define
that field as custom field in communication structure and in LORD mapping table as follows.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 9
Add ECC Custom Fields in CRM Web UI ERP Order Using Lean Order Framework

Tip: You can get Object ID, field name, internal field name, Program name and reference field name by
pressing F1 on that field.

In this case name of the field in the LORD interface is different ZZVKBUS and name of the field in
program logic is VBAP-VKAUS.

BADI Implementation in ECC


Execute transaction SE18, display Enhancement Spot ENH_SPOT_LORD
SAP has provided several BADI for LORD. Following are the common BADI required in general.

BADI_LORD_DO_PAI :- Maps the fields and calls for check & processing routines
BADI_LORD_DO_PBO :- Contain formatting routine for fields
BADI_LORD_GET_INPUT_MODE : set the input mode for fields
BADI_LORD_SET_DATA_SINGLE : set default values for fields
BADI_LORD_START_DEFAULT: Set default value for first screen

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 10
Add ECC Custom Fields in CRM Web UI ERP Order Using Lean Order Framework

Implementation code
BADI_LORD_DO_PBO
METHOD if_badi_lord_do_pbo~fill_supply_list.
IF iv_object_id = 'HEAD' .

INSERT gr_intf_supply_data INTO TABLE ct_supply .

ENDIF.

ENDMETHOD.

gr_intf_supply_data is of type ref to ZZCL_LOD_INTF_SUPPLY_DATA. This


class implements the interface IF_LORD_INTF_SUPPLY

Code for the Class ZZCL_LOD_INTF_SUPPLY_DATA


IF_LORD_INTF_SUPPLY~DO_PBO_SINGLE
METHOD if_lord_intf_supply~do_pbo_single.
PERFORM zz_sales_order_owner
IN PROGRAM sapmv45a
IF FOUND .

PERFORM get_no_deal_id_param
IN PROGRAM sapmv45a
IF FOUND .

ENDMETHOD.

BADI_LORD_DO_PAI
Field = custom field
Module = logic written for custom field ( in user exit)
Program = Main program name

METHOD if_badi_lord_do_pai~fill_supply_list.
DATA : ls_supply TYPE tds_field_supply.

IF iv_object_id = 'HEAD' .
**ZZ_OWNER
ls_supply-field = 'ZZ_OWNER' .

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 11
Add ECC Custom Fields in CRM Web UI ERP Order Using Lean Order Framework

ls_supply-module = 'ZZ_SALES_ORDER_OWNER'.
ls_supply-program = 'SAPMV45A'.
ls_supply-on_check = 'R' .

APPEND ls_supply TO ct_supply .


CLEAR : ls_supply .
**ZZ_ZSC_CODE
ls_supply-field = 'ZZ_ZSC_CODE' .
APPEND ls_supply TO ct_supply.
CLEAR : ls_supply.

ELSEIF iv_object_id = 'ITEM' .

ls_supply-field = 'ZZVKAUS' .
APPEND ls_supply TO ct_supply.
CLEAR : ls_supply.

ENDIF.

ENDMETHOD.

BADI_LORD_GET_INPUT_MODE
METHOD if_badi_lord_get_input_mode~get_input_mode.
DATA : ls_screen TYPE screen .

IF is_screen-name EQ 'VBAK-ZZ_OWNER' OR
is_screen-name EQ 'VBAK-ZZ_ZSC_CODE' OR
is_screen-name EQ 'VBAP-ZZMVGR5' OR
is_screen-name EQ 'VBKD-BSTKD_E' .

es_screen-active = 1.
es_screen-input = 1.

ENDIF.

ENDMETHOD.

BADI_LORD_SET_DATA_SINGLE
METHOD if_badi_lord_set_data_single~get_change_request.

DATA: lv_object TYPE tabname,


lv_lord_object TYPE REF TO if_lord_object .
FIELD-SYMBOLS : <fscomv> TYPE tds_head_comv ,
<fscomc> TYPE tds_head_comc .

*
lv_lord_object ?= io_object_ref .

CALL METHOD lv_lord_object->get_object_id

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 12
Add ECC Custom Fields in CRM Web UI ERP Order Using Lean Order Framework

RECEIVING
rv_object_id = lv_object.

IF lv_object = 'HEAD' .
ASSIGN cs_object_comv TO <fscomv> .
ASSIGN cs_object_comx TO <fscomc> .
<fscomv>-vendreg = 'ZA' .
<fscomc>-vendreg = 'X' .
<fscomv>-zz_zsc_code = '01' .
<fscomc>-zz_zsc_code = 'X' .
<fscomv>-zzelecdel = 'E' .
<fscomc>-zzelecdel = 'X' .
*
ENDIF.

ENDMETHOD.

BADI_LORD_START_DEFAULT

METHOD if_badi_lord_start_default~set_start_default.

DATA : ls_default_data TYPE zlord_defdata .

SELECT SINGLE * FROM zlord_defdata INTO ls_default_data


WHERE uname = sy-uname.

IF ls_default_data IS NOT INITIAL.

IF ls_default_data-active = 'X'.
cv_kunag = ls_default_data-kunag .
cv_vkorg = ls_default_data-vkorg .
cv_vtweg = ls_default_data-vtweg .
cv_spart = ls_default_data-spart .
cv_vkbur = ls_default_data-vkbur .
ENDIF.

ENDIF.

ENDMETHOD.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 13
Add ECC Custom Fields in CRM Web UI ERP Order Using Lean Order Framework

Related Content
Please Refer to OSS Note 1224179.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 14
Add ECC Custom Fields in CRM Web UI ERP Order Using Lean Order Framework

Disclaimer and Liability Notice


This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not
supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document,
and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or
code sample, including any liability resulting from incompatibility between the content within this document and the materials and
services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this
document.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 15

You might also like