SAP CRM & SAP Solution Manager

Transcription

www.hybrid-eichhoernchen.deSAP CRM & SAP Solution ManagerBusiness Transaction Search EnhancementHow to implement business transaction search enhancementswith minimum development?04.09.2015Peter WeigelHyazinthenstr. 6D-06122 Halle / SaalePhone: 49 170 5337567E-Mail: peter.weigel@hybrid-eichhoernchen.deWeb: www.hybrid-eichhoernchen.de

Introduction 3Goal of this guide3Context3Example Requirements3Versions History6Literature, Disclaimer, Contact and Download622.12.22.32.42.5Preparations 7Package7Structure for field enhancements7Append to search and result list structure7Maintenance Views8Dynamic Result List Data Retrieval933.13.23.33.43.53.6Field enhancements 12Enhancement of Search Criteria and Result List Structure12Registration of Table for Dynamic Reporting14Registration of field for Dynamic Reporting17Enabling of SAP standard field for dynamic reporting18Search Operator Configuration19Enable Search Help and Value Conversation2044.14.24.34.44.5Development notes 24SCN articles24Classes and Methods for break points24Business Add-ins24Testing25Known bug in standard25Business Transaction Search Enhancement Peter WeigelPage 2 of 25

www.hybrid-eichhoernchen.de1Introduction1.1Goal of this guideThis guide explains how to enhance Business Transaction search with lessdevelopment activities.1.2ContextThere exist several guides in SCN. These guides always explain how to do bigdevelopments in context of search enhancement. These big development activities areneeded if we need special value helps or if we need to adjust existing selection criteriaor result list or if we want to enhance other searches than business transaction search.In most cases we simply want to add some additional search criteria and result listfields. In these cases, we are able to implement this low effort solution with minimumdevelopment.1.3Example RequirementsWe want to search about unsupported standard and customer fields of ChangeTransaction:1. Risk and Change Category:CRMD SRV REQ H:a. RISKb. CHANGE CATEGORYWe want to search by Risk and Change Category. However IMPACT,URGENCY and /AICRM/PROBLEM CATEGORY are already supported bystandard.Business Transaction Search Enhancement Peter WeigelPage 3 of 25

www.hybrid-eichhoernchen.de2. Third Party Ticket Number:ICT INCIDENTGUID:a. ICT GUIDWe want to search by Third Party Ticket number. However Searching by ThirdParty Attributes is not supported by standard yet. There exists an attribute/AICRM/ICT NUM in standard which seems not to work yet.3. Predecessor Transaction (i.e. CD- CR or CR- INC):SRRELROLES CRMD BINREL or CRMD BRELVONAEa. SRRELROLES OBJKEY or CRMD BRELVONAE OBJGUID B SELb. CRMD ORDERADM H OBJECT IDBusiness Transaction Search Enhancement Peter WeigelPage 4 of 25

www.hybrid-eichhoernchen.deWe want to search a Change Document by a given Change Request. Thereforewe need to read the document flow.Business Transaction Search Enhancement Peter WeigelPage 5 of 25

www.hybrid-eichhoernchen.de1.4Version HistoryVersionAuthorDate1Peter Weigel01.07.2015Search for Risk, Change Categoryand Third Party Ticket Number2Peter Weigel04.09.2015Search for CD by CR Number1.5CommentLiterature, Disclaimer, Contact and DownloadLiteratureThis document is based on information from SAP Online Library, Implementation Guideof SAP Solution Manager 7.1, several SAP Notes and several SCN articles. Thesepiece of information were enriched by the authors knowledge and en.de/rechtliche-hinweise/ContactPeter WeigelHyazinthenstr. 6D-06122 Halle / SaalePhone: 49 170 5337567E-Mail: peter.weigel@hybrid-eichhoernchen.deWeb: www.hybrid-eichhoernchen.deDownloadYou are allowed to download the latest version of this document for free: www.hybrideichhoernchen.de.Business Transaction Search Enhancement Peter WeigelPage 6 of 25

www.hybrid-eichhoernchen.de2PreparationsThis guide describes a solution to enhance the Business Transaction Search withoutdevelopment activities. The first time you enhance the search you have to do somedevelopment activities. These developments need to implement once. They are usedfor all further enhancements which can then be done without further developments.2.1PackageWe need a development package ZSEARCH or similar. Please create it via SE80.2.2Structure for field enhancementsWe need a structure which will contain all additional attributes used for search andresult list. Please create structure ZSEARCH FIELDS via SE80 or SE11. At thebeginning it can be empty or contain a dummy field ZZSEARCH DUMMY.2.3Append to search and result list structureWhen we look at the Search UI Component in the SAP Web Client UI we will find outthat business objects BTQAICSearch and BTQRAISearch are used by SAP SolutionManager IT Service Management and SAP Solution Manager Change RequestManagement (for example we could have a look at UI component AIC CMCR S) .When we look at BOL/GenIL Model Browser (GENIL MODEL BROWSER) or incustomizing table CRMC OBJ BTIL, we will find out, that these objects will support allfieldsofstructureCRMST QUERY SRV REQ BTILresp.CRMST QUERY R SRV REQ BTIL. (BTW: when you are looking for the handlerclass of search & result object, you will find it in table CRMC OBJ BTIL too. However,you will need to add “ RUN BTIL” to the found name.)Therefore we need to enhance these structures. Please append structuresCRMST QUERY SRV REQ BTIL with append ZSEARCH SEARCH CRITERIA andstructureCRMST QUERY R SRV REQ BTILwithappendZSEARCH RESULT LIST. Both append structures should include structureZSEARCH FIELDS.Caution: If we want to enhance another search component, we will need to find out theright structures and to append these structures instead.Business Transaction Search Enhancement Peter WeigelPage 7 of 25

www.hybrid-eichhoernchen.deNote: Application Enhancement Tool (AET) always appends structuresINCL EEW BUS2000223 SEARCH and INCL EEW QUERY R SRVI BTIL whichare included in the mentioned structures. However we could do it the same.Please append structure CRMT REPORT LOCATORLIST in the same way. Thisstructure is used by the framework reading the data for ther result list.2.4Maintenance ViewsIn SAP standard we will always need to do a development to implement value helps foradded search criteria and result lists (for result lists we need value helps to translatekeys to user friendly texts). In SAP standard value helps need to be developed byimplementing a value help getter method. Because of technical reasons we need toimplement it on view controller level instead on context node level. In most cases we willneed only one code line here using method get v for ddlb (Please have a look atmethod GET V IMPACT of class CL CRM SRQM COMMON SR CNTRL).However if the added fields are regarded as created via Application Enhancement Tool(AET), we will get the value help for free without any development.Business Transaction Search Enhancement Peter WeigelPage 8 of 25

www.hybrid-eichhoernchen.deTo open this way we need to create maintenance dialogs for following tables. Pleasecreate maintenance views including maintenance dialogs (function groupZSEARCH TMD) for following customizing tables: CRMC Q1O FIELDS (ZSEARCH Q1O FLDS) AXT RUN FIELDDEF (ZSEARCH FIELDDEF) AXT RUN FIELDUSE (ZSEARCH FIELDUSE) AXT RUN BP PARTT (ZEARCH BP PARTT) AXT RUN BO PART (ZSEARCH BO PART) AXT RUN SEARCH (ZSEARCH SEARCH) AXT RUN FLAG (ZSEARCH FLAG)2.5Dynamic Result List Data RetrievalData reading for result list is only supported for foreseen object party likeORDERADM H, ACTIVITY H, SERVICE H, SRV REQ H and so on. The SAPstandard is not able to get data from previous unknown tables. But this is needed to beable to enhance search criteria and result list fields.Therefore we needed to enhance the standard. Please implement the following sourcecodeattheendofmethodGET EXTENSIONofclassCL CRM REPORT EXT *********************************************** PROGRAM ID: ZSEARCH** PROGRAM TITLE: Dynamic Search Enhancement** AUTHOR: Peter Weigel** SUPPLIER: SAP** DATE: 01/07/2015*Business Transaction Search Enhancement Peter WeigelPage 9 of 25

www.hybrid-eichhoernchen.de* DEVELOPMENT ID:** CHANGE REQUEST (CTS) :** DESCRIPTION: Dynamic data read for unsupported fields** ** CHANGE HISTORY -------------------------------------** MOD. NO. DATE NAME CORRECTION NUMBER CHANGE REFERENCE -----------------------------------** MOD-001 01/07/2015 PETER WEIGEL 1 ****DESCRIPTION: First ******************************************DATA:zls repdyzls repdy dbzlv selectzlv fromzlv whereTYPETYPETYPETYPETYPEcrmc repdy,crmc repdy db,string,string,string.FIELD-SYMBOLS: zfs requested column LIKE LINE of gt requested columns, zfs extension TYPE any, zfv value TYPE any.*Process every requested field.LOOP AT gt requested columns ASSIGNING zfs requested column .*Check whether field is not already read.READ TABLE gt read columnstransporting no fieldsWITH KEY column zfs requested column -column.CHECK sy-subrc 0.*Get dynamic field definition.SELECT SINGLE *INTO zls repdyFROM crmc repdyWHERE sel field zfs requested column -column.CHECK sy-subrc 0.*Get dynamic table definition.SELECT SINGLE *INTO zls repdy dbFROM crmc repdy dbWHERE dyn method zls repdydyn method AND only header abap true. "we only support header level yet.CHECK sy-subrc 0.*Build dynamic SQL query. (for details have a look at CL CRM REPORT ACC DYNAMIC- BUILD DYN SQL)zlv select zls repdy-name on db.*zlv from CRMD ORDERADM H && zls repdy db-from if not lead && zls repdy dbjoin header guid && CRMD ORDERADM H GUID && && zls repdy db-remain from.zlv from zls repdy db-leading table && && zls repdy db-remain from.zlv where zls repdy db-join header guid && ' zfs extension -guid'.*Mark field as read.INSERT zfs requested column INTO TABLE gt read columns.*Process every Business Transaction.LOOP AT et extension[] ASSIGNING zfs extension .*Get access to field.ASSIGN COMPONENT zfs requested column -column OF STRUCTURE zfs extension TO zfv value .CHECK sy-subrc 0.*Get data if possible.SELECT SINGLE (zlv select)Business Transaction Search Enhancement Peter WeigelPage 10 of 25

www.hybrid-eichhoernchen.de*INTO zfv value FROM (zlv from)WHERE crmd orderadm h guid zfs extension -guid.WHERE (zlv where).ENDLOOP.ENDLOOP.Business Transaction Search Enhancement Peter WeigelPage 11 of 25

www.hybrid-eichhoernchen.de3Field enhancements3.1Enhancement of Search Criteria and Result List StructurePlease add your fields to structure ZSEARCH FIELDS. It will automatically extendstructures CRMST QUERY SRV REQ BTIL, CRMST QUERY R SRV REQ BTILand CRMT REPORT LOCATORLIST. Because of this fact, the added fields will beavailable as search criteria and result list field.Please ensure that you added check tables and search helps here, otherwise the valuehelp determination could not work.However the added fields can only be used if you enabled the fields as search criteriaand result list field via UI configuration. Therefore please perform the UI configuration.We did it for RISK, CHANGE CATEGORY, ICT GUID and PREDECESSOR GUIDand PREDECESSOR ID. Data elements and check tables were overtaken from tablesCRMD SRV REQ H, ICT INCIDENTGUID and CRMD ORDERADM H.However even if RISK, CHANGE CATEGORY and PREDECESSOR GUID are wellknown standard fields, which would be supported by search automatically if we wouldadd them by their origin name, we decided to choose a different name in customernamespace. Now we have a little bit more effort in configuration but we prevent futureconflict issues and we avoid searching another solution for structureCRMT REPORT LOCATORLIST (where these fields already exist).Caution: If you extend search and/or result list by sap standard fields, it might happen,that SAP adds this fields in future. In this case your structure enhancement will causesyntax error because the field will then be defined twice. This error will come up onSPDD. If this happens, you will need to remove your field definition and to check thecustomizing mentioned before and after this section. To avoid this conflict issue youcould use customer namespace in all cases even if you want to enable sap standardfields. However if you do that, you avoid the conflict issue but you will never have thechance to go back to standard.Caution: If you extend search and/or result list by sap standard fields, it might happen,that your extension can not be activated because the added fields are already includedin structure CRMT REPORT LOCATORLIST. In this case you have to split the contentof structure ZSEARCH FIELDS into fields already supported by reporting and fieldswhich are not supported yet.Business Transaction Search Enhancement Peter WeigelPage 12 of 25

www.hybrid-eichhoernchen.deThe search help for PREDCESSOR ID was build by our own, because ApplicationEnhancement Toolset (AET) is very rigorous when using search helps. No existingsearch help for CRMT OBJECT ID or CRMT OBJECT ID DB can be used becausethey always return more that one parameter, but AET alows only searchhelps with exactone return parameter.Business Transaction Search Enhancement Peter WeigelPage 13 of 25

www.hybrid-eichhoernchen.de3.2Registration of Table for Dynamic ReportingThe search is done by a big SQL select statement which is built automatically based ondefinition in table CRMC REPDY DB. Therefore please add your table in customizingtable CRMC REPDY DB, if you have a new table.However CRMD SRV REQ H is already supported. There is nothing to do.(SELECT * FROM CRMD SRV REQ H WHERE GUID HEADER GUID )(SELECT * FROM CRMD ORDERADM H INNER JOIN CRMD SRV REQ H ONCRMD SRV REQ H GUID CRMD ORDERADM H GUIDWHERECRMD ORDERADM H GUID HEADER GUID )Table ICT INCIDIENTGUID is not supported yet. Therefore we needed to extend theSQL statement here. ICT INCIDENTGUID has the specialty that the Order GUID is informat CHAR32 whereas all other tables use RAW16. Therefore a direct join is notpossible. We need to do a translation for example by using tableTSOCM CR CONTEXT (here we hope that there will always exist an entry, that GUIDand ITEM GUID will always be equal but GUID will be in format RAW16 andITEM GUID in format CHAR32). If that is not the case, we need to use another table orwe will need to use a customer field which always will have the Order GUID in formatCHAR32 for example updated on first save.To reduce complexity we decided to create a database view first.Business Transaction Search Enhancement Peter WeigelPage 14 of 25

www.hybrid-eichhoernchen.de(SELECT * FROM ZSEARCH ICTGUID WHERE GUID HEADER GUID )(SELECT * FROM CRMD ORDERADM H INNER JOIN ZSEARCH ICTGUID ONZSEARCH ICTGUID GUID CRMD ORDERADM H GUIDWHERECRMD ORDERADM H GUID HEADER GUID )For predecessor relationship, we expected to create and use a database view fordatabase tables (TSOCM CR CONTEXT,) SRRELROLES, CRMD BINREL andORBRELTYP.*SQL Statement to get/validate Change Request for a given Change DocumentSELECT SINGLE crmd orderadm h object idINTO CORRESPONDING FIELDS OF ls orderadm hFROM crmd orderadm hJOIN tsocm cr context AS nachfolger context ON nachfolger context guid crmd orderadm h guidJOIN srrelroles AS nachfolger role ON nachfolger role objkey nachfolger context item guidBusiness Transaction Search Enhancement Peter WeigelPage 15 of 25

www.hybrid-eichhoernchen.deAND nachfolger role objtype 'BUS2000116' AND nachfolger role roletype 'NACHFOLGER'JOIN crmd binrel AS vona binrel ON vona binrel role b nachfolger role roleidAND vona binrel breltyp 'VONA'JOIN srrelroles AS vorgaenger role ON vorgaenger role roleid vona binrel role aAND vorgaenger role objtype 'BUS2000116' AND vorgaenger role roletype 'VORGAENGER'JOIN tsocm cr context AS vorgaenger context ON vorgaenger role objkey vorgaenger context item guidJOIN crmd orderadm h AS vorgaenger head ON vorgaenger context guid vorgaenger head guidWHERE crmd orderadm h guid ' GUID '.However this is not needed since there exists table CRMD BRELVONAE and amatching entry for it. (Note: For all other relationships we have to go the long way!)But unfortunately we need GUID (for result list) and ID (as search criteria) of thepredecessor. But CRMD BRELVONAE gives us only the GUID. Therefore we need ourown version of CRMD BRELVONAE as database view:Business Transaction Search Enhancement Peter WeigelPage 16 of 25

www.hybrid-eichhoernchen.deAnd therefore we can not use the SAP standard version.3.3Registration of field for Dynamic ReportingUsing and joining a table is not enough. We need to specify the fields in customizingtable CRMC REPDY. Here we need to give them a name which is unique for theSearch Object and the Result List Object. Please do it for your fields.However, RISK and CHANGE CATEGORY are already specified in sap standard.There would be nothing to do for us, if we would choose the origin names. But wedecided to choose different names. Therefore we needed to copy the settings.We registered field ICT GUID here and linked it to the previous mentioned configurationvia “Dynamic Access Name”.We also registered field PREDECESSOR GUID and PREDECESSOR ID by copyingand adjusting existing the entry PREDGUID BRELVONAE.Business Transaction Search Enhancement Peter WeigelPage 17 of 25

www.hybrid-eichhoernchen.de3.4Enabling of SAP standard field for dynamic reportingFor a field not being part of namespace Z*, Y* or /* we need a registration in tableCRMC Q1O FIELDS (ZSEARCH Q1O FLDS), otherwise it could be not used forsearching / filtering. Therefore please add an entry here or always use customernamespaces even if the field is a sap standard field.However RISK, CHANGE CATEGORY and PREDGUID BRELVONAE were alreadyregistered here. But we are using different names in customer namespace. Thereforewe don’t need to care about these settings.Business Transaction Search Enhancement Peter WeigelPage 18 of 25

www.hybrid-eichhoernchen.deCaution: It might happen that the content will be overwritten by SAP during upgradebecause table is released for SAP internal use only.Caution:BecausethefieldsRISK,CHANGE CATEGORYandPREDGUID BRELVONAE are supported by SAP standard reporting framework but aremissing in structures for search criteria and result list of SAP Solution Manager ITService Management and Change Request Management Search, it would be very easyfor SAP to allow/activate these fields. Therefore please check after every upgradewhether these fields are now supported by SAP standard completely. If yes, you shouldgo back to standard.3.5Search Operator ConfigurationAs mentioned in SAP note 1991218 “Customized search operators disappear in CRMUI” we need to configure allowed search operators in the IMG activity called “DefineOperators for Dynamic Queries”. Therefore please do it for your added fields. Otherwiseonly “Equal” will be supported.We did it in the following way:Business Transaction Search Enhancement Peter WeigelPage 19 of 25

www.hybrid-eichhoernchen.de3.6Enable Search Help and Value ConversationIn table AXT RUN FIELDDEF (ZSEARCH FIELDDEF) we register our fields toactivate the extended value help determination. All information can be empty exceptFIELD ID and LOCATION. The LOCATION can be empty or should contain the nameof a structure containing this field including search helps and/or check tables. To enablea real value help drop down box we need to specify some more information (especiallythe behavior CHECKTABLE2DDLB). Please register your fields here. WithoutCHECKTABLE2DDLB you will get a value help popup in case of value help request.Business Transaction Search Enhancement Peter WeigelPage 20 of 25

www.hybrid-eichhoernchen.de(Note: Because of NAV OBJECT and SERVICE ORDER the GUID will be translated inNumber and Description on display in result list. You can click on this text to navigate tothis object/entity.)Business Transaction Search Enhancement Peter WeigelPage 21 of 25

www.hybrid-eichhoernchen.de(Note: The search help needs to be mentioned here even it is already mentioned indefinition of structure ZSEARCH FIELDS.)In table AXT RUN FIELDUSE (ZSEARCH FIELDUSE) we assign the fields to beused only in context of Business Transactions. Please register your fields here.Table AXT RUN BO PARTT (ZSEARCH BO PARTT) is used to register completetables as extension table. For Change Request Management we always useSERVICE REQUEST FOR CHANGE. The field EXT BO PART should always beORDERADM H if this table enhancement is a header enhancement instead of itemenhancement. This configuration might not be needed at the moment.Table AXT RUN BO PART (ZSEARCH BO PART) is used to assign the fields to acertain object part. For Change Request Management we always useSERVICE REQUEST FOR CHANGE. The field EXT BO PART is only a logicalgrouping without technical meaning. Please add your fields here.Business Transaction Search Enhancement Peter WeigelPage 22 of 25

www.hybrid-eichhoernchen.deIn table AXT RUN SEARCH (ZSEARCH SEARCH) we enable the field for searchingand resulting including value help determination and value translation. Please add yourfields here and flag it.(Note: Even we flag ZZSEARCH PREDECESSOR GUID as search criteria, it is nogood idea to use it as search criteria. Of course It will be displayed and you will get anavigation object dependent search help. But this search help is optimized for realservice orders, and therefore not optimal to search for change requests. After youselected a transaction, the GUID will be displayed as search value. This is not userfriendly. This is why we should use field ZZSEARCH PREDECESSOR ID as searchcriteria and ZZSEARCH PREDECESSOR GUID as result list field.)However there exists a second table AXT RUN FLAG (ZSEARCH FLAG) whichcontains the enabling flags too. But these flags seem not to be needed yet, so we canignore this table (at the moment).Business Transaction Search Enhancement Peter WeigelPage 23 of 25

www.hybrid-eichhoernchen.de4Development notes4.1SCN ransaction Search M/How to add an existing field to a search page of a different es and Methods for break pointsCL CRM Q1O SEARCH This class is used for searching by all One order search componentsCL CRM REPORT ACC DYNAMIC- BUILD DYN SQL Build the SQL statement for selectionCL CRM REPORT ACC DYNAMIC- DATABASE ACCESS Perform the dynamic selectionCL CRM REPORT EXT LOCATORLIST- REQUEST NEW COLUMNS Read data for result list by performing dynamic method calls.CRM BSP OIC 1O SEARCH FROM RF Standard routine for selection. Used by standard or BADI implementation.CRM BSP OIC 1O READ FROM RF Standard routine for result list data reading. Used by standard or BADIimplementation.4.3Business Add-insFollowing BADI definitions are used to implement the search and data retrieval.However there can be only one implementation per search object.Business Transaction Search Enhancement Peter WeigelPage 24 of 25

www.hybrid-eichhoernchen.de crm badi rf q1o searchcrm badi rf q1o readcrm badi rf q1o calculatecrm badi rf q1o filterCRM RF SEARCH EEW4.4TestingYou can test your solution without SAP Web Client UI by using Browser for BusinessObject Layer (GENIL BOL BROWSER) with component set “ONEORDER”.4.5Known bug in standardApplication enhancement tool says that it is able to enhance the One Order Model bynew customer tables including use as search criteria and result list fields. This is wrong. Because of a configuration error, the generation of a customer table with result listsupport will abort. Please be sure that you correct the following configuration intransaction AXTREG before starting generation. (in standard the leading “I” ismissing) The result list fields will always be empty because in sap standard there is nodynamic data retreival solution. If our solution 2.5 is implemented it should work.Business Transaction Search Enhancement Peter WeigelPage 25 of 25

In SAP standard we will always need to do a development to implement value helps for added search criteria and result lists (for result lists we need value helps to translate keys to user friendly texts). In SAP standard value helps need to be developed by implementing a value help getter method. Because of technical reasons we need to