{"id":68927,"date":"2021-08-08T04:10:06","date_gmt":"2021-08-08T08:10:06","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/sap-crm-webshop-how-to-call-custom-function-modules-63\/"},"modified":"2021-08-08T04:10:06","modified_gmt":"2021-08-08T08:10:06","slug":"sap-crm-webshop-how-to-call-custom-function-modules-63","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=68927","title":{"rendered":"SAP-CRM-WEBSHOP: How to call custom Function Modules #63"},"content":{"rendered":"<p>[It&#8217;s a little tricky &#8211; I really should re-write this.]<br \/>  Pre-requisite: knowledge in J2EE, Struts, SAP CRM Webshop, HTML <br \/>What this article will provide? Just a very upper level description on how to call your own function modules, or  SAP built-in function modules that are not called by the standard application\/webshop.<\/p>\n<p>What are function modules? <\/p>\n<p>SAP provides many different function modules to execute different operations [back end operations]. You can also consider them as stored procedures in traditional DBMSs like Oracle, SQL Server, MySQL, and PostGreSQL. Usually, you call the backend stored procedures from the front end [say Java programs], supply some input parameters to the stored procedures, and collect outputs for further processing [or just display]. Same is true for SAP. In CRM Webshop, one strategy is that you can have backend objects in your applications and these backend objects can have functions that execute the function modules.<\/p>\n<p>An example:<\/p>\n<p>From a JSP page when the form is submitted, you want to execute a custom function module [written by you]. The JSp page will collect shopId from the user and display the shop description. Your function module will retrieve the shop description and pass it to the JSP\/Java program for display.<\/p>\n<p>Implementation Requirements: You will need to implement a business object, a backend object, a custom business object manager. Also, you will need to  register these objects in the Internet Sales Framework (SAP-ISA).<\/p>\n<p>Steps: In the JSP page create a text box to collect the shop id, and refer the form action to the custom action (z_test.do) as  action=&#8221;z_test.do&#8221;. Map the action z_test.do to the action class Z_CustomAction in your configuration file named config.xml as follows:<\/p>\n<p>When users will provide the shop id and click on the submit button the doPerform() method of the class Z_CustomAction will be executed. In the Z_CustomAction class, in the doPerform() method,  you have to get a reference to the custom business object manager(bom) as <\/p>\n<p>Z_CustomBusinessObjectManager myBOM =            (Z_CustomBusinessObjectManager)userSessionData.                getBOM(Z_CustomBusinessObjectManager.CUSTOM_BOM);<br \/>[you need to write this BOM class Z_CustomBusinessObjectManager also. userSessionData is the sap wrapped session object]<\/p>\n<p>then use the custom BOM object (myBOM)  to retrive the CustomBasket [Basket = shopping\/order basket] as<\/p>\n<p>myBOM.getCustomBasket()<\/p>\n<p> where the CustomeBasket is of Z_CustomFunc type [i.e. myBOM.getCustomBasket() returns Z_CustomFunc type object, You need to write Z_CustomFunc  class as well]. <\/p>\n<p>Then call the getShopDescription(id) method of the Z_CustomFunc class as <\/p>\n<p>String shopDescr = myBOM.getCustomBasket().getShopDescription(shopId); <\/p>\n<p>As mentioned that the custom basket is of type Z_CustomFunc class with methods such as  getShopDescription(id) [getShopDescription of  Z_CustomFunc eventually will go to the lowest level to call the function module]. In Z_CustomFunc class in getShopDescription(id), you will call the getShopDescription(id) method of the backend object Z_CustomFuncBackend [you have to write the interface] as <\/p>\n<p>return getCustomBasketBackend().getShopDescription(shopId);<\/p>\n<p>[In getShopDescription(id) method of Z_CustomFunc] <br \/>here through getCustomBasketBackend()[method of Z_CustomFunc] you get a reference to the backend object Z_CustomFuncBackend, then call the method getShopDescription of Z_CustomFuncBackend. In getCustomBasketBackend() method, you practically create the backend object Z_Custom of Z_CustomFuncBackend type. Then you map Z_Custom to Z_CustomFuncCRM class\/object in the backendobject-config.xml file. Then, in Z_CustomFuncCRM, you need to define the method  getShopDescription(id) where the actual\/lowest level call to the function module will be done as follows:<\/p>\n<p>JCO.Function func = getDefaultJCoConnection().getJCoFunction(&#8220;CRM_ISA_SHOP_GETLIST&#8221;);<br \/>                                func.getImportParameterList().setValue(&#8220;B2B&#8221;, &#8220;SCENARIO&#8221;);<br \/>                getDefaultJCoConnection().execute(func); <\/p>\n<p>CRM_ISA_SHOP_GETLIST is the name of the underlying custom function module. Also, in this method, you can write code to collect information from the function module for further processing or display.<b>Configurations<\/b><br \/>backendobject-config.xml for Z_Custom backend object <\/p>\n<p>Also, list your BOM in the config file bom-config.xml as <\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-Additional Information&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>BOM class that have functions to get\/point to the custom basket, bom gets reference to the custom basket through backend object manager as <\/p>\n<p>mCustomBasket = new Z_CustomFunc();<br \/>            assignBackendObjectManager(mCustomBasket);<br \/>mCustomBasket is the custom basket to be returned <\/p>\n<p>&#8212;Z_CustomFunc has methods like<\/p>\n<p>getShopDescription: that calls <br \/>getCustomBasketBackend().getShopDescription(shopId);<\/p>\n<p>where getCustomBasketBackend() Returns a reference to the backend object  Z_CustomFuncBackend that you also need to write. CustomFuncBackend  is just an interface with method declaration such as getShopDescription(id)<\/p>\n<p>Also, you need to write a class that handles the function module call and data retrieval say Z_CustomFuncCRM withgetShopDescription(id) function that may include:<\/p>\n<p>JCO.Function func = getDefaultJCoConnection().getJCoFunction(&#8220;CRM_ISA_SHOP_GETLIST&#8221;);<br \/>                   func.getImportParameterList().setValue(&#8220;B2B&#8221;, &#8220;SCENARIO&#8221;);<br \/>                                getDefaultJCoConnection().execute(func);<\/p>\n<p>&#8212;&#8211;Reference: SAP CRM ECommerce &#8211; Development and Extension Guide<\/p>\n<p>From: http:\/\/sitestree.com\/?p=5026<br \/> Categories:63<br \/>Tags:<br \/> Post Data:2013-03-24 12:36:42<\/p>\n<pre><code>    Shop Online: &lt;a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\"&gt;https:\/\/www.ShopForSoul.com\/&lt;\/a&gt;\n    (Big Data, Cloud, Security, Machine Learning): Courses: &lt;a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"&gt; http:\/\/Training.SitesTree.com&lt;\/a&gt; \n    In Bengali: &lt;a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\"&gt;http:\/\/Bangla.SaLearningSchool.com&lt;\/a&gt;\n    &lt;a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\"&gt;http:\/\/SitesTree.com&lt;\/a&gt;\n    8112223 Canada Inc.\/JustEtc: &lt;a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\"&gt;http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) &lt;\/a&gt;\n    Shop Online: &lt;a href='https:\/\/www.ShopForSoul.com'&gt; https:\/\/www.ShopForSoul.com\/&lt;\/a&gt;\n    Medium: &lt;a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"&gt; https:\/\/medium.com\/@SayedAhmedCanada &lt;\/a&gt;\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>[It&#8217;s a little tricky &#8211; I really should re-write this.] Pre-requisite: knowledge in J2EE, Struts, SAP CRM Webshop, HTML What this article will provide? Just a very upper level description on how to call your own function modules, or SAP built-in function modules that are not called by the standard application\/webshop. What are function modules? &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=68927\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917],"tags":[],"class_list":["post-68927","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":68925,"url":"http:\/\/bangla.sitestree.com\/?p=68925","url_meta":{"origin":68927,"position":0},"title":"What to learn for SAP Ecommerce #63","author":"Author-Check- Article-or-Video","date":"August 8, 2021","format":false,"excerpt":"Why SAP? SAP is the most dominating company in the Business Application World. Yes, SAP is for big enterprises [SAP recently released software for small and mid-size companies]. The earnings of the SAP professionals are also very high. Microsoft is dominant mostly in the personal computer software\/os domains. However, SAP,\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":68921,"url":"http:\/\/bangla.sitestree.com\/?p=68921","url_meta":{"origin":68927,"position":1},"title":"How to call SAP Function Module\/RFC from Java #63","author":"Author-Check- Article-or-Video","date":"August 8, 2021","format":false,"excerpt":"Calling an SAP Function Module from Java RFC Interfaces and Java Proxy Example: Using Generated Proxies to Call Function Modules JCO and Function Module JCO Function: java From: http:\/\/sitestree.com\/?p=4988 Categories:63Tags: Post Data:2010-10-22 20:50:44 Shop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a> (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\">\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":68919,"url":"http:\/\/bangla.sitestree.com\/?p=68919","url_meta":{"origin":68927,"position":2},"title":"SAP Overview #63","author":"Author-Check- Article-or-Video","date":"August 8, 2021","format":false,"excerpt":"Introduction to ERP and SAP Enterprise Resource Planning (ERP) - helps to manage and operate business processes effectively and in an integrated\/co-ordinated fashion. The integration nature helps businesses to understand their business\/business processes more effectively and make decision intelligently ERP makes use of IT to integrate all business processes into\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":68985,"url":"http:\/\/bangla.sitestree.com\/?p=68985","url_meta":{"origin":68927,"position":3},"title":"How product pricing is done in SAP (CRM) #63","author":"Author-Check- Article-or-Video","date":"August 9, 2021","format":false,"excerpt":"Setting Up Pricing (CRM Online) Pricing (mySAP SRM Online) From: http:\/\/sitestree.com\/?p=5060 Categories:63Tags: Post Data:2013-06-10 17:39:45 Shop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a> (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a> In Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a> <a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a> 8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":69099,"url":"http:\/\/bangla.sitestree.com\/?p=69099","url_meta":{"origin":68927,"position":4},"title":"Stored Procedure in MySql #5","author":"Author-Check- Article-or-Video","date":"August 12, 2021","format":false,"excerpt":"Starting from MySQL 5, you get Stored Procedure in Mysql What is a stored procedure: A stored procedure is simply a procedure that is stored on the database server like MySQL. In programming languages, you write procedures to execute a function\/logic. You can write similar procedure in SQL and store\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":75827,"url":"http:\/\/bangla.sitestree.com\/?p=75827","url_meta":{"origin":68927,"position":5},"title":"MS SQL Server Dynamic SQl, T-SQL","author":"Sayed","date":"June 25, 2023","format":false,"excerpt":"MS SQL Server Dynamic SQl, T-SQL Mostly: Dynamic SQL Stored Procedure Trigger Cursor Function Sayed Ahmed What are the Most Important Most Used Design ERD Convert ERD to database Normalization Indexing SQL Stored Procedure Dynamic SQL These will come, not too frequent Function, User Defined Data Types, Temporary Table Trigger,\u2026","rel":"","context":"In &quot;\u09ac\u09cd\u09b2\u0997 \u0964 Blog&quot;","block_context":{"text":"\u09ac\u09cd\u09b2\u0997 \u0964 Blog","link":"http:\/\/bangla.sitestree.com\/?cat=182"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/68927","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=68927"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/68927\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=68927"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=68927"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=68927"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}