{"id":1174,"date":"2010-11-25T16:34:00","date_gmt":"2010-11-25T15:34:00","guid":{"rendered":"http:\/\/websha.de\/xstepcafe\/?p=1174"},"modified":"2018-06-01T06:45:20","modified_gmt":"2018-06-01T04:45:20","slug":"integrating-safety-symbols-in-the-pi-sheet","status":"publish","type":"post","link":"https:\/\/websha.de\/xstepcafe\/2010\/11\/25\/integrating-safety-symbols-in-the-pi-sheet\/","title":{"rendered":"Integrating Safety Symbols in the PI Sheet"},"content":{"rendered":"<p>In my <a href=\"http:\/\/websha.de\/xstepcafe\/2008\/09\/03\/xstep-cafe-session-4\/\">4th session<\/a> I presented a weighing demo which included also material dependent safety symbols. In this article I would like to show how to accomplish this.<\/p>\n<p><!--more--><\/p>\n<h1>The Look<\/h1>\n<p>Let me first show how the symbols look like in my setup. Picture 1 shows the list of components with the column &#8216;Safety&#8217; containing small safety symbols. There are some materials that have symbols and some that don&#8217;t. So the content of this column depend on the material. in picture 2 you see the detailed weighing instruction with larger safety symbols to remind the operator again what to look out for.<\/p>\n<div style=\"width: 716px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" title=\"Picture 1: Component Overview\" src=\"http:\/\/websha.de\/xstepcafe\/wp-content\/uploads\/2010\/11\/moz-screenshot-5.png\" alt=\"PI Sheet: Component Overview\" width=\"706\" height=\"144\" \/><p class=\"wp-caption-text\">Picture 1: Component Overview<\/p><\/div>\n<div style=\"width: 598px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" style=\"border-bottom: 1px solid black; border-right: 1px solid black;\" title=\"Picture 2: Component Detail\" src=\"http:\/\/websha.de\/xstepcafe\/wp-content\/uploads\/2010\/11\/moz-screenshot-6.png\" alt=\"PI Sheet: Component Detail\" width=\"588\" height=\"184\" \/><p class=\"wp-caption-text\">Picture 2: Component Detail<\/p><\/div>\n<h1>The XStep Setup<\/h1>\n<p>In the further discussion I will concentrate on the list overview (Picture 1). In Picture 3 you see the structure of the XStep. For every component an XStep with an instruction (&#8216;Line&#8217;) is generated (using a special custom generation scope, but you can just as well use one of the standard generation scopes for material components as well). The first element is a placeholder for dynamic status icons which I will not explain in this article.<\/p>\n<div style=\"width: 296px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" style=\"border: 1px solid black;\" title=\"Picture 3: The XStep\" src=\"http:\/\/websha.de\/xstepcafe\/wp-content\/uploads\/2010\/11\/moz-screenshot-8.png\" alt=\"XStep: Component Overview Section\" width=\"286\" height=\"218\" \/><p class=\"wp-caption-text\">Picture 3: The XStep<\/p><\/div>\n<p>The important element here is a long text output element using PPPI_FRAGMENT_HTML. Here I have included placeholders for 3 image elements. This setup assumes that you have already created your safety symbol images in the web repository (TA SMW0). The naming convention I used here for the file names is Z_ICON_EHS_&lt;SpecificName&gt;.gif where &#8216;&lt;SpecificName&gt;&#8217; is to be replaced by some meaningful string for each different symbol.<\/p>\n<div style=\"width: 706px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" style=\"border-bottom: 1px solid black;\" title=\"Picture 4: The Long Text\" src=\"http:\/\/websha.de\/xstepcafe\/wp-content\/uploads\/2010\/11\/moz-screenshot-9.png\" alt=\"XStep: Long text for symbol output\" width=\"696\" height=\"251\" \/><p class=\"wp-caption-text\">Picture 4: The Long Text<\/p><\/div>\n<p>As you can see I am including a parameter replacement (&amp;&#8230;&amp;) for each of my potential safety symbols. In my case I have restricted the scenario to max. 3 symbols per material. So if you need more you need to extend this of course. You might already have noticed that I have always 3 images here so you would expect always 3 images to be shown in the PI Sheet. Of course if the specific parameter is not evaluated (because there is no such symbol for the specific material) the image source would read &#8216;Z_ICON_EHS_.gif&#8217;. This of course would lead to nasty little broken link images in your PI Sheet. Therefore make sure that you also create a special image in the web repository with exactly that name (Z_ICON_EHS_.gif) which displays nothing (1&#215;1 pixel with full transparency). When you do this an image is only shown where there should be one.<\/p>\n<p>Now of course the real work begins when we come to the valuation of these parameters. The basic setup is shown in Picture 5 where 3 different parameters (those used in the long text parameter replacement) are valuated with 3 different valuation symbols.<\/p>\n<div style=\"width: 706px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" style=\"border-bottom: 1px solid black;\" title=\"Picture 5: The Parameter Symbol Valuation\" src=\"http:\/\/websha.de\/xstepcafe\/wp-content\/uploads\/2010\/11\/moz-screenshot-10.png\" alt=\"XStep: Parameter Valuation\" width=\"696\" height=\"185\" \/><p class=\"wp-caption-text\">Picture 5: The Parameter Symbol Valuation<\/p><\/div>\n<h1>Linking the Symbols with the Material<\/h1>\n<p>Of course there are many ways to define safety information in an SAP environment. If you are using EHS you will probably find the information there. To make it simple for my demo scenario I have chosen to use the material classification. I created a material class (TA CL01, class type 001) which includes 3 characteristics PH_SYM_01, PH_SYM_02, and PH_SYM_03 with some meaningful description. The I classified those of my component materials where I want to see safety symbols in the PI Sheet (TA MM02). In my example for material MX_RAW_AI_01 I only valuated the first 2 characteristics:<\/p>\n<ul>\n<li>PH_SYM_01 = GS_X<\/li>\n<li>PH_SYM_02 = R_GLOVES<\/li>\n<\/ul>\n<p>Of course the correspondent images (amongst others) must exist in the web repository (TA SMW0):<\/p>\n<ul>\n<li>Z_ICON_EHS_GS_X.GIF<\/li>\n<li>Z_ICON_EHS_R_GLOVES.GIF<\/li>\n<\/ul>\n<h1>Symbol Valuation<\/h1>\n<h2>Helper Function<\/h2>\n<p>To get the actual characteristic value of the classified material I first created a small helper function:<\/p>\n<blockquote>\n<pre>FUNCTION Z_PH_GET_EHS_SYMBOL.\r\n*\"----------------------------------------------------------------------\r\n*\"*\"Local Interface:\r\n*\"  IMPORTING\r\n*\"     REFERENCE(MATNR) LIKE  RESB-MATNR\r\n*\"     REFERENCE(ATNAM) LIKE  CABN-ATNAM\r\n*\"  EXPORTING\r\n*\"     REFERENCE(SYMBOL) LIKE  AUSP-ATWRT\r\n*\"----------------------------------------------------------------------\r\n\r\nTABLES: cabn, ausp.\r\n\r\nSELECT SINGLE * FROM cabn\r\n  WHERE atnam = atnam.\r\n\r\nSELECT SINGLE * FROM ausp\r\n  WHERE objek = matnr\r\n  AND   atinn = cabn-atinn.\r\n\r\nIF sy-subrc = 0.\r\n  symbol = ausp-atwrt.\r\nENDIF.\r\n\r\nENDFUNCTION.\r\n<\/pre>\n<\/blockquote>\n<h2>BAdI Implementation<\/h2>\n<p>In this article I will not describe how to set up and implement the valuation symbols. If you want to know how to get started with these valuation BAdIs please refer to my article &#8216;<a href=\"http:\/\/websha.de\/xstepcafe\/2008\/07\/09\/using-badis-for-custom-valuation-and-generation\/\">Using BAdIs for Custom Valuation and Generation in XSteps<\/a>&#8216;.<\/p>\n<p>Here is the code you need to include for valuating the safety symbol parameters:<\/p>\n<blockquote>\n<pre>method IF_CMX_XS_SERVICE_SYMBOL~GET_DATA.\r\n\r\n*====================================================================\r\n* This is a very basic method for valuation of XStep symbols:\r\n* - It contains a lot of hardcoded elements!\r\n* - There is no exception handling!\r\n*\r\n*====================================================================\r\n\r\n*=== Data declaration ===============================================\r\n  DATA: ls_tempsym       TYPE cmx_xs_w_symbol_name,\r\n        ls_symbol        TYPE cmx_xs_w_symbol_name,\r\n        l_ehs_symbol    TYPE        AUSP-ATWRT,\r\n        l_rsnum          TYPE        resb-rsnum,\r\n        l_rspos          TYPE        resb-rspos,\r\n        l_rsart          TYPE        resb-rsart,\r\n        l_posnr          type        resb-posnr,\r\n        l_sortf          TYPE        resb-sortf,\r\n        l_matnr          TYPE        resb-matnr,\r\n        l_qty            TYPE        resb-bdmng,\r\n        ls_resbd         TYPE        resbd.\r\n\r\n*=== Preparation ====================================================\r\n\r\n*--- Set namespace of the valuated symbols --------------------------\r\nls_tempsym-namespace = 'SAP'.\r\n\r\nIF flt_val-application = 'MOR'.\r\n\r\n*   get reservation number from generated step\r\n    ls_tempsym-symbol = 'RESERVATION'.\r\n    query-&gt;get_value_into_numc(\r\n                   EXPORTING\r\n                        symbol  = ls_tempsym\r\n                   IMPORTING\r\n                         data   = l_rsnum ).\r\n*   get reservation item from generated step\r\n    ls_tempsym-symbol = 'RESERVATION_ITEM'.\r\n    query-&gt;get_value_into_numc(\r\n                   EXPORTING\r\n                        symbol  = ls_tempsym\r\n                   IMPORTING\r\n                         data   = l_rspos ).\r\n*   get reservation item type from generated step\r\n    ls_tempsym-symbol = 'RESERVATION_ITEM_TYPE'.\r\n    query-&gt;get_value_into_string(\r\n                   EXPORTING\r\n                        symbol  = ls_tempsym\r\n                   IMPORTING\r\n                         data   = l_rsart ).\r\n*   Read corresponding reservation data\r\n    CALL FUNCTION 'CO_BT_RESB_READ_WITH_KEY'\r\n      EXPORTING\r\n        flg_resbd       = space\r\n        no_read_from_db = 'X'\r\n        rsart_imp       = l_rsart\r\n        rsnum_imp       = l_rsnum\r\n        rspos_imp       = l_rspos\r\n      IMPORTING\r\n        resbd_exp       = ls_resbd\r\n      EXCEPTIONS\r\n        not_found       = 1\r\n        OTHERS          = 2.\r\n\r\n      l_sortf = ls_resbd-sortf.\r\n      l_matnr = ls_resbd-matnr.\r\n      l_posnr = ls_resbd-posnr.\r\n\r\n      IF ls_resbd-nomng IS initial.\r\n        l_qty = ls_resbd-bdmng.\r\n      ELSE.\r\n        l_qty = ls_resbd-nomng.\r\n      ENDIF.\r\n\r\nELSE.\r\n\r\n    ls_tempsym-symbol = 'QUANTITY_REQUIRED'.\r\n    query-&gt;get_value_into_packed(\r\n                   EXPORTING\r\n                        symbol  = ls_tempsym\r\n                   IMPORTING\r\n                         data   = l_qty ).\r\n\r\n    ls_tempsym-symbol = 'MATERIAL'.\r\n    query-&gt;get_value_into_string(\r\n                   EXPORTING\r\n                        symbol  = ls_tempsym\r\n                   IMPORTING\r\n                         data   = l_matnr ).\r\n\r\n   l_sortf = ''.\r\n\r\nENDIF.\r\n\r\n*=== Valuation depending on the filter symbol =======================\r\n  ls_symbol-namespace = flt_val-namespace.\r\n  ls_symbol-symbol    = flt_val-symbol.\r\n\r\n  CASE flt_val-symbol.\r\n\r\n*___ EH&amp;S Symbol 1 from Material Classification _____________________\r\n   WHEN 'EHS_SYMBOL_01'.\r\n     l_ehs_symbol = ''.\r\n     CALL FUNCTION 'Z_PH_GET_EHS_SYMBOL'\r\n      EXPORTING\r\n        matnr           = l_matnr\r\n        atnam           = 'PH_SYM_01'\r\n      IMPORTING\r\n        symbol          = l_ehs_symbol.\r\n\r\n       query-&gt;set_value_from_string( symbol = ls_symbol\r\n                                     data   = l_ehs_symbol\r\n                                     domain = 'DDIC\/ATWRT' ).\r\n*___ EH&amp;S Symbol 2 from Material Classification _____________________\r\n   WHEN 'EHS_SYMBOL_02'.\r\n     l_ehs_symbol = ''.\r\n     CALL FUNCTION 'Z_PH_GET_EHS_SYMBOL'\r\n      EXPORTING\r\n        matnr           = l_matnr\r\n        atnam           = 'PH_SYM_02'\r\n      IMPORTING\r\n        symbol          = l_ehs_symbol.\r\n\r\n       query-&gt;set_value_from_string( symbol = ls_symbol\r\n                                     data   = l_ehs_symbol\r\n                                     domain = 'DDIC\/ATWRT' ).\r\n\r\n*___ EH&amp;S Symbol 3 from Material Classification _____________________\r\n   WHEN 'EHS_SYMBOL_03'.\r\n     l_ehs_symbol = ''.\r\n     CALL FUNCTION 'Z_PH_GET_EHS_SYMBOL'\r\n      EXPORTING\r\n        matnr           = l_matnr\r\n        atnam           = 'PH_SYM_03'\r\n      IMPORTING\r\n        symbol          = l_ehs_symbol.\r\n\r\n       query-&gt;set_value_from_string( symbol = ls_symbol\r\n                                     data   = l_ehs_symbol\r\n                                     domain = 'DDIC\/ATWRT' ).\r\n\r\n  ENDCASE.\r\n\r\nENDMETHOD.\r\n<\/pre>\n<\/blockquote>\n<p>Please make sure that you use the same name of the characteristic in you material class and in the call of function Z_PH_GET_EHS_SYMBOL (atnam = &#8230;). Of course you can also include other symbol valuation code for material related valuation here as I described it in my guide.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article I show how to integrate material-dependent safety symbols into the PI Sheet.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_links_to":"","_links_to_target":""},"categories":[52,72,16],"tags":[36],"_links":{"self":[{"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/posts\/1174"}],"collection":[{"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/comments?post=1174"}],"version-history":[{"count":19,"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/posts\/1174\/revisions"}],"predecessor-version":[{"id":1193,"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/posts\/1174\/revisions\/1193"}],"wp:attachment":[{"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/media?parent=1174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/categories?post=1174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/tags?post=1174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}