{"id":142,"date":"2017-07-08T13:46:00","date_gmt":"2017-07-08T11:46:00","guid":{"rendered":"http:\/\/www.wordpress.stefan-kuehn.net\/wordpress\/?p=142"},"modified":"2017-07-17T11:09:47","modified_gmt":"2017-07-17T09:09:47","slug":"application-log","status":"publish","type":"post","link":"https:\/\/www.stefan-kuehn.net\/index.php\/2017\/07\/08\/application-log\/","title":{"rendered":"Application Log"},"content":{"rendered":"<p><strong>Description:<\/strong><\/p>\n<p>Easily usage of the SAP-Objects for the application log in complex Abap-OO applications.<\/p>\n<p><strong>Advantage to use it:<\/strong><\/p>\n<ul>\n<li>Easy handling of the functions for the application log<\/li>\n<li>Fast implementation of the application log<\/li>\n<\/ul>\n<h4>New development objects:<\/h4>\n<p>Abap interface<\/p>\n<p>Abap class<\/p>\n<h4>Abap interface<\/h4>\n<p>Create a new interface with SE24\/SE80<\/p>\n<p>It needs the 3 events <span style=\"color: #0000ff;\">FIRE_MESSAGE, DISPLAY_LOG, REFRESH, SAVE<br \/>\n<\/span><\/p>\n<p>You can copy the source (text based editor) here<strong><span style=\"color: #0000ff;\"> <a href=\"http:\/\/www.stefan-kuehn.net\/wp-content\/uploads\/2017\/07\/zsk_if_applog.txt\" target=\"_blank\" rel=\"noopener\">zsk_if_applog<\/a><\/span><\/strong><\/p>\n<p>(FIRE_MESSAGE is actually enogh to demonstrate)<\/p>\n<p><strong>Abap class<\/strong><\/p>\n<p>Create a new class with SE24\/SE80<\/p>\n<p>You can copy the source (text based editor) here <a href=\"http:\/\/www.stefan-kuehn.net\/wp-content\/uploads\/2017\/07\/zsk_cl_applog.txt\" target=\"_blank\" rel=\"noopener\"><strong>zsk_cl_applog<\/strong><\/a><\/p>\n<p><strong>Usage<\/strong><\/p>\n<ul>\n<li>Declare the interface in all classes, which have to use the application log.<\/li>\n<li>Optional: use the alias in the class to shorten the event name<br \/>\ne.g.: <span style=\"color: #0000ff;\">FM<\/span> instead of <span style=\"color: #0000ff;\">ZSK_IF_APP_LOG~FIRE_MESSAGE<\/span><\/li>\n<li>Use the event to trigger the messages<br \/>\n<span style=\"color: #0000ff;\">raise event fm<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0 exporting<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0 imp_MSGID = &#8217;00&#8217;<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0 imp_MSGTY = &#8216;I&#8217;<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0 imp_MSGNO = &#8216;398&#8217;<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0 imp_MSGV1 = &#8216;Test Message&#8217;.<\/span><\/li>\n<li>Now you just have to declare an object refering to the class, instantiate it and set the event handler:<\/li>\n<\/ul>\n<p><span style=\"color: #0000ff;\">Data: gr_log type ref to zsk_cl_applog.<\/span><br \/>\n<span style=\"color: #0000ff;\">CREATE OBJECT GR_LOG<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0 EXPORTING<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0 Imp LOG NAME \u00a0\u00a0\u00a0 = L<\/span><span style=\"color: #0000ff;\">V_LOG_NAME\u00a0\u00a0\u00a0 &#8221; dynamic value e.g. document number<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 Imp OBJECT\u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0 = c_OBJECT \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 &#8221; to be customized in SLG0<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 <\/span><span style=\"color: #0000ff;\">Imp SUBOBJECT = LV SUBOBJECT\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8221; to be customized in SLG0<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 Imp DAYS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 = c_<\/span><span style=\"color: #0000ff;\">DAYS \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 &#8220;constant e.g. 60 <\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0 EXCEPTIONS<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 MISSING INPUT<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 LOG NOT FOUND<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 LOG HEADER INCONSISTENT 3<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 INTERNAL ERROR<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Others<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0 IF SY-SUBRC 0.<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 MESSAGE ID SY-MSGID TYPE &#8216;E&#8217; NUMBER SY-MSGNO<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 return.<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0 ENDIF.<br \/>\n&#8220;you can use also different instances and handle different logs in you applications<\/span><br \/>\n<span style=\"color: #0000ff;\">set HANDLER gr_log-&gt;CATCH_FIRED_MESSAGE for all instances.<\/span><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>Don&#8217;t forget to save &amp; \/ or\u00a0 display the log. Directly by the method save\/display or from you application by triggering the event <span style=\"color: #0000ff;\">DISPLAY_LOG<\/span> or <span style=\"color: #0000ff;\">SAVE<\/span>.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description: Easily usage of the SAP-Objects for the application log in complex Abap-OO applications. Advantage to use it: Easy handling of the functions for the application log Fast implementation of the application log New development objects: Abap interface Abap class Abap interface Create a new interface with SE24\/SE80 It needs the 3 events FIRE_MESSAGE, DISPLAY_LOG, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":393,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[6,26,7],"_links":{"self":[{"href":"https:\/\/www.stefan-kuehn.net\/index.php\/wp-json\/wp\/v2\/posts\/142"}],"collection":[{"href":"https:\/\/www.stefan-kuehn.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stefan-kuehn.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stefan-kuehn.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stefan-kuehn.net\/index.php\/wp-json\/wp\/v2\/comments?post=142"}],"version-history":[{"count":29,"href":"https:\/\/www.stefan-kuehn.net\/index.php\/wp-json\/wp\/v2\/posts\/142\/revisions"}],"predecessor-version":[{"id":394,"href":"https:\/\/www.stefan-kuehn.net\/index.php\/wp-json\/wp\/v2\/posts\/142\/revisions\/394"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.stefan-kuehn.net\/index.php\/wp-json\/wp\/v2\/media\/393"}],"wp:attachment":[{"href":"https:\/\/www.stefan-kuehn.net\/index.php\/wp-json\/wp\/v2\/media?parent=142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stefan-kuehn.net\/index.php\/wp-json\/wp\/v2\/categories?post=142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stefan-kuehn.net\/index.php\/wp-json\/wp\/v2\/tags?post=142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}