Pre and post exit in ABAP method and Nodejs

简介: Pre and post exit in ABAP method and Nodejs

ABAP

Use pre or post exit to put your enhancement to be executed before or after the original method is executed.

image.png

nodejs

image.png

example.js:

const ENVIRONMENT = process.env.npm_lifecycle_event;
if (ENVIRONMENT === "build") {
 console.log("Running your build tasks!");
}
if ( ENVIRONMENT === "dev") {
 console.log("Running the dev server!");
}
if ( ENVIRONMENT === "prestart") {
 console.log("Prestart event: Prepare for Start event!");
}
if ( ENVIRONMENT === "poststart") {
 console.log("Poststart event: Do some cleanup task!");
}
if ( ENVIRONMENT === "start") {
 console.log("Running App in production!");
}

type command “npm start” in cmd, and prestart and poststart script will be executed automatically.

In fact this is how C4C local UI development is launched: check the complete script:

{
  "name": "sap-client-cod",
  "version": "1811.0.0-SNAPSHOT",
  "description": "SAP Customer OnDemand custom enhancements to Oberon HTML5 Client",
  "scripts": {
    "ariel": "ariel",
    "ariel:inspect": "npm run inspect node_modules/sap-n-ariel/bin/ariel",
    "build": "palm build",
    "build:all": "npm-run-all --aggregate-output --parallel build:component:**",
    "build:component:core": "palm build install -tdm --component sap.client.cod.core",
    "build:component:industry": "palm build install -tdm --component sap.client.cod.industry",
    "build:component:marketing": "palm build install -tdm --component sap.client.cod.marketing",
    "build:component:ncod": "palm build install -tdm --component sap.n.cod",
    "build:component:newui:dealfinder2": "palm build install -tdm --component sap.client.cod.newui.dealfinder2",
    "build:component:newui:evernote": "palm build install -tdm --component sap.client.cod.newui.evernote",
    "build:component:newui:mobileForecast": "palm build install -tdm --component sap.client.cod.newui.mobileForecast",
    "build:component:newui:pipeline": "palm build install -tdm --component sap.client.cod.newui.pipeline",
    "build:component:newui:service": "palm build install -tdm --component sap.client.cod.newui.service",
    "build:component:newui:shared": "palm build install -tdm --component sap.client.cod.newui.shared",
    "build:component:seod": "palm build install -tdm --component sap.client.cod.seod",
    "build:component:oberon": "palm build install -tdm --component sap.client.core",
    "clean:dist": "git clean -fdx dist",
    "clean:all": "git clean -fdx components coverage dist node_modules reports",
    "debug": "cross-var node $NODE_DEBUG_OPTION",
    "format": "palm format",
    "format:git:staged": "palm format --staged",
    "inspect": "node --inspect --inspect-brk",
    "lint": "palm lint",
    "lint:all": "palm lint 'cod/**/*.js'",
    "lint:all:src": "palm lint 'cod/**/src/main/uilib/**/*.js'",
    "lint:all:test": "palm lint 'cod/**/src/test/uilib/**/*.js'",
    "lint:git:staged": "palm lint --staged",
    "lint:git:head": "palm lint --head",
    "precommit": "npm run format:git:staged && npm run lint:git:staged",
    "preinstall": "git clean -fx .narv",
    "postinstall": "npm run update:narv",
    "prepare": "npm run register && npm run format package.json",
    "register": "palm extend sap-client --force --id cod",
    "reset": "npm run clean:all && npm run update:all",
    "serve": "brain start",
    "serve:debug": "npm run debug ./node_modules/sap-n-brain/bin/brain start",
    "serve:inspect": "npm run inspect ./node_modules/sap-n-brain/bin/brain start",
    "serve:dev": "cross-env NODE_ENV=development npm run serve",
    "serve:dev:debug": "cross-env NODE_ENV=development npm run serve:debug",
    "serve:dev:inspect": "cross-env NODE_ENV=development npm run serve:inspect",
    "serve:dist": "cross-env NODE_ENV=production npm run serve",
    "serve:dist:debug": "cross-env NODE_ENV=production npm run serve:debug",
    "serve:dist:inspect": "cross-env NODE_ENV=production npm run serve:inspect",
    "prestart": "npm1 run update:all",
    "prestart:debug": "npm run prestart",
    "prestart:inspect": "npm run prestart",
    "start": "npm -1d run serve:dev",
    "start:debug": "npm -d run serve:dev:debug",
    "start:inspect": "npm -d run serve:dev:inspect",
    "test:marketing": "npm run test karma-sap.client.cod.marketing",
    "test:newui:shared": "npm run test karma-sap.client.cod.newui.shared",
    "test:seod": "npm run test karma-sap.client.cod.seod",
    "test:n:cod": "npm run test karma-sap.n.cod",
    "test": "palm test",
    "preupdate:all": "npm run preinstall && npm run update:npm",
    "update:all": "npm update --no-save && npm run update:narv",
    "postupdate:all": "npm run prepare",
    "update:narv": "narv install",
    "update:npm": "npm list -g npm@5.10 || npm install -g npm@5.10",
    "version:reactor": "mvn -U versions:set -DnewVersion=$npm_package_version -DgroupId='*' -DprocessAllModules=true -DgenerateBackupPoms=false -f cod/pom.xml",
    "version:reactor:parent": "mvn -U versions:update-parent -DallowSnapshots=true -DparentVersion=[$npm_package_version] -DgroupId='*' -DgenerateBackupPoms=false -f cod/pom.xml",
    "version": "npm run version:reactor && npm run version:reactor:parent && npm install && npm run format package.json && git add --all",
    "check": "palm check",
    "test:n:cod:integration": "npm run ariel ariel-sap.client.cod.salesOrder",
    "test:n:cod:integration:inspect": "npm run ariel:inspect ariel-sap.client.cod.salesOrder",
    "test:n:cod:contracts": "npm run ariel ariel-sap.n.cod.contract",
    "test:n:cod:contracts:inspect": "npm run ariel:inspect ariel-sap.n.cod.contract"
  },
  "config": {
    "lint": {
      "formatter": "stylish"
    },
    "brain": {
      "branding": {
        "theme": "AURORA"
      },
      "server": {
        "http": {
          "host": "0.0.0.0",
          "port": 8080
        }
      },
      "cerebro": {
        "components": [
          "sap.n.base",
          "sap.n",
          "sap.n.cod"
        ]
      },
      "compression": true,
      "cors": {
        "origin": "*"
      },
      "forwards": [
        {
          "source": "^\\/application(\\/.*)$",
          "target": "$1",
          "description": "legacy forward for old Tomcat use-cases based on application path"
        },
        {
          "source": "^(\\/resources\\/)sap-ui-cachebuster\\/(.*)$",
          "target": "$1$2",
          "description": "sap-ui-cachebuster bootstrapping not yet supported"
        },
        {
          "source": "^(.*)TestSuiteForJSFiles(.*)$",
          "target": "$1TestSuite$2",
          "description": "fallback to old test suites having extension ForJSFiles. Relict from old html unit tests fieles. This forward rule should be removed in 1802"
        },
        {
          "source": "\\/proxy\\/(http|https)\\/([^_]*)\\/sap\\/ap\\/ui\\/repository(\\/.+){1}\\/BYD_COD\\/Runtime\\/HTML(\\/resources\\/.*)$",
          "target": "$4",
          "description": "Forward to local resources"
        },
        {
          "source": "(?:\\/sap-ui-cachebuster)*\\/BYD_COD\\/Runtime\\/HTML(\\/resources\\/.*)$",
          "target": "$1",
          "description": "Forward to local resources"
        }
      ],
      "fallbacks": [
        {
          "source": "^(.*\\/themes\\/)([^\\/]*)(\\/.*)$",
          "target": "$1base$3",
          "description": "fallback to base theme"
        },
        {
          "source": "^(.*\\/)([^_]*)(_[^_]*)_HK\\.properties$",
          "target": "$1$2$3_TW.properties",
          "description": "special fallback for chinese language"
        },
        {
          "source": "^(.*\\/)([^_]*)(_[^_]*)(_((?!HK).)*)\\.properties$",
          "target": "$1$2$3.properties",
          "description": "fallback to no-country"
        },
        {
          "source": "^(.*\\/)([^_]*)(_((?!en).)*)\\.properties$",
          "target": "$1$2_en.properties",
          "description": "fallback to english language properties"
        },
        {
          "source": "^(.*\\/)([^_]*)(_en)\\.properties$",
          "target": "$1$2.properties",
          "description": "fallback to base properties"
        }
      ],
      "proxies": [
        {
          "path": "^\\/proxy\\/(http|https)\\/(.*)$",
          "description": "proxy for requests to backend system",
          "target": "$0://$1"
        }
      ],
      "environments": {
        "development": {
          "forwards": [
            {
              "source": "^(\\/resources\\/sap\\/client\\/.*)-dbg(.*)\\.js$",
              "target": "$1$2.js",
              "description": "debug forward for client"
            },
            {
              "source": "^(\\/resources\\/sap\\/n\\/.*)-dbg(.*)\\.js$",
              "target": "$1$2.js",
              "description": "debug forward for n"
            },
            {
              "source": "^(\\/resources\\/JAM|JSST|mashup\\/.*)-dbg(.*)\\.js$",
              "target": "$1$2.js",
              "description": "debug forward for additional project resources"
            }
          ]
        }
      }
    },
    "codes": [
      {
        "name": "ProjectComponentResourceCategoryCode.STANDARD",
        "config": {
          "path": "/resources"
        }
      },
      {
        "name": "ProjectComponentResourceCategoryCode.TEST",
        "config": {
          "path": "/test-resources"
        }
      }
    ],
    "component": {
      "narv": {
        "base": "components",
        "format": "jar",
        "host": "nexus",
        "port": 8081,
        "protocol": "MAVEN",
        "repository": "deploy.snapshots",
        "scheme": "http"
      },
      "project": {
        "base": "cod",
        "source": {
          "directory": "src/main/uilib"
        },
        "test": {
          "directory": "src/test/uilib"
        }
      }
    },
    "build": {
      "path": "dist"
    },
    "test": {
      "karma": {
        "config": "karma.conf.js"
      },
      "mocha": {
        "config": "mocha.opts"
      }
    }
  },
  "keywords": [
    "Oberon",
    "C4C"
  ],
  "author": {
    "name": "SAP SE"
  },
  "contributors": [
    "SAP SE <*@sap.com>"
  ],
  "repository": {
    "type": "git",
    "url": "ssh://git@29418/LEAP/leap_cod.git"
  },
  "private": true,
  "devDependencies": {
    "compression": "^1.7.3",
    "connect-openui5": "^0.7.3",
    "cors": "^2.8.1",
    "glob": "^7.1.2",
    "npm-run-all": "^4.1.2",
    "sap-n-ariel": "^3.0.1",
    "sap-n-base": "^1.0.11",
    "sap-n-brain": "^3.1.0",
    "sap-n-brain-cerebro": "^3.0.0",
    "sap-n-brain-fallback": "^1.0.6",
    "sap-n-brain-forward": "^1.0.6",
    "sap-n-brain-index": "^1.0.2",
    "sap-n-brain-less": "^1.0.2",
    "sap-n-brain-proxy": "^2.0.0",
    "sap-n-log": "^1.0.10",
    "sap-n-narv": "^3.0.0",
    "sap-n-palm": "^5.0.0",
    "sap-n-project": "^3.2.0",
    "websql": "^0.4.4",
    "xmldom": "^0.1.27",
    "xpath": "0.0.24"
  },
  "$components": [
    {
      "groupId": "com.sap.n",
      "artifactId": "cod",
      "id": "sap.n.cod",
      "path": "ncod",
      "type": "LIB",
      "origin": "PROJECT",
      "dependencies": [
        "sap.n",
        "sap.n.base"
      ]
    },
    {
      "groupId": "com.sap.client.cod",
      "artifactId": "core",
      "id": "sap.client.cod.core",
      "path": "core",
      "type": "LIB",
      "origin": "PROJECT",
      "dependencies": [
        "sap.client.controls.core",
        "sap.ui.core"
      ]
    },
    {
      "groupId": "com.sap.client.cod",
      "artifactId": "industry",
      "id": "sap.client.cod.industry",
      "path": "industry",
      "type": "LIB",
      "origin": "PROJECT",
      "dependencies": [
        "sap.client.controls.core",
        "sap.ui.core"
      ]
    },
    {
      "groupId": "com.sap.client.cod",
      "artifactId": "marketing",
      "id": "sap.client.cod.marketing",
      "path": "marketing",
      "type": "LIB",
      "origin": "PROJECT",
      "dependencies": [
        "sap.client.controls.core",
        "sap.ui.core"
      ]
    },
    {
      "groupId": "com.sap.client.cod",
      "artifactId": "salesOrder",
      "id": "sap.client.cod.salesOrder",
      "path": "ncod",
      "type": "LIB",
      "origin": "PROJECT",
      "dependencies": [
        "sap.client.controls.core",
        "sap.ui.core"
      ]
    },
    {
      "groupId": "com.sap.client.cod.newui",
      "artifactId": "dealFinder2",
      "id": "sap.client.cod.newui.dealfinder2",
      "path": "newui/dealFinder2",
      "type": "LIB",
      "origin": "PROJECT",
      "dependencies": [
        "sap.ca.ui",
        "sap.client.cod.newui.shared",
        "sap.ui.core"
      ]
    },
    {
      "groupId": "com.sap.client.cod.newui",
      "artifactId": "mobileForecast",
      "id": "sap.client.cod.newui.mobileForecast",
      "path": "newui/mobileForecast",
      "type": "LIB",
      "origin": "PROJECT",
      "dependencies": [
        "sap.client.cod.newui.shared",
        "sap.ui.core"
      ]
    },
    {
      "groupId": "com.sap.client.cod.newui",
      "artifactId": "evernote",
      "id": "sap.client.cod.newui.evernote",
      "path": "newui/evernote",
      "type": "LIB",
      "origin": "PROJECT",
      "dependencies": [
        "sap.client.cod.newui.shared",
        "sap.ui.core"
      ]
    },
    {
      "groupId": "com.sap.client.cod.newui",
      "artifactId": "pipeline",
      "id": "sap.client.cod.newui.pipeline",
      "path": "newui/pipeline",
      "type": "LIB",
      "origin": "PROJECT",
      "dependencies": [
        "sap.ca.ui",
        "sap.client.cod.newui.shared",
        "sap.ui.core"
      ]
    },
    {
      "groupId": "com.sap.client.cod.newui",
      "artifactId": "service",
      "id": "sap.client.cod.newui.service",
      "path": "newui/service",
      "type": "LIB",
      "origin": "PROJECT",
      "dependencies": [
        "sap.ca.ui",
        "sap.client.cod.newui.shared",
        "sap.ui.core"
      ]
    },
    {
      "groupId": "com.sap.client.cod.newui",
      "artifactId": "shared",
      "id": "sap.client.cod.newui.shared",
      "path": "newui/shared",
      "type": "LIB",
      "origin": "PROJECT",
      "dependencies": [
        "sap.ca.scfld.md",
        "sap.client.m",
        "sap.ui.core"
      ]
    },
    {
      "groupId": "com.sap.client.cod",
      "artifactId": "seod",
      "id": "sap.client.cod.seod",
      "path": "seod",
      "type": "LIB",
      "origin": "PROJECT",
      "dependencies": [
        "sap.client.controls.core",
        "sap.ui.core"
      ]
    },
    {
      "groupId": "com.sap.client",
      "artifactId": "application",
      "id": "sap.client.core",
      "format": "war",
      "path": "oberon",
      "type": "APP",
      "origin": "NARV",
      "libraries": [
        {
          "groupId": "com.sap.ui5",
          "artifactId": "core",
          "id": "sap.ui.core"
        },
        {
          "groupId": "com.sap.ca",
          "artifactId": "scfld.md",
          "id": "sap.ca.scfld.md"
        },
        {
          "groupId": "com.sap.ca",
          "artifactId": "ui",
          "id": "sap.ca.ui"
        },
        {
          "groupId": "com.sap.ui5",
          "artifactId": "commons",
          "id": "sap.ui.commons"
        },
        {
          "groupId": "com.sap.ui5",
          "artifactId": "comp",
          "id": "sap.ui.comp"
        },
        {
          "groupId": "com.sap.ui5",
          "artifactId": "fl",
          "id": "sap.ui.fl"
        },
        {
          "groupId": "com.sap.ui5",
          "artifactId": "mobile",
          "id": "sap.m"
        },
        {
          "groupId": "com.sap.ui5",
          "artifactId": "richtexteditor",
          "id": "sap.ui.richtexteditor"
        },
        {
          "groupId": "com.sap.ui5",
          "artifactId": "table",
          "id": "sap.ui.table"
        },
        {
          "groupId": "com.sap.ui5",
          "artifactId": "layout",
          "id": "sap.ui.layout"
        },
        {
          "groupId": "com.sap.ui5",
          "artifactId": "ux3",
          "id": "sap.ui.ux3"
        },
        {
          "groupId": "com.sap.ui5",
          "artifactId": "unified",
          "id": "sap.ui.unified",
          "type": "LIB"
        },
        {
          "groupId": "com.sap.ushell",
          "artifactId": "ushell-lib",
          "id": "sap.ushell"
        },
        {
          "groupId": "com.sap.ui5",
          "artifactId": "viz",
          "id": "sap.viz"
        },
        {
          "groupId": "com.sap.suite",
          "artifactId": "suite-ui-commons",
          "id": "sap.suite.ui.commons"
        },
        {
          "groupId": "com.sap.suite",
          "artifactId": "suite-ui-microchart",
          "id": "sap.suite.ui.microchart"
        },
        {
          "groupId": "com.sap.ui5",
          "artifactId": "themelib_sap_belize",
          "id": "themelib_sap_belize"
        },
        {
          "groupId": "com.sap.ui5",
          "artifactId": "themelib_sap_bluecrystal",
          "id": "themelib_sap_bluecrystal"
        },
        {
          "groupId": "com.sap.ui5",
          "artifactId": "themelib_sap_goldreflection",
          "id": "themelib_sap_goldreflection"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "analytics",
          "id": "sap.client.analytics"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "ariel",
          "id": "sap.client.ariel"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "basecontrols",
          "id": "sap.client.basecontrols.core"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "cod",
          "id": "sap.client.cod"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "controls",
          "id": "sap.client.controls.core"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "core",
          "id": "sap.client"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "debug",
          "id": "sap.client.debug"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "embsupcore",
          "id": "sap.client.embsup"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "extensibility",
          "id": "sap.client.extensibility"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "flex.runtime",
          "id": "sap.client.flex.runtime"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "flex.runtime.content",
          "id": "sap.client.flex.runtime.content"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "login",
          "id": "sap.client.login"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "m",
          "id": "sap.client.m"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "m.analytics",
          "id": "sap.client.m.analytics"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "mashup",
          "id": "sap.client.mashup"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "setup",
          "id": "sap.client.setup"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "thirdparty",
          "id": "sap.client.thirdparty"
        },
        {
          "groupId": "com.sap.client",
          "artifactId": "wkt",
          "id": "sap.client.wkt"
        },
        {
          "groupId": "com.sap.n",
          "artifactId": "base",
          "id": "sap.n.base"
        },
        {
          "groupId": "com.sap.n",
          "artifactId": "test",
          "id": "sap.n.test"
        },
        {
          "groupId": "com.sap.n",
          "artifactId": "core",
          "id": "sap.n"
        }
      ]
    },
    {
      "groupId": "com.sap.n",
      "artifactId": "core",
      "id": "test.sap.n",
      "path": "oberon/test/sap/n",
      "type": "LIB",
      "origin": "NARV",
      "classifier": "testresources"
    },
    {
      "groupId": "com.sap.client",
      "artifactId": "core",
      "id": "test.sap.client",
      "path": "oberon/test/sap/client",
      "type": "LIB",
      "origin": "NARV",
      "classifier": "testresources"
    }
  ],
  "$tests": [
    {
      "id": "ariel-sap.client.cod.salesOrder",
      "component": "sap.client.cod.salesOrder",
      "config": "order.ariel.config.js",
      "category": "ARIEL"
    },
    {
      "id": "ariel-sap.n.cod.contract",
      "component": "sap.n.cod",
      "config": "contract.ariel.config.js",
      "category": "ARIEL"
    },
    {
      "id": "karma-sap.n.cod",
      "component": "sap.n.cod",
      "category": "KARMA"
    },
    {
      "id": "karma-sap.client.cod.marketing",
      "component": "sap.client.cod.marketing",
      "category": "KARMA"
    },
    {
      "id": "karma-sap.client.cod.newui.shared",
      "component": "sap.client.cod.newui.shared",
      "category": "KARMA"
    },
    {
      "id": "karma-sap.client.cod.seod",
      "component": "sap.client.cod.seod",
      "category": "KARMA"
    }
  ]
}


相关文章
|
移动开发 JavaScript Java
Pre and post exit in ABAP method and Nodejs
Pre and post exit in ABAP method and Nodejs
84 0
Pre and post exit in ABAP method and Nodejs
ABAP Method remote comparison
Suppose you would like to compare one method of class in different systems without using UDO tool, you can use the built-in remote comparison functionality embedded in ABAP editor:
82 0
ABAP Method remote comparison
|
XML 数据格式
SAP ABAP实用技巧介绍系列之 在xslt里call ABAP method
Created by Jerry Wang, last modified on Jul 02, 2014
169 0
|
2月前
|
JSON JavaScript 前端开发
JS服务端技术—Node.js知识点
本篇文章是我开始系统学习Node.js的一些笔记。如果文中阐述不全或不对的,多多交流。
62 0
JS服务端技术—Node.js知识点
|
3月前
|
JavaScript
node下的two.js调用one.js出现无法编译问题 Cannot find module ‘c:
node下的two.js调用one.js出现无法编译问题 Cannot find module ‘c:
47 0
|
3月前
|
JavaScript
Turndown 源码分析:五、节点相关`root-node.js`和`node.js`
Turndown 源码分析:五、节点相关`root-node.js`和`node.js`
|
2月前
|
消息中间件 Web App开发 JavaScript
Node.js【简介、安装、运行 Node.js 脚本、事件循环、ES6 作业队列、Buffer(缓冲区)、Stream(流)】(一)-全面详解(学习总结---从入门到深化)
Node.js【简介、安装、运行 Node.js 脚本、事件循环、ES6 作业队列、Buffer(缓冲区)、Stream(流)】(一)-全面详解(学习总结---从入门到深化)
70 0
|
3月前
|
JavaScript 前端开发 API
Node.js【简介、安装、运行 Node.js 脚本、事件循环、ES6 作业队列、Buffer(缓冲区)、Stream(流)】(一)-全面详解(学习总结---从入门到深化)(下)
Node.js【简介、安装、运行 Node.js 脚本、事件循环、ES6 作业队列、Buffer(缓冲区)、Stream(流)】(一)-全面详解(学习总结---从入门到深化)
34 0
|
11天前
报错/ ./node_modules/axios/lib/platform/index.js Module parse failed: Unexpected token (5:2)怎么解决?
报错/ ./node_modules/axios/lib/platform/index.js Module parse failed: Unexpected token (5:2)怎么解决?
|
3月前
|
消息中间件 Web App开发 JavaScript
Node.js【简介、安装、运行 Node.js 脚本、事件循环、ES6 作业队列、Buffer(缓冲区)、Stream(流)】(一)-全面详解(学习总结---从入门到深化)(上)
Node.js【简介、安装、运行 Node.js 脚本、事件循环、ES6 作业队列、Buffer(缓冲区)、Stream(流)】(一)-全面详解(学习总结---从入门到深化)
42 0