8/17/2019 CRM Programming - Copy http://slidepdf.com/reader/full/crm-programming-copy 1/44 CRM Programming Fundamentals This is a reference only CRM Programming Fundamentals
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 1/44
CRM Programming Fundamentals
This is a reference only
CRM Programming
Fundamentals
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 2/44
CRM Programming Fundamentals
Contents
1. One Order Object Model................................................................................3
2. One Order Reporting Framework................................................................16
3. Commonly used Function Modules in CRM..............................................1
!. Commonly used "ad#$s in CRM...................................................................2%
&. Copy Control in "usiness 'ransactions....................................................3(
6. 'ransaction CRM)*+)+,'..........................................................................32
%. -ebugging in middleware............................................................................3%
. +rror /andling in CRM..................................................................................3
. O0er0iew o Customiing.............................................................................!2
1(. elpul Reports...........................................................................................!3
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 3/44
CRM Programming Fundamentals
1. One Order Object Model
The CRM One Order documents are created in transaction ‘CRMD_ORDER’.The Header table that is updated by the created document is ‘CRMD_ORDERADM_H’.The primary ey !or this table is "#$D %"lobal #ni&ue $denti!ier'. (or each document
created) a uni&ue number %"#$D' is *enerated by the system +hich depends on the
,o*ical name o! the system. The !ield ‘Ob-ect $D’ o! table ‘CRMD_ORDERADM_H’contains the document number.
The $tem table !or One Order document is ‘CRMD_ORDERADM_$’. Each $tem o! aOne Order document has a di!!erent "#$D. The Header "#$D o! the $tem is stored in
!ield ‘HEADER’ o! table ‘CRMD_ORDERADM_$’.
Data Model:-
Administration (Header / tem!
Header identifies the order in the system
tem holds the relation to the order
"#tension
One-Order Object Model
CRM-*OR-+R4-M* CRM-*4C'#)#'5*
CRM-*OOR'*
4dministration /eader and +7tension /a0e t/e same 89#-
4dministration /eader +7tension
CRM-*:#,; CRM-*<4:+<
CRM-*<##,8:ink /andler
<et
4dministration /eader and <et /a0e dierent 89#-. '/ey arelinked 0ia t/e :ink andler
Note
Normally, an extension contains H or I in the name. It shows if this extension belongs to theheader or to the item. Typically extensions store information which is specic to theheader/item. The information which can belong to both header and item is typically storedin sets.
CRM-*OR-+R4-M*#
CRM-*<+R)#C+*#
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 4/44
CRM Programming Fundamentals
$:$ Relation to the administration header %R to the administration
item
&ets ('in Handler!
$:$ relation to the header and/or the item
o)timal data s)ace *ecause sharing of header and item data is
)ossi*le
)ossi*ility to assign the same data to header and items
it is only allo+ed to reference to an admin segment ($ le,el!
-ata model
Orderadm_hOrderadm_h
GUIDGUID DataData
Activity_hActivity_h
REF_GUIDREF_GUID DataData
Orderadm_iOrderadm_i
GUIDGUID DataDataHeaderHeader
Opport_hOpport_h
REF_GUIDREF_GUID DataData
Service_iService_i
REF_GUIDREF_GUID DataData
Product_iProduct_i
REF_GUIDREF_GUID DataData
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 5/44
CRM Programming Fundamentals
&ets / 'in Handler:-
-ata model= <ets > :ink andler
Orderadm_ Orderadm_
hh
GUIGUI
DDDatDat
aa
Orderadm_ Orderadm_
ii
GUIGUI
DD
DatDat
aa
HeadeHeade
rr
Orderadm_ Orderadm_
ii
GUIGUI
DD
DatDat
aa
HeadeHeade
rr
OrgmaOrgma
nn
GUIGUI
DD
DatDat
aa
OrgmaOrgma
nn
GUIGUI
DDDatDat
aa
Link Hand!erLink Hand!er
HG"# $ OG"#HG"# $ OG"#
IG"% & OG"%IG"% & OG"%
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 6/44
CRM Programming Fundamentals
<+'< ?@A +B'+,<#O,<
'/e product data is an e7tension o t/e itemdata. 4s all e7tensions are always linked toone /eader or one item it does not need itsown /andle or guid. '/is also applies or t/eields table. 4 reerence object type is alsonot necessary as an e7tension can always beassigned eit/er at /eader or item le0el.
<ets are data structures t/at s/ould beused by se0eral objects DreusablestructuresE.'/e sales set is an e7ample o a set. #tcan be assigned to se0eral items.'/ereore a link /andler is necessary.
:#,;@4,-:+R= A -" table= CRM-*:#,;Function module= CRM*:#,;*8+'*OG
+7ample= Order &(!122
eader@8uid= %"-%3&"%-3F6(!4!%%F+%"&622"Dsearc/ CRM-*OR-+R4-M* wit/ object*id &(!122E#tem@8uid= !+C3%(1(16!+%!644+&32&%((11C4Dsearc/ CRM-*OR-+R4-M*# wit/ /eader eader@8uidE
roduct data A +B'+,<#O,Dsearc/ CRM-*roduct*#wit/ 8uid #tem@8uidE
<ales data A <+'Dsearc/ CRM-*:#,; wit/ 89#-*# #tem@8uid8uid*<+' &&F3%-&46-+F!(6+"F-"6+-&C&2 O"H'5+*<+' D<ales 11 see CRMC*O"H+C'<E'/en searc/ CRM-*<4:+< wit/ 8uid 89#-*<+'.
Working with Business Transactions – SAP GU
Ma7imum >minimaldisplay
-isplay or/ide
locator
-isplaybusinesspartnercockpit
4pplication log=-isplays error
messagesGork wit/ se0eral
documents in parallelCompress/eader data
<ettings
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 7/44
CRM Programming Fundamentals
A &er,ice %rder loos as follo+s:
Ser!ice Process
<er0ice process /as leading transaction category "9<2(((116.'ransaction to maintain ser0ice process= CRM-*"9<2(((1164ssigned transaction categories= <er0ice <ales "usiness acti0ity.<er0ice process can be distributed into R>3.Main partner unction category= <old@to party4dditional customiing or <er0ice rocess=
<ubject proile Dor codesE'ransaction type or conirmation
<er0ice process also contains parts o customiing rom "usiness4cti0ity and <ales document.#normation a0ailable in <er0ice process=
eader data<er0ice data<ubject I #"ase<tatus4cti0ity dataObjectsricingConditions
</ipping"illingroductsartner 4ctionsOrganiational data-ates'e7ts
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 8/44
CRM Programming Fundamentals
The (ollo+up documents lie) Con!irmation !rom the /er0ice Order can be created as
sho+n belo+1
Ser!ice Process
<er0ice process /as a speciic 9# dierent rom sales document oracti0ity. Fast entry #tem detail 'ransaction data buttons area0ailable and can be used to switc/ between screens.
<er0ice process can contain dierent items=<ales items
For sales items a sales order can be created in R>3 or complete deli0eryprocess
<er0ice items'o identiy t/e customer wis/es contains planning@rele0ant data
<pare partsMaterial w/ic/ is reJuired in t/e conte7t o a ser0ice item
"4-# or <er0ice rocess=CRM*<+R)#C+*#*"4-# or item data Dno ser0ice@speciic /eaderdataE
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 9/44
CRM Programming Fundamentals
Then) copy the items as needed. /elect the $tem’s 2 Copy1
Ser!ice "on#ir$ation
<er0ice Conirmation /as leading transaction category "9<2(((11%.'ransaction to maintain ser0ice conirmation= CRM-*"9<2(((11%4ssigned transaction categories= <er0ice <ales "usiness acti0ity.Gorking times and spare parts rom ser0ice conormation areposted to R>3. Main partner unction category= <old@to party.4dditional customiing or <er0ice Conirmation=
<ubject proile Dor codesE
Conirmation also contains parts o customiing rom "usiness4cti0ity and <ales document.#normation a0ailable in <er0ice Conirmation=
eader data<er0ice data<ubject<tatus4cti0ity dataObjectsricing'e7ts
Conditions"illingroductsartner 4ctionsOrganiational data-ates
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 10/44
CRM Programming Fundamentals
/imilarly) +e can create 3illin* Re&uests !rom Con!irmation.
All these documents update the same database tables. 3ut are di!!erentiated !rom eachother by 4ROCE//_T54E and O36ECT_T54E in table CRMD_ORDERADM_H.
Ser!ice "on#ir$ation
<er0ice conirmation like a ser0ice process /as a speciic 9#dierent rom sales document or acti0ity. Fast entry #tem detail'ransaction data buttons are a0ailable and can be used to switc/between screens.
<er0ice conirmation can contain dierent items. '/ese items arenormally copied rom t/e ser0ice process or w/ic/ t/e conirmationis created=<er0ice items
Gorking time is distributed to payroll data o R system and costs to CO.
<pare parts
8oods issue is posted to MM and costs to CO.
#n order to create a conirmation rom a ser0ice process t/e processs/ould /a0e status KReleasedL bot/ on /eader and item le0el. 4ssoon as conirmation is sa0ed t/e ser0ice process status is set toKConirmedL.
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 11/44
CRM Programming Fundamentals
Architecture of the systems (CRM R/.!:-
-" tables
CRM-*<C+-:#,)"+
CRM-*RO-9C'*#M4+)>M44)
CRM-*R#C#,8)";-
RC-*CO,-;O,)
CRM*H+<')"9;>)"9
CRM-*OR-+R4-M*#)"4
CRM-*OR-+R4-M*)"4;CRMR>3
CRM-*<C+-:#,)"+
CRM-*RO-9C'*#M4+)>M44)
CRM-*R#C#,8)";-
RC-*CO,-;O,)
CRM*H+<')"9;>)"9
CRM-*OR-+R4-M*#)"4
CRM-*OR-+R4-M*)"4;CRMR>3
⇒ Most o t/e tables /a0e t/e 89#- as a key ielde.g. (F&34-4!4-434!!(43+&243(&&F%3
D89#-= 9ni0ersal 9niJue #dentiier data typeCRM'*O"H+C'*89#- domain <5<99#- R4G 16E
Gorkareas=
- lu*orderadm*/*wrk old data Dlike )"4;E- ls*orderadm*/*wrk local data- gs*orderadm*/*wrk global data
* For an overview on the different status see
Include CRM_STATUS_CON
Middleware
CRM system O:' R>3
CRM Online
R>3 4dapter
"G 4dapter
lug@#n
"G 4O
#C
CRM@@@@@@@@@@@@A"-OC@@@@@@@@@@@@AR>3
Middleware RFC
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 12/44
CRM Programming Fundamentals
'ayers of )rogramming model in *usiness transactions:-
9ser interace layer D9#E
+ac/ layer s/ould communicate only to directly linked layers=9# to #: #: to 9# and OG DO"E OG DO"E to #: or -" -" to OGDO"E
#nteraction layer D#:E
Object layer
Object "uer DO"E Object Gork area DOGE
-atabase layer -atabase "uer D-"E -atabase 9pdate D-9E
9ser #nterace
#nteraction :ayer common
Object :ayer 4pplicationlogic
AP (def Methods!
"4#
-atabase :ayer
Methode Methode Methode Methode
01-&creens / 2e* /
Communication *et+een
1 and 3usiness 'ogic4
Trans)ort and con,ersion of data4
&creen se5uence control4
Methods to create4 read and change
2ell defined interfaces
Definition of *usiness rules
nter)retation of the customi6ing
Merge and checs
Read and sa,e data from/to data*ase
(or /creen (or 7E3
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 13/44
CRM Programming Fundamentals
CRM :ayer model ##
-atabase:ayer
- ! -Ori"inal
ata- U -U#date
tas$
Object:ayer
- O% -!usiness
lo"ic- O! -Modified
ata
Customiing - C -ialo
"- C! -Method
s
-"
#nteraction
:ayer - I& -
9ser
#nterace- UI - NreadK
Nsa0eK
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 14/44
CRM Programming Fundamentals
1ser nterface in 3usiness Transaction:-
User nter#ace in Business Trans%
9ser interace in business transactions consists o all screens>subscreens and
screen seJuence controlling customiing t/at is pro0ided by <4 and s/ouldbe c/anged by t/e customer 0ery careully.<creens t/at are s/own in transaction CRM-*OR-+R are located in t/eunction groups ending wit/ *9#. +7ample= CRM*OOR'*9#.+7ample= screen %111.'ypical low logic o t/e CRM screen="O
get data rom #nteraction :ayer * get data from Interaction Layer MODULE DATA_7110_GET.
perorm ield c/ecks* Modify creen !ie"d# MODULE DATA_7110_!IELD$%E$&.
4#put data to #nteraction :ayer MODULE DATA_7110_'UT ON $%AIN()EUET.
User nter#ace in Business Trans%
<creen seJuence controlling customiing deines w/ic/ t/e screens s/ouldbe displayed in w/ic/ order etc. '/is customiing deines t/e way /ow
business transaction is displayed.
'ransaction to maintainscreen seJuence
controlling= CRM)*<<C
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 15/44
CRM Programming Fundamentals
"usto$er &'tensions in Business Transact%
Customers can e7tend standard CRM business transactions wit/ t/eir ownields>screens. #n order to enable t/is two special e7tensions were added into
CRM business transactions object model. '/ese e7tensions are C9<'OM+R*and C9<'OM+R*#.#M8 documentation= Customer Relations/ip Management @A "asic Functions @A<ystem Modiications @A "usiness 4dd@in or Customer +n/ancements on eader:e0el.'/e structure to be e7tended wit/ customer ields on /eader le0el=CRM'*C9<'OM+R**+B'.<tructure CRM'*C9<'OM+R**+B' is already included into all importantstructures and database tables.
:ogic o CRM*OR-+R
CRM*OR-+R*R+4-*OG
CRM*OR-+R*<4)+*OG CRM*OR-+R4-M**<4)+*O"CRM*OR-+R4-M*#*<4)+*O"CRM*:#,;*<4)+*OGCRM*OR-+R*9:O4-*<#,8:+
CRM*OR-+R*R+4-
CRM*OR-+R*M4#,'4#,
CRM*OR-+R*<4)+
CRM*OR-+R*M4#,'4#,*M9:'#*OG
CRM*OR-+R*M4#,'4#,*<#,8:+*OG
CRM*OR-+R**M4#,'4#,*OGCRM*OR-+R4-M**M4#,'4#,*OG
CRM*OR-+R*#*M4#,'4#,*OGCRM*OR-+R4-M*#*M4#,'4#,*OG
# ## ###
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 16/44
CRM Programming Fundamentals
%,er,ie+ of 7aming con,entions used *y &AP:
2. One Order Reporting FrameworkOne Order Reportin* (rame+or is used to retrie0e the documents !or particular/election criteria. Direct /election !rom database table is not ad0ised.
As an e8ample +e +ill retrie0e Documents) based on the ‘4rocess type’ 2 ‘/ales
or*ani9ation’.,et us compare +ith a /E,ECT statement to mae it more understandable. Assume) the
documents are retrie0ed !rom table :5;) so our /E,ECT statement +ill be as !ollo+s1
/E,ECT <document no=
(ROM TA3,E :5;
7HERE 4ROCE//_T54E > ? 3loc @AD /A,E/_OR" > ? 3loc B
3loc $n One Order Reportin* (rame+or +e +ill select Documents as !ollo+s1
(a$ing con!entions
-e0elopment classes DpackagesE=CRM* I object name+7ample= CRM*4C'#)#'5*
Function groups=CRM* I object name I layer +7ample= CRM*4C'#)#'5**O"
Function modules=CRM* I object name I unction name I layer +7ample= CRM*4C'#)#'5**9'*O"
--#C structures=CRM'* I object name I structure type+7ample= CRM'*4C'#)#'5**GR;
--#C tables=CRM-* I object name+7ample= CRM-*4C'#)#'5*
)ariables=l0* I 0ariable name > g0* I 0ariable name+7ample= l0*guid g0*guid
<tructures=ls* I structure name > gs* I structure name+7ample= ls*orderadm*/*wrk
#nternal tables=lt* I table name > gt* I table name+7ample= gt*orderadm*/*wrk
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 17/44
CRM Programming Fundamentals
(irst o! all +e +ill build the ‘7HERE’ clause as mentioned abo0e !or the /E,ECT
statement. $t is build usin* classes 2 methods. Class ‘C,_CRM_RE4ORT_#4ART’and Method ‘"ET_#4ART_35_TOE’ is used !or this purpose.
3loc @ is built as !ollo+s1
CA,, METHOD cl_crm_report_&upart>=*et_&upart_by_toen E:4ORT$"
i0_entityname > FC,_CRM_RE4ORT_E:T_ORDERADM_HF
i0_!ieldname > F4ROCE//_T54EF i0_toen > FRAF
it_ran*etab > it_typeG
$M4ORT$" e0_&upart > i0_&upart&uerypart.
The parameter) ‘i0_entityname’ contains the name o! the /e*ment !or +hich the data +ill
be retrie0ed. The parameter 0alues can be !ound in pro*ram‘CRM_O36ECT_AME/_CO’.
The parameter) ‘i0_!ieldname’ contains the name o! the !ield !or +hich the /election
Clause is built.‘i0_toen’) is used to let the system no+ the type o! operand you are passin* in the
parameter ‘it_ran*etab’. $n our e8ample) ‘RA’ means Ran*e Table. "o to domain
‘CRM_RE4ORT_TOE’ to see all possible 0alues.4arameter ‘it_ran*etab’ contains the ran*e table +e are passin* to the method. This ran*e
table contains the 0alues the user has entered in the selection screen !or ‘4rocess Type’.
Do not use the method call i! it_typeG is initial.The parameter ‘e0_&upart’) contains !inal &uery built by the method !or 3loc @.
‘i0_&upart’ is o! type ‘CRMT_RE4ORT_#ER54ART_TA’.
7e need to store all these &ueryparts in an internal table +hich can be passed to themethod +hich does the selection based on these &ueryparts %7HERE C,A#/E'.
/o) an internal table say) ‘it_&upart’ o! type ‘CRMT_RE4ORT_#ER54ART_TA’ is
created) +here the parameter ‘i0_&upart’ returned by the method is appended.
o+) be!ore buildin* the &uery part !or ‘/ales or*ani9ation’ %3loc B') +e need to build
3loc . %3ecause there is more than one !ield in 7HERE clause'./o) ho+ to build 3loc no+1
/ame methods are used as !ollo+s1
CA,, METHOD cl_crm_report_&upart>=*et_&upart_by_toen E:4ORT$" i0_toen > FADF
$M4ORT$"
e0_&upart > i0_&upart_and&uerypart.
o+) ‘i0_&upart_and’ is appended to internal table ‘it_&upart’.
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 18/44
CRM Programming Fundamentals
3loc B has to be built no+ same lie 3loc @ and appended to internal table ‘it_&upart’.
CA,, METHOD cl_crm_report_&upart>=*et_&upart_by_toen E:4ORT$"
i0_entityname > FC,_CRM_RE4ORT_/ET_OR"MAF
i0_!ieldname > F/A,E/_OR"F
i0_toen > FRAF it_ran*etab > it_sales_or*G
$M4ORT$"
e0_&upart > i0_&upart&uerypart.
o+) +e do not need 3loc anymore as +e do not ha0e any !urther !ields !or selection.
$nternal table ‘it_&upart’ contains the complete 7HERE C,A#/E. 7e +ill see ho+ thisis used to retrie0e the Documents.
Create Ob-ect1
CREATE O36ECT cl_&uestion I Constructor
E:4ORT$"
it_&uery > it_&upartG i0_accessrule_name > FC,_CRM_RE4ORT_ACCR#,E_OEORDERF.
cl_&uestion re!ers to Class ‘C,_CRM_RE4ORT_#E/T$O’.$t_&upart is the internal table that +e populated abo0e.
FC,_CRM_RE4ORT_ACCR#,E_OEORDERF re!ers to the One Order Reportin*
(rame+or.
CA,, METHOD cl_&uestion=re!resh.
CA,, METHOD cl_&uestion=*et_e8t_ob-ect E:4ORT$"
i0_name > *c_ob-ectname_reportin*locatorlist
$M4ORT$" e0_instance > l_list.
l0_locatorlist J> l_list.
7here)
l_list T54E RE( TO cl_crm_report_e8t.l0_locatorlist T54E RE( TO cl_crm_report_e8t_locatorlist.
(inally) call the !ollo+in* Method1
CA,, METHOD l0_locatorlist=*et_e8tension
E:4ORT$" it_re&uested_columns > lt_re&u_columns
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 19/44
CRM Programming Fundamentals
$M4ORT$"
et_e8tension > lt_list.
7here)
l0_locatorlist T54E RE( TO cl_crm_report_e8t_locatorlist.
lt_re&u_columns T54E crmt_report_re&u_columns_ta.
%(or the Columns you re&uire.(or e8ample1ls_re&u_columnscolumn > F"#$DF.
ls_re&u_columnsre&uested > abap_true.
A44ED ls_re&u_columns TO lt_re&u_columns.
ls_re&u_columnscolumn > FO36ECT_T54EF.
ls_re&u_columnsre&uested > abap_true.
A44ED ls_re&u_columns TO lt_re&u_columns.
ls_re&u_columnscolumn > FO36ECT_$DF.
ls_re&u_columnsre&uested > abap_true.A44ED ls_re&u_columns TO lt_re&u_columns.
ls_re&u_columnscolumn > F4ROCE//_T54EF.ls_re&u_columnsre&uested > abap_true.
A44ED ls_re&u_columns TO lt_re&u_columns.'
lt_list T54E crmt_report_locatorlist_ta. This contains the !inal list o! selection.
3. Commonly used Function Modules in CRMThe !unction module ‘O7_,O"$CA,_/5/TEM_"ET’ can be used to *et the name o!
the ,o*ical /ystem.
The !unction module ‘CRM_/TAT#/_READ’ is used to read the status o! the document.
The !unction module ‘CRM_/TAT#/_CHA"E_(OR_ACT$K_O7’ is used to chan*ethe /tatus o! documents) both Header 2 $tem.
E0en !unction module FCRM_/TAT#/_MA$TA$_O7F can be used to chan*e thestatus o! a document.(or e8ample1
ls_status_comacti0ate > F:F.
ls_status_comre!_*uid > ls_*uid.
ls_status_comre!_ind > FF. ls_status_comstatus > FELLF.
$/ERT ls_status_com $TO TA3,E lt_status_com.
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 20/44
CRM Programming Fundamentals
C,EAR lt_input_!ield_names.
$/ERT *c_!ieldname_acti0ate $TO TA3,E lt_input_!ield_names.
CA,, (#CT$O FCRM_/TAT#/_MA$TA$_O7F
E:4ORT$"
it_status_com > lt_status_comN $T_/TAT#/_COM$T >
i0_chec_only > FF
N $K_TRACE >
N $K_O_@O_MA$TA$ > (A,/E
N $K_(ORCE_@O_MA$TA$ > (A,/EN $K_"ET_ACT#A,_E:C4 > (A,/E
CHA"$"
ct_input_!ield_names > lt_input_!ield_names
E:CE4T$O/ not_allo+ed > @
error_occurred >
+arnin*_occurred > B OTHER/ >
.
$( sysubrc <= L. ME//A"E $D syms*id T54E syms*ty #M3ER syms*no
7$TH syms*0@ syms*0 syms*0B syms*0.
ED$(.
The !unction module ‘CRM_ORDER_CHEC_A#THOR$T5_"E’ is used to checthe modi!ication authori9ation !or a document.
The !unction module ‘RE,_"ET_E$"H3O#RHOOD’ is used to read the document
!lo+.
(or e8ample1
CA,, (#CT$O FRE,_"ET_E$"H3O#RHOODF
E:4ORT$" is_ob-ect > 0_borident
N $T_RO,ERA"E >
it_relran*e > 0_relran*eG i_depth > FLLFN 354A//_3#((ER > F F
N $M4ORT$"
N E4_E:$/T_,$/ > TA3,E/
lins > it_lins
N RO,E/ >
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 21/44
CRM Programming Fundamentals
.
The structure ‘0_borident’ should contain the ob-ect "#$D) Ob-ect type and lo*ical
system name.
The structure ‘0_relran*e’ should be lie this 10_relran*esi*n > F$F.
0_relran*eoption > FEF.
0_relran*elo+ > FKOAF.0_relran*ehi*h > FF.
A44ED 0_relran*e.
C,EAR 0_relran*e.
The internal table ‘it_lins’ is returned by the !unction module +hich contains all the
documents lined +ith the ob-ect "#$D passed in the structure ‘0_borident’.
The !unction module ‘CRM_/RK_#4DATE_DOC(,O7’ is used !or creatin* Document
(lo+. This !unction module can be used to create document !lo+ bet+een RPB 2 CRM
documents as +ell.E0en !unction module ‘CRM_ORDER_MA$TA$’ can be used to create document
!lo+.
(or e8ample1
ls_*uid > ls_documents*uid.
$/ERT ls_*uid $TO TA3,E it_*uid.
N (ill input !ields !or maintain ls_input_!ield_names!ieldname > FO36E5_AF.
$/ERT ls_input_!ield_names $TO TA3,E lt_input_!ield_names. ls_input_!ield_names!ieldname > FO36T54E_AF.
$/ERT ls_input_!ield_names $TO TA3,E lt_input_!ield_names.
ls_input_!ield_names!ieldname > FO36E5_3F. $/ERT ls_input_!ield_names $TO TA3,E lt_input_!ield_names.
ls_input_!ield_names!ieldname > FO36T54E_3F.
$/ERT ls_input_!ield_names $TO TA3,E lt_input_!ield_names. ls_input_!ield_names!ieldname > FKOA_$DF.
$/ERT ls_input_!ield_names $TO TA3,E lt_input_!ield_names.
ls_input_!ield_names!ieldname > F3RE,_$DF. $/ERT ls_input_!ield_names $TO TA3,E lt_input_!ield_names. ls_input_!ield_names!ieldname > F3RE,_MODEF.
$/ERT ls_input_!ield_names $TO TA3,E lt_input_!ield_names.
ls_input_!ield_names!ieldname > FRE,T54EF. $/ERT ls_input_!ield_names $TO TA3,E lt_input_!ield_names.
ls_input_!ieldre!_*uid > ls_*uid.
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 22/44
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 23/44
CRM Programming Fundamentals
The !unction module +hich contains the strin* ‘$T,A5’ returns data !rom the
$nteraction ,ayer. (or e8ample) i! you are processin* a document) and you need theHEADER "#$D o! the document +hich is not a0ailable in your pro*ram) you can use
those (M’s +hich +ill return the desired data. 3ecause) the $nteraction ,ayer is populated
+hen +e use !unction modules lie CRM_ORDER_READ etc.
The !unction module ‘334_4D_A,,_"ET_O36ECT_$D’ is used to *et the Ob-ect $D
!rom the Ob-ect "#$D.
The !unction module ‘CRM_/TAT#/_3#((ER_RE(RE/H’ is used to re!resh the
bu!!er. This !unction module should be used to re!resh the bu!!er a!ter any chan*e o!
status o! the document.
The !unction module ‘CRM_@O_CA,,_(ORE$"’ is used to call transaction
‘CRMD_ORDER’. 5ou ha0e to pass the document number +hich you ha0e to open. 5ou
can open the document either in Chan*ePDisplay mode.
The !unction module ‘CRM_ORDERADM_H_"#$D_"ET_O7’ is used to *et the
"#$D !rom Ob-ect $D.
The !unction module ‘CRM_HEADER_"#$D_"ET_O36_$D’ is used to *et the Ob-ect
$D !rom "#$D.
The !unction module ‘CRM_ORDER_"ET_HEADER_"#$D’ is used to *et Header
"#$D !rom $tem "#$D.
The !unction module F$3_COKERT_$TO_T$ME/TAM4F can be used to con0ert totimestamp.
The !unction module FCRM_ACT$K$T5_H_MA$TA$_O7F to CreatePChan*e Acti0ity
Header Data.
(or e8ample1
N Chec +hether Acti0ity Header Cate*ory Data e8ists !or this Order CA,, (#CT$O FCRM_ACT$K$T5_H_READ_O3F
E:4ORT$"
i0_*uid > i0_header_*uid
$M4ORT$" es_acti0ity_h_+r > l8_act_h_+r
E:CE4T$O/
parameter_error > @ record_not_!ound >
at_least_one_record_not_!ound > B
OTHER/ > . $( sysubrc <= L.
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 24/44
CRM Programming Fundamentals
N ME//A"E $D syms*id T54E syms*ty #M3ER syms*no
N 7$TH syms*0@ syms*0 syms*0B syms*0.
ME//A"E iL%9crm_de0'.
4ER(ORM update_messa*e #/$" i0_header_*uid.
E:$T. ED$(.
N $! no Acti0ity Header E8ists) then Create %MODE > A'
N $! it e8ists then chan*e +ith %MODE > 3' $( l8_act_h_+r $/ $$T$A,.
l8_act_hmode > FAF.
E,/E. l8_act_hmode > F3F.
ED$(.
l8_act_hre!_*uid > i0_header_*uid. SHead "#$D
l8_act_hcate*ory > F;[email protected] $nput (ields to be chan*ed
l8_input_!ield_names!ieldname > FCATE"OR5F.
$/ERT l8_input_!ield_names $TO TA3,E lit_input_!ield_names. l8_input_!ield_names!ieldname > FMODEF.
$/ERT l8_input_!ield_names $TO TA3,E lit_input_!ield_names.
N CreatePChan*e Acti0ity Header Cate*ory Data CA,, (#CT$O FCRM_ACT$K$T5_H_MA$TA$_O7F
E:4ORT$"
is_acti0ity_h_com > l8_act_h CHA"$"
ct_input_!ield_names > lit_input_!ield_names E:CE4T$O/
header_create_error > @ header_chan*e_error >
parameter_error > B
admin_h_re!erence_error > OTHER/ > .
$( sysubrc <= L.
N ME//A"E $D syms*id T54E syms*ty #M3ER syms*noN 7$TH syms*0@ syms*0 syms*0B syms*0.
ME//A"E iL%9crm_de0'.
4ER(ORM update_messa*e #/$" i0_header_*uid. E:$T. ED$(.
1se of function module CRM8%RD"R8R"AD:-
The !unction module CRM_ORDER_READ is used to read the /e*ment Data o! a One
Order Document.
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 25/44
CRM Programming Fundamentals
The !unction module is used to read Header as +ell as $tem details %all se*ments' by
passin* the Header "#$D o! the document in the parameter I$T_HEADER_"#$D o!the !unction module.
To read only $tem speci!ic detail) pass the $tem "#$D o! the document in the parameter
I$T_$TEM_"#$D o! the !unction module.
5ou can read more than one document details by passin* more than one "#$D in the
parameter I$T_HEADER_"#$D.
The !unction module CRM_ORDER_READ returns data o! all the /e*ments o! the
document. To read only speci!ic /e*ment data) pass the /e*ment ame in the parameter
I$T_RE#E/TED_O36ECT/ o! the !unction module) to enhance per!ormance.
The !unction module !irst try to read re&uired data !rom O7 %+or area') i! not a0ailable
loos at the O3 +hich is the Ob-ect 3u!!er. $! still !ails) !inally it retrie0es the data !rom
Database. /o) i! you loo at standard CRM !unction modules) you +ill !ind) su!!i8es as?_O7 P ?_O3P ?_D3. 3ased on your re&uirement !rom +here you +ant to read the
data) you need to use the respecti0e !unction module.
1se of Function Module CRM8%RD"R8MA7TA7:-
The !unction module is used to MaintainPChan*e One Order Document.
Dependin* on the /e*ment data you are modi!yin*) you need to pass the chan*ed data inthe respecti0e parameter o! the /e*ment.
(or e8ample) i! you are modi!yin* Acti0ity data o! the Header) you need to pass
parameter $T_ACT$K$T5_H) similarly) !or Acti0ity $tem you need to pass data in$T_ACT$K$T5_$.
$t is mandatory to populate the Chan*in* 4arameter CT_$4#T_($E,D/. This parameter contains the name o! the /e*ment you are modi!yin*. 5ou can modi!y as many
se*ments you +ant to. 3ut you need to pass all the /e*ments name in the parameterCT_$4#T_($E,D/. 5ou can *et the name o! the /e*ment’s in the table
CRMC_O36ECT/. $! you are modi!yin* any /e*ment) !or +hich need to populate the
!ield ‘,O"$CA,_E5’ in the parameter CT_$4#T_($E,D/) you need to *enerate the,O"$CA,_E5 each time you use. (or e8ample) !unction module
CRM_3$,,4,A_($D_,O"$CA,_E5 is used to *enerate the ,O"$CA,_E5 to
be used to modi!y the /e*ment !or 3$,,$" 4,A.5ou need the ,O"$CA,_E5 to modi!y the /e*ment’s 3$,,$" 4,A)
C#M#,ATED_$) 4roduct Details) and to CACE, a document.
Do not !or*et to use the !unction module ‘CRM_ORDER_/AKE’ to sa0e the chan*es!ollo+ed by COMM$TPRO,,3AC +or.
(inally) call the !unction module ‘CRM_ORDER_$$T$A,$;E’ to re!resh the bu!!er.Care must be taen !or locin*Punlocin* the document be!ore main* any chan*es.
(e+ points to remember about the !unction module1
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 26/44
CRM Programming Fundamentals
)unction "*M+O*,&*+MA(TA(
Function module CRM*OR-+R*M4#,'4#, is used or any action perormed orbusiness transaction.Recursi0e calls are not permitted4ll e7tensions and sets are passed to t/is unction moduleMultiple documents can be maintained wit/ one call#nput ields Dparameter C'*#,9'*F#+:-<E are used to identiy w/ic/ ields o t/ecorresponding set>e7tension s/ould be c/anged'/e unction calls CRM*OR-+R*M4#,'4#,*M9:'#*OG to maintain multipledocumentsCRM*OR-+R*M4#,'4#,*M9:'#*OG separates t/e documents and callsCRM*OR-+R*M4#,'4#,*<#,8:+*OG or eac/ o t/em in case ocreation>c/ange>deletion and CRM*OR-+R*CO5*<#,8:+*OG in case o copyingor creating ollow@up documentCRM*OR-+R*M4#,'4#,*<#,8:+*OG unction callsCRM*OR-+R**M4#,'4#,*OG to maintain /eader inormation and
CRM*OR-+R*#*M4#,'4#,*M9:'#*OG to maintain item inormationCRM*OR-+R**M4#,'4#,*OG calls in a certain order maintenance unctionmodules or e7tensions and sets belonging to /eader 4t t/e end CRM*OR-+R**COM:+'+*OG is called and e0ents planned or t/eend o /eader processing are e7ecuted
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 27/44
CRM Programming Fundamentals
/e&uence o! !unction modules called +ithin CRM_ORDER_MA$TA$1
!. Commonly used "ad#$s in CRMThe 3ad$ ‘CRM_ORDER_/TAT#/’ can be used to process any lo*ic +hen there is achan*e o! /TAT#/ in the document at the HeaderP$tem le0el.
$n the method ‘3E(ORE_CHA"E’ you can put your lo*icP0alidation etc +hile the
status is chan*ed. And in case o! error) raise the e8ception ‘OT_A,,O7ED’. /o) the
status chan*e +ill not be allo+ed. $n the method ‘A(TER_CHA"E’ you can use yourlo*ic that needs to be processed a!ter the status is chan*ed. 5ou cannot raise any
e8ceptions. 5ou can put !ilters !or +hich /tatus chan*e the 3ad$ should be tri**ered.
ote1 The parameter ‘CHEC_O,5’ is used in t+o +ays.
$! you +ant to thro+ error messa*es +hen the user is tryin* to chan*e the /tatus) thentri**er the 3ad$ +hen the ‘CHEC_O,5’ parameter is initial.
$! you +ant to hide the /tatus) then tri**er the 3ad$ +hen the ‘CHEC_O,5’ parameter contains ‘:’.
The 3ad$ ‘CRM_ORDER_($E,DCHEC’ is used to dynamically mae a !ield $4#TO(( in transaction CRMD_ORDER.The method ‘($E,DCHEC’ is used !or the same.
E8ample1
CRM*OR-+R*M4#,'4#,CRM*OR-+R*M4#,'4#,*M9:'#*OG
CRM*OR-+R*M4#,'4#,*<#,8:+*OGCRM*OR-+R**M4#,'4#,*OG
CRM*OR-+R**R+4R+*OGCRM*OR-+R4-M**M4#,'4#,*OGCRM*?O"H+C'A*M4#,'4#,*OG.........CRM*OR-+R**COM:+'+*OG
CRM*OR-+R*#*M4#,'4#,*M9:'#*OGCRM*OR-+R*#*M4#,'4#,*<#,8:+*OG
CRM*OR-+R4-M*#*M4#,'4#,*OGCRM*?O"H+C'A*M4#,'4#,*OG
.........CRM*OR-+R*#*COM:+'+*<#,8:+*OG
CRM*OR-+R*#*COM:+'+*M9:'#*OGCRM*OR-+R*COM:+'+*<#,8:+*OG
CRM*OR-+R*COM:+'+*M9:'#*OGCRM*OR-+R*F#,4:*C4::<*OG
CRM :ayer model #)
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 28/44
CRM Programming Fundamentals
METHOD i!_e8_crm_order_!ieldchecU!ieldchec.
$C,#DE crm_direct.
DATA1 l0_status_completed T54E crmt_boolean) ls_input_!ield_names T54E crmt_input_!ield_names)
ls_pre_status_completed T54E crmt_status_prestate)
ls_sales_+r T54E crmt_sales_+r) l0_mode T54E crmt_mode)
l0_ob-ect_type T54E s+o_ob-typ)
e0_header T54E crmt_ob-ect_*uid) lt_crmt_status_tab T54E crmt_status_tab)
+a_crmt_status T54E crmt_-stat)
l_set)
crmd_orderadm_h T54E crmd_orderadm_h.
e0_header > is_!ieldchec_comre!_*uid.
CA,, (#CT$O FCRM_ORDERADM_H_READ_O7F
E:4ORT$"
i0_orderadm_h_*uid > e0_header $M4ORT$"
e0_mode > l0_mode
e0_ob-ect_type > l0_ob-ect_type E:CE4T$O/
admin_header_not_!ound > L.
$( l0_ob-ect_type $/ $$T$A,.
CA,, (#CT$O FCRM_ORDERADM_$_READ_O7F
E:4ORT$"
i0_*uid > e0_header
i0_include_deleted_item > F F $M4ORT$"
e0_header_*uid > e0_header
E:CE4T$O/ item_not_!ound > @ OTHER/ > .
CA,, (#CT$O FCRM_ORDERADM_H_READ_O7F E:4ORT$"
i0_orderadm_h_*uid > e0_header
$M4ORT$"
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 29/44
CRM Programming Fundamentals
e0_mode > l0_mode
e0_ob-ect_type > l0_ob-ect_type E:CE4T$O/
admin_header_not_!ound > L.
ED$(.
CHEC % l0_ob-ect_type > *c_ob-ect_typeser0ice '.
NNN Mae the CATE"OR5 !ield Display >>= Header
$( i0_ob-ect_name > *c_ob-ect_nameacti0ity_h.
,OO4 AT ct_input_!ield_names $TO ls_input_!ield_names. $( ls_input_!ield_names!ieldname > FCATE"OR5F.
ls_input_!ield_nameschan*eable > *c_chan*eableno.
MOD$(5 ct_input_!ield_names
(ROM ls_input_!ield_names TRA/4ORT$" chan*eable.
ED$(.
ED,OO4. ED$(.
EDMETHOD.
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 30/44
CRM Programming Fundamentals
&. Copy Control in "usiness 'ransactions
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 31/44
CRM Programming Fundamentals
"o. "ontrol in Business Transactions
Copy control is a unctionality t/at controls copying business transactions
and creating ollow@up documents.Copy control is set up or transaction types and or item categories. '/e irstone controls t/e copying o /eader data and t/e second one item data.Customiing o copy control= #M8 @A Customer Relations/ip Management @A'ransactions @A "asic <ettings @A Copy Control or "usiness 'ransactions.
"y deault only a part o t/e inormation is copied rom preceding to ollow@up transaction='ransaction description Dcopied by deaultEartners Dcontrolled by t/e partner determination procedure and accessseJuenceE'e7ts Dcontrolled by te7t procedure and access seJuenceE#tems Di speciic criteria are metE
'/e rest o t/e inormation can be copied only using a "4-#CRM*CO5*"4-#.
"o. "ontrol in Business Transactions
Copy control also deines w/ic/ transaction types are a0ailable in t/edrop@down menu to create a ollow@up transaction. "y deault copyingrom "usiness 4cti0ity and 'ask is a0ailable into all transaction types.'/e same applies w/en "usiness 4cti0ity or 'ask is created as a ollow@up or any transaction.
For ot/er transaction types Dnot 4cti0ity or 'askE t/e document s/ouldnot contain errors in order to create a ollow@up transaction.
Copying rom>to "usiness 4cti0ity or 'ask can be e7plicitly restrictedwit/ "4-# CRM*CO5*"4-#. "ut t/is will not remo0e 4cti0ities and'asks rom t/e drop@down list o a0ailable transaction types. '/ey willstill be a0ailable in t/e menu but copying will be restricted aterselection.
# one document is created as a ollow@up to anot/er t/e organiationaldata in t/e ollow@up document is not c/angeable. '/is is controlled inunction module CRM*OR8M4,*<4:+<*4R+4*FC. 4 modiications/ould be done in order to enable organiational data maintenance in a
ollow@up transaction.
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 32/44
CRM Programming Fundamentals
Method CO45 can be used to restrict copyin* i! some criteria are not met.
Other methods are used to copy necessary in!ormation !rom a precedin* to a !ollo+updocument. They ha0e all necessary in!ormation as the parameters.
6. 'ransaction CRM)*+)+,'
BA, #or "o. "ontrolCopy control /as a special "4-# CRM*CO5*"4-# to enable t/e customers toinluence t/e copy process. '/e "4-# is ilter@dependant. <e0eral implementations
wit/ dierent ilter 0alues can be programmed. Filter 0alue is t/en speciied in t/ecustomiing as a Kcopy routineL ield.'/e ollowing met/ods are a0ailable=
<##,8 Met/od or Object <##,8CO5 Met/od or CO5 object Dcopying reJuirementEOR-+R4-M*# Met/od or OR-+R4-M*# objectRO-9C'*# Met/od or RO-9C'*# objectOR-+R4-M* Met/od or OR-+R4-M* objectR#C#,8 Met/od or object R#C#,8<4:+< Met/od or <4:+< object4C'#)#'5* Met/od or 4C'#)#'5* objectOR-R*# Met/od or Object OR-R*# DContracts 4ssortmentE"#:::4, Met/od or "#:::4, object"#::#,8 Met/od or "#::#,8 objectOOR'* Met/od or OOR'* object:+4-* Met/od or Object :+4-*<C+-:#,*# Met/od or Object <C+-:#,*#F#,RO-*# Met/od or Object F#,RO-*#
<+R)#C+*# Met/od or Object <+R)#C+*#R#C#,8*# Met/od or Object R#C#,8*#45:4, Met/od or Object 45:4,C9<'OM+R*# Met/od or Object C9<'OM+R*#C9<'OM+R* Met/od or Object C9<'OM+R*-4'+< Met/od or object -4'+<C4,C+: Met/od or object C4,C+:-OC*F:OG Met/od or Object -OC*F:OG
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 33/44
CRM Programming Fundamentals
$n transaction CRMK_EKET you can con!i*ure your o+n !unction module +hich +ill
be tri**ered based on the con!i*uration.
+0ent andler
Maintenance 'ransaction= CRM)*+)+,' D'able wit/ all e0entsEFunction Modules= CRM*+)+,'*<+'*+B+'#M+*OG CRM*+)+,'*9":#<*OG
+7ample= +0ent= +,-*OR-+R4-M* Function Module= CRM*OR-+R4-M**M4#,'4#,*OG
'able wit/ all e0ents t/at are registered on e0entNend*orderadm*/K are processed now
'(RFORM ()(CUT(_CA&&!AC*S_'&ANN(
USIN+ &,_+UI_RI,_()(TIM(
&T_'&AN_()(TS ./ ta0le with Call!ac$s CAN+IN+ &,_CA&&_RCO(
&T_(,(NT_RCO(1
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 34/44
CRM Programming Fundamentals
As an e8ample see belo+1
As mentioned abo0e) the !unction module ‘PA/M,@PCRM_3$,,RE_/ET_3,OC’
+ill be tri**ered at the end o! the billin* re&uest +hen a billin* re&uest is created +ith
'ransaction= CRM)*+)+,' or eader processing
+0ent is publis/ed by unction moduleNCRM*+)+,'*9":#<*OGK
-istinguis/ between eader and #tem
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 35/44
CRM Programming Fundamentals
re!erence. And it +ill tri**er !or the HEADER se*ment. 5ou can set +hether the !unction
module should be tri**ered !or header le0el or at item le0el. Also) you can set otherattributes as sho+n abo0e. 4lease *o throu*h the transaction to e8plore !urther options.
Ha0e a loo at the parameters that can be used in the !unction module. The parameters
are !illed based on the EKET.
The !unction module should be updated in the table ‘CRMC_EKET_CA,,’.
ote1 $! you +ant to update any data in the database table) please tae care +hether your
!unction module is handlin* data at the database le0el or ob-ect bu!!er le0el. $! you are+orin* at the ob-ect layer but you need to update database table) do not try to update thetables usin* CRM_ORDER_MA$TA$ or anythin* else. 6ust populate the ob-ect bu!!er
+ith the data you +ant to be updated in the database. /ystem +ill tae care o! the update.
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 36/44
CRM Programming Fundamentals
&!ent /andler 0
'/e e7ecution o a speciic e0ent is normally done in a ollowing order=+0ents are planned or e7ecution in a C4,8+ unction module. 4llnecessary parameters are pro0ided Dold>new data etc.E. '/is is done inunction CRM*+)+,'*9":#<*OG.#n M4#,'4#, unction module t/e e7ecution time o t/e e0ent is set and alle0ents planned or t/at e7ecution time are e7ecuted. '/is is done in unctionCRM*+)+,'*<+'*+B+'#M+*OG.G/en t/e e0ent is e7ecuted it is remo0ed rom t/e internal table wit/ plannede0ents.
+0ent table is deli0ered by <4 and normally s/ould not be c/anged by t/ecustomers. Only in rare cases w/en certain unctionality reJuires an
additional e0ent to be added or an e7isting e0ent to be c/anged t/is can bedone ater prior consulting wit/ responsible de0eloper.+0ents inluence t/e w/ole transaction processing and may causeperormance problems i t/ey are not properly set up.
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 37/44
CRM Programming Fundamentals
2hen +here the "9"7T is triggered:-
+0ent andler
CRM*OR-+R*M4#,'4#,CRM*OR-+R*M4#,'4#,*M9:'#*OG
CRM*OR-+R*M4#,'4#,*<#,8:+*OGCRM*OR-+R**M4#,'4#,*OG
CRM*OR-+R**R+4R+*OGCRM*?O"H+C'A*M4#,'4#,*OG
CRM*?O"H+C'A*9":#<*OGCRM*+)+,'*<+'*+B+'#M+*OG Dend*?O"H+C'AE
.........CRM*OR-+R**COM:+'+*OG
CRM*+)+,'*<+'*+B+'#M+*OG Dend*/eader*maintainECRM*OR-+R*#*M4#,'4#,*M9:'#*OG
CRM*OR-+R*#*M4#,'4#,*<#,8:+*OGCRM*?O"H+C'A*M4#,'4#,*OG
CRM*?O"H+C'A*9":#<*OGCRM*+)+,'*<+'*+B+'#M+*OG Dend*?O"H+C'AE
.........CRM*OR-+R*#*COM:+'+*<#,8:+*OG
CRM*+)+,'*<+'*+B+'#M+*OG Dend*item*maintainECRM*OR-+R*#*COM:+'+*M9:'#*OG
CRM*OR-+R*COM:+'+*<#,8:+*OGCRM*+)+,'*<+'*+B+'#M+*OG Dend*order*maintainE
CRM*OR-+R*COM:+'+*M9:'#*OGCRM*+)+,'*+B+'#M+*M9:'#*OG Dend*order*multi*maintainE
CRM*OR-+R*F#,4:*C4::<*OG
+0ent andler
Orderadm*i*publis/*ow4ter*c/ange Dold@ > new 0aluesE
sc/edlin*i*publis/*ow4ter*c/ange Dold@ > new 0aluesE
.
.
.
+0ent /andler lan D+nd*#tem*MaintainECRM_'ROUCT_I_Unit_(C
lan D+nd*Order*MaintainECRM_'RIOC_U'AT(_(C
+0ent consumer 111111CRM_'ROUCT_I_Unit_(CCRM_'RIOC_U'AT(_(CCRM_'ARTN(R_(T(RM_(C
CRM_(,(NT_S(T_()(TIM(_O%2end_Ite3_3aintain4
.
.
.
CRM_(,(NT_S(T_()(TIM(_O%2end_Order_3aintain4
.
.
.
+0ent /andler
lan D+nd*#tem*MaintainECRM_'ROUCT_I_Unit_(C
lan D+nd*Order*MaintainECRM_'RIOC_U'AT(_(C
CRM_'ROUCT_I_Unit_(C
After_chan"e Orderad3_i2old- 5 new values4
CRM_'RIOC_U'AT(_(C After_chan"e Orderad3_i2old- 5 new values4
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 38/44
CRM Programming Fundamentals
%. -ebugging in middleware
$t is important to no+ ho+ to debu* the middle+are) since in CRM the documents aredistributed in RPB.
$n CRM) be!ore you /AKE the document *o to transaction ‘/M/’ and DeRe*ister the
RPB destination. Then /AKE the document. o+ *o to transaction ‘/M@’. 5ou +ill see the document a0ailable in the Outbound
ueue. 5ou can debu* the document no+. This is the scenario +hen the document is
trans!erred !rom CRM RPB.
(or RPB CRM1
7hile creatin* the document in CRM) /AKE the document +ith error %ha0e an error in
the document +hile /AK$" it'. "o to transaction ‘/MR’. 5ou +ill *et the documentnumber in this transaction. /elect the document and DeRe*ister it. o+) the document
has been processed in RPB and is in the $nbound ueue. "o to transaction ‘/M’ and
debu* the document.
$! you +ant to see the 3Doc messa*es *o to transaction ‘/M7L@’. $! the document has
not been processed %yello+ tra!!ic li*ht') you can reprocess the document.
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 39/44
CRM Programming Fundamentals
. +rror /andling in CRM
Alication 1og and Messages
4pplication log is a "asis unctionality used in CRM to store error messagesin CRM documents. 4pplication log is sa0ed toget/er wit/ correspondingbusiness transaction.'/e application log can be displayed in CRM-*OR-+R transaction or acurrently opened document. 4n alternati0e way to display application is touse transaction <:81. '/e object is CRM*-OC9M+,'.<:81 can be used to monitor or e7ample order upload errors DCRM @A R>3E.#n t/e application log t/e user can see 3 types o messages=
+ error messages Dstored in t/e application log ater sa0ingEG warning messages Ddeleted rom application log ater sa0ingE# inormation messages Ddeleted rom application log ater sa0ingE
Messages in t/e application log are identiied by message class and message
number. '/ere$s a possibility to display detailed inormation about t/emessage and to na0igate to t/e corresponding ield in CRM-*OR-+Rtransaction.<+1 transaction can be used to display message inormation Din case t/ecustomer pro0ides only a number o t/e message and not t/e te7tE.
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 40/44
CRM Programming Fundamentals
The !unction module FCRM_ME//A"E/_CHEC_(OR_ERROR/F is used to chec
+hether any error occurred in the transaction ‘CRMD_OREDR’ +hile processin*.
The !unction module FCRM_ME//A"E/_/EARCHF is used to search !or error messa*esi! any error has occurred.
The !unction module F3A,_,O"_M/"_READF is used to read the error messa*es that
has occurred +hile processin* the transaction ‘CRMD_ORDER’.
E8ample1
(ORM chec_ob-ect_!or_errors #/$" i0_ob-_*uid T54E crmt_ob-ect_*uid
i0_ob-_ind T54E crmt_ob-ect_ind CHA"$" p_t_ms* T54E bapiret_t
p_error_occured T54E crmt_boolean.
DATA1 lt_ms*_handle T54E bal_t_ms*h)
ls_lo*_ms*_handle T54E balms*hndl) ls_lo*_ms* T54E bal_s_ms*.
NP %re'init C,EAR p_error_occured.
Alication 1og and Messages
CRM messages /a0e also so@called le0el or degree. '/e le0el o t/e messagesdeines i t/is message will be s/own in t/e application log or a speciic user.
#n t/e user master record D<9(1E t/ere$s a parameter CRM*9<+R*:+)+:.'/is one speciies t/e le0el o t/e user.'/e standard settings or message le0els DdegreesE can be ound intransaction CRMC*M<8<.'/e customer can o0erwrite system settings wit/ transaction CRMC*M<8C.Restriction= message type cannot be lowered Dor e7ample rom + to GE it canonly be set to /ig/er one DG to +E.4ter setting message le0el to it will not be s/own in t/e application log.
Messages are collected in t/e unction module CRM*M+<<48+*CO::+C'deleted in CRM*M+<<48+<*-+:+'+.CRM*M+<<48+<*<+4RC can be used to searc/ or messages.
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 41/44
CRM Programming Fundamentals
NP chec ob-ect !or errors CA,, (#CT$O FCRM_ME//A"E/_CHEC_(OR_ERROR/F
E:4ORT$"
i0_re!_ob-ect > i0_ob-_*uid
i0_re!_ind > i0_ob-_ind E:CE4T$O/
errors_e8ist > @
OTHER/ > . $( sysubrc E L. Sno errors
E:$T.
ED$(.
NP search !or error messa*es
CA,, (#CT$O FCRM_ME//A"E/_/EARCHF E:4ORT$"
i0_re!_ob-ect > i0_ob-_*uid
i0_re!_ind > i0_ob-_ind $M4ORT$"
et_ms*_handle > lt_ms*_handle
E:CE4T$O/ appl_lo*_error > @
error_occurred >
OTHER/ > B. $( sysubrc E L. Serror
4ER(ORM ms*_add #/$" ms*ty_s syms*id syms*no syms*0@ syms*0 syms*0B syms*0
CHA"$" p_t_ms*. E:$T.
ED$(.
N !ill messa*e tab
,OO4 AT lt_ms*_handle $TO ls_lo*_ms*_handle.
CA,, (#CT$O F3A,_,O"_M/"_READF E:4ORT$"
i_s_ms*_handle > ls_lo*_ms*_handle
$M4ORT$" e_s_ms* > ls_lo*_ms* E:CE4T$O/
lo*_not_!ound > @
ms*_not_!ound > OTHER/ > B.
$( sysubrc <= L.
4ER(ORM ms*_add #/$" ms*ty_s syms*id syms*no
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 42/44
CRM Programming Fundamentals
syms*0@ syms*0 syms*0B syms*0
CHA"$" p_t_ms*. E,/E.
4ER(ORM ms*_add #/$" ls_lo*_ms*ms*ty
ls_lo*_ms*ms*id
ls_lo*_ms*ms*no ls_lo*_ms*ms*0@
ls_lo*_ms*ms*0
ls_lo*_ms*ms*0B ls_lo*_ms*ms*0
CHA"$" p_t_ms*.
$( ls_lo*_ms*ms*ty E ms*ty_e OR ls_lo*_ms*ms*ty E ms*ty_a.
p_error_occured > abap_true.
ED$(. ED$(.
ED,OO4.
ED(ORM. S chec_ob-ect_!or_errors
7ote:-
The !unction module ‘CRM_ME//A"E_CO,,ECT’ +ill add messa*e to display in the
+indo+ at the top o! transaction CRMD_ORDER.
5ou can use !unction module N$T,A5N to *et the "#$D !or the document you are processin*. 3ecause the $nteraction ,ayer is populated +hen there is (unction Module
processin* lie CRM_ORDER_READ) CRM_ORDER_MA$TA$) etc?
. O0er0iew o Customiing
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 43/44
CRM Programming Fundamentals
'ransactions
#tem categories
Copying control
ricing
8/17/2019 CRM Programming - Copy
http://slidepdf.com/reader/full/crm-programming-copy 44/44
CRM Programming Fundamentals
1(. elpul Reports
Re)ort Function
CRM8M"&&A0"& 5ou can use this report to in!luence the !ollo+in*
parameters1
• De*ree o! usa*e %de*ree o! detail'
The de*ree o! detail speci!ies +hich user recei0es+hat ran*e o! messa*es. The ( help pro0ides you
+ith the possible 0alues !or selection. % > 3DOCs
are sho+n in the order'
CRM8%RD"R8R"AD Read orders +ith CRM_ORDER_READ
CRM8%RD"R8D"'"T" Delete orders +ith CRM_ORDER_DE,ETE
CRM8%RD"R8MA7TA7 Maintain orders +ith CRM_ORDER_MA$TA$
CRM8%D"8CH"C8D%C CRM data e8chan*e o! customer orders1 Chec
documents concernin* inconsistency